Link to home
Start Free TrialLog in
Avatar of dwp090598
dwp090598

asked on

filter for dialog window

I am trying to filter out the 'return' key and 'esc' key in a dialog window. I know how to pass a UniversalProcPtr to ModalDialog( gMyModalProc, &itemHit); and filter out the keys. When I use DialogSelect(&gMainEventRecord, &hitWindow, &itemHit); and try to filter out the keys the keys get passed anyway.  I have a dialog window with three edit text fields, I would like to limit two edit fields to 4 chars each and the other to 31 chars. How can I get around this?


if(IsDialogEvent(&gMainEventRecord))
     if(DialogSelect(&gMainEventRecord, &hitWindow, &itemHit))
                    HandleFileInfoDialog(itemHit, &gMainEventRecord);


Boolean HandleFileInfoDialog (short itemHit, EventRecord *theEvent)
{

      
      if(theEvent->what  == keyDown)
            switch((theEvent->message) & charCodeMask)
            {
                  case 0x0d:
                  case 0x03:
                        SysBeep(1);
                        return;
                  case 0x1b:
                        itemHit = 1;
            }
            
      Check_For_Changes();
      
      switch(itemHit)
      {
                  case 1:
     doWhatever();
                  break;

   case  2:
     doWhatever();
   break

      }
}
ASKER CERTIFIED SOLUTION
Avatar of boonstra
boonstra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dwp090598
dwp090598

ASKER

yes, my dialog is non modal. I was trying to do the filtering after calling DialogSelect().

Thanks Again...