Hi guys,
Iam not able to create a dynamic popup list. I was
able to create a dynamic list but Iam not clear about
popup list.
The LstNewList says that if I give the triggerID, then
both my list and trigger control are created. So I
dont have to explicitly create a trigger, which is
again a control.
So please tell me whether this order is correct
1. I create a LstNewList giving ids for both the list
and the trigger and assume both the poplist and the
trigger are created.
2. Allocate memory for the list elements and fill the
strings.
3. LstSetListChoices.
4. LstSetSelection.
After this I dont know whether I need to use the
contol(trigger) ID and set its label(CtlSetLabel) and
position the control(trigger) (or) would the popuplist
take of things and do I just have to call
LstSetPosition() and LstDrawList().
5. Having said this should I call LstDrawList here or
do I have to call it when I receive a CtlSelectEvent?
If someone could please help me on this, then I should
be able to get the proper events and play with it. In
the other threads I was able to find the sample code
for events but I was not able to find code for
creation of dynamic PopUpList.
Thanks in advance.
char** listLabel;
// so 40 is list id and 41 is trigger ID
LstNewList((void**)&gCurrentForm, 40, 10, 10, 50, 50,
stdFont, 3,
41);
listPtr = (ListType*)FrmGetObjectPtr(gCurrentForm,
40);
listLabels = (Char**) MemPtrNew(v->elementCount *
sizeof (Char*));
for (i = 0; i < listCount; i++) {
listLabels[i] = (Char*) MemPtrNew((tLength + 1)*
sizeof
(Char));
MemMove(listLabels[i], /* some location */, tLength);
}
LstSetListChoices(listPtr, listLabels, listCount);
LstSetPosition(listPtr, 20, 20);
FrmShowObject(gCurrentForm, 40);
LstSetSelection(listPtr, 0);
LstDrawList(listPtr);
FrmSetFocus(gCurrentForm, 40);
This is my sample code. But Iam confused. This is my
understanding, I
have to show the trigger to the user and when the user
clicks on it
the popup list should be displayed.
Ok in that case, initially should I use the trigger ID
or the list ID
(for FrmSetObjectPosition) to display the trigger to
the user.
Does anyone have any code snippet for Dynamic popup
list.
Thanks
Venkatesh
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/