Modal forms cature frmOpenEvent.  The preferences screens in the built-in
applications do this quite nicely.

Call FrmPopupForm to enter the form and FrmReturnToForm to exit.  The rest
should function like any non-modal form... if I am thinking the same thing
you are thinking.
Elia

-----Original Message-----
From: Lenny Palozzi [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 08, 1999 11:33 PM
To: [EMAIL PROTECTED]
Subject: Modal form and List Control clash


Hi there,

I am having a problem initializing a list control on a modal dialog. As I
understand it, all initialization of a modal dialog is to happen before the
call to FrmDoDialog(). But I am getting a Bus Error when calling
LstSetListChoices BEFORE FrmDoDialog(). It seems that this also affects
'normal' forms before calling FrmDrawForm(). I had the list working on my
main form and I had to initialize the list after the call to FrmDrawForm in
my form event handler for it to work.

I have tried setting an event handler but for modal forms it doesn't
capture the frmOpenEvent, where I was hoping to call my FillSearchResults()
AFTER the call to the modal forms FrmDrawForm(). Should I be trying to
capture another event? Is LstSetListChoices broken? My code below follows.

Anyways, is there any other way to 'pop-up' another form/modal dialog that
contains a list? I noticed that the 'Application' application has a nice
list under Info/Delete of all the apps, how is that list initialized?

Any help is appreciated.

Thank you,
Lenny Palozzi.
mailto:[EMAIL PROTECTED]

static void FillSearchResults(void)
{
   FormPtr formP;
   ListPtr listP;
   VoidHand gResultItems;

   formP = FrmGetActiveForm();
   listP = FrmGetObjectPtr(formP, FrmGetObjectIndex(formP,
lstID_SearchResults));

        gResultItems = SysFormPointerArrayToStrings(chrpResults, numResults);
   LstSetListChoices(listP, MemHandleLock(gResultItems), numResults);
//   LstDrawList(listP);

   MemHandleUnlock(gResultItems);
   MemHandleFree(gResultItems);
}

static void DisplaySearchResultsForm(void)
{
        FormPtr previousForm = FrmGetActiveForm();
   FormPtr form = FrmInitForm(frmID_SearchResults);

   FrmSetActiveForm(form);

   //set event handler;
//   FrmSetEventHandler(form, DisplaySearchResultsFormEventHandler);
   FillSearchResults();
        FrmDoDialog(form);

   if (previousForm)
        FrmSetActiveForm(previousForm);

   FrmDeleteForm(form);
}




Reply via email to