Hi,

If you want to show the DetailsView on a click. You must change the
'onchange' to 'onclick' in you listbox object.

<listbox height="150" name="listbox" width="100%" x="0" y="20"
background="#FFFFFF"
    itemHeight="24" itemOverColor="#CCFFCC" onclick="lb_onchange()"
    autoscroll="true" itemSelectedColor="#99FF99"/>

Kind Regards,
Stefan Van Damme (aka Stefan vd)
Gadget Developer

On Apr 21, 5:32 pm, Colin <[email protected]> wrote:
> Hi,
>
> As a newbie to gadget development, I have a question relating to the
> behavior opening a DetailsView window. Basically, the DetailsView
> window appears (ie. is visible) for alternate clicks in the listbox in
> my main view - and not each time. But debug.trace shows me that the
> detailsView_onOpen() function is being called every time. Is it
> something to do with the flags (gddDetailsViewFlagToolbarOpen, etc.)?
>
> in My main view, I have:
> <listbox height="150" name="listbox" width="100%" x="0" y="20"
> background="#FFFFFF"
>     itemHeight="24" itemOverColor="#CCFFCC" onchange="lb_onchange()"
>     autoscroll="true" itemSelectedColor="#99FF99"/>
>
> I initialize detailsView at the top:
> var detailsView = new DetailsView();
>
> And function lb_onchange is:
>
> function lb_onchange() {
>   var selectedItem = listbox.selectedItem;
>         var alert_ix = listbox.selectedIndex;
>         var alert = lfuUserInfo.allAlerts[alert_ix];
>         debug.trace("lb_onchange: alert ix="+alert_ix);
>         //var detailsView = new DetailsView(); //done on initialization
>         debug.trace("lb_onchange: detailsView done");
>         detailsView.SetContent( "", undefined, "details.xml", false, 0);
>         debug.trace("lb_onchange: detailsView SetContent done");
>         detailsView.detailsViewData.putValue("alert", alert);
>         // Set a reference to the "closeDetailsView" function in the
> detailsViewData
>   detailsView.detailsViewData.putValue("closeDetailsView",
> closeDetailsView);
>   // Show the details view
>         plugin.showDetailsView(detailsView, "Alert",
> gddDetailsViewFlagToolbarOpen, onDetailsViewFeedback);
>         detailsViewIsOpen = true;
>         debug.trace("lb_onchange: showDetailsView done");
>
> }
>
> Also, in my main view:
>
> function closeDetailsView() {
>   plugin.CloseDetailsView();
>
> }
>
> function onDetailsViewFeedback(detailsViewFlags) {
>   if (detailsViewFlags == gddDetailsViewFlagNone) {
>     // User closed the details view
>   } else if (detailsViewFlags == gddDetailsViewFlagToolbarOpen) {
>     // User clicked on the title of the details view
>   }
>
> }
>
> My DetailsView xml is:
>
> <view height="150" width="450" onopen="detailsView_onOpen()">
>   <img height="150" width="450" x="0" y="0" src="stock_images
> \background.png"
>    />
> <img cursor="hand" enabled="true" name="imgClose" x="320" y="8"
> onclick="detailsView_Close()"
>       src="images\closeBtn.png"/>
>   <label enabled="true" height="15" name="label1" x="20" y="25"
> onclick="onclick_label1()"
>    >...
>   </label>
>   <label enabled="true" height="65" name="label2" x="20" y="45"
> onclick="onclick_label2()"
>    />
>   <script src="details.js" />
> </view>
>
> And details.js has:
>
> function detailsView_onOpen() {
>         debug.trace("detailsView_onOpen()");
> ...
>
> }
>
> Thanks in anticipation.
>
> Colin Goldberg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to