2 messages in com.googlegroups.google-desktop-developerRe: add a listbox / drop-down menu to...
FromSent OnAttachments
Raazzzin27 Dec 2006 11:46 
James [GD Team]28 Dec 2006 11:40 
Subject:Re: add a listbox / drop-down menu to the options dialog in a gadget
From:James [GD Team] (j.@google.com)
Date:12/28/2006 11:40:02 AM
List:com.googlegroups.google-desktop-developer

Hello Raj,

The List/Drop control is not yet available to "xml" style views. You will need to implement the options dialog with your own "plugin.onShowOptionsDlg " handler.

Here's an example based on the code you provided:

plugin.onShowOptionsDlg = showOptionsDlg;

function showOptionsDlg(wnd) { var listItems = new Array("item 1", "item 2", "item 3"); var curSelectedItem = "item 2"; var list = wnd.AddControl(gddWndCtrlClassList, gddWndCtrlTypeListDrop,"list", listItems, 10, 35, 280, 2000); list.value = curSelectedItem; wnd.onClose = onOptionsDlgClosed; }

function onOptionsDlgClosed(wnd, code) { if (code == gddIdOK) { var list = wnd.GetControl("list"); view.alert(list.value); } else if (code ==gddIdCancel) { view.alert('Cancelled'); } }

Keep in mind this is a feature of an older API, so any "options.xml" will be ignored.

You can learn more about "AddControl" and the types of controls you can add in the archived documentation:

http://desktop.google.com/dev/pre14-11-2006-doc.zip

Cheers! James

Raazzzin wrote:

How do I do this?

I saw this:

var listItems = new Array("item 1", "item 2", "item 3"); var curSelectedItem = "item 2"; var list = wnd.AddControl(gddWndCtrlClassList, gddWndCtrlTypeListDrop, "list", listItems, 10, 35, 280, 2000); list.value = curSelectedItem;

Where is wnd declared in the app? Is that supposed to instead be the name of the Options form etc? That gives me a debug error?

I'm new to the gadget development.

Thanks.