did you set the number of items of the list before, so the callback is
called as many time as the number of item specified ?

----- Original Message -----
From: "Vidya Amar" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, June 11, 2003 2:32 PM
Subject: Popup list callback function not being called...urgent help needed


> Hi All,
>           I have a popup trigger attached to a list which is created from
a
> database by a callback function
> (LstSetDrawFunction) in the MainFormInit routine.
>
> I have pre-set the label for the popup trigger
> to be the 1st choice in the list when the form opens.
> Problem:- The callback function is not being called when the form opens.
> Here is the code snippet:-
>
>
> const char *ListData;
>
> static void MainListDraw (Int16 itemNum, RectangleType *bounds, Char**
> itemsText)
> {
> MemHandle recordH = NULL;
> BanksoftDBRecordType *record = NULL;
> recordH = DmQueryRecord (gPigmyDB, itemNum);
> if (! recordH==NULL)
> {
> record = MemHandleLock (recordH);
>                                 UnpackBanksoftRecord (&BanksoftDBRecord,
> (const PackedBanksoftRecord *) record);
> if(itemNum==0)
>                                 {
>                                   ListData = BanksoftDBRecord.Rowfields
[1];
>                                  }
> WinDrawChars (BanksoftDBRecord.Rowfields [1], StrLen
> (BanksoftDBRecord.Rowfields [1]), bounds->topLeft.x,
> bounds->topLeft.y); MemHandleUnlock (recordH);
> }
>
> }
>
> static void MainFormInit (FormPtr /*frmP*/)
> {
> ControlPtr ctl;
>     Char * str;
>     ListType *List;
>     UInt16 n=0, ListSelect;
>     n=DmNumRecords (gPigmyDB);
> List = (ListType *) GetObjectPtr (PigmyAccountNoListList);
> LstSetDrawFunction (List, MainListDraw);
> LstSetListChoices (List, NULL, n);
> LstSetHeight (List, 5);
> ctl = (ControlPtr)GetObjectPtr (PigmyAccountNoTriggerPopTrigger);
>   CtlSetLabel (ctl, ListData);
> }
>
> static Boolean MainFormHandleEvent(EventPtr eventP)
> {
>    Boolean handled = false;
>    FormPtr frmP;
>    int numChoices =0;
>    switch (eventP->eType)
> {
> case menuEvent:
> return MainFormDoCommand (eventP->data.menu.itemID);
> case frmOpenEvent:
> frmP = FrmGetActiveForm ();
> MainFormInit (frmP);
> FrmDrawForm (frmP);
> handled = true;
> break;
> case popSelectEvent:
> switch (eventP->data.popSelect.controlID){
> case PigmyAccountNoTriggerPopTrigger:
> if(!gPigmyDB)
> {
> FrmCustomAlert( MessageBoxAlert,"NO data..",NULL,NULL);
>     break;
> }
> handled = false;
> break;
> default:
> break;
> }
> default:
> break;
>
> }
>
> return handled;
> }
>
> _________________________________________________________________
> ICICI's NRI services. They make life easy.
> http://server1.msn.co.in/msnspecials/nriservices/index.asp Find out more.
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to