RE: Turning on the lights

2001-08-16 Thread Avilla, Dane

I think you might need a break before 

case menuEvent:

Probably what is happening is that the event is falling through your
ctlSelectEvent case statement, and then continues on through the menuEvent
case, where MainFormDoCommand is called.  I would guess that
MainFormDoCommand just pops up the about box . . . ?

Cheers,

-DGA

 Ok. I have two buttons on my form. One is the about
 button and the other on a clear button that I would
 like to make the palm light go on with. If I click on
 the about button the about form popups up. but if I
 click on the clear button (which should only turn the
 light on or off) the about form will popup after the
 light goes on??
 
 static Boolean MainFormHandleEvent(EventPtr eventP)
 {
Boolean handled = false;
FormPtr frmP;
 
   switch (eventP-eType) 
   {
   case ctlSelectEvent:
   UInt16  ctrlID = 
 eventP-data.ctlSelect.controlID;
   ControlPtr ctrlPtr=
 eventP-data.ctlSelect.pControl;
   
   if (ctrlID == MainAboutButton)
   {
   frmP = FrmInitForm (AboutForm);
   FrmDoDialog (frmP);
   FrmDeleteForm (frmP);
   handled = true;
   }
   
   if (ctrlID == MainClearButton)
   {
   EventType theEvent;
 
 
   theEvent.eType = keyDownEvent;
   theEvent.data.keyDown.chr = 
 backlightChr ;
   theEvent.data.keyDown.keyCode = 0;
   theEvent.data.keyDown.modifiers 
 = commandKeyMask;
 
   EvtAddEventToQueue(theEvent);
   handled = true;
   }
   
 
   case menuEvent:
   return 
 MainFormDoCommand(eventP-data.menu.itemID);
 
   case frmOpenEvent:
   frmP = FrmGetActiveForm();
   MainFormInit( frmP);
   FrmDrawForm ( frmP);
   handled = true;
   break;
 
   default:
   break;
   
   }
   
   return handled;
 }

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



Re: Turning on the lights

2001-08-16 Thread Jeff Wheeler

 switch (eventP-eType)
 {
 case ctlSelectEvent:
 UInt16  ctrlID = eventP-data.ctlSelect.controlID;
 ControlPtr ctrlPtr=
 eventP-data.ctlSelect.pControl;

 if (ctrlID == MainAboutButton)
 {
 snip
 }

 if (ctrlID == MainClearButton)
 {
 snip
 }

 case menuEvent:
 return MainFormDoCommand(eventP-data.menu.itemID);

 snip

Have you stepped through the code with debugger?  This will help you see the
flow through the code.

Looks like you're missing a break or return in your ctlSelectEvent.  This
will send you through your handler for menuEvent with invalid eventP data.

HTH

Jeff



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



Re: Turning on the lights

2001-08-16 Thread Michael S. Davis

On Thu, 16 Aug 2001, Johnathan Smith wrote:

 Ok. I have two buttons on my form. One is the about
 button and the other on a clear button that I would
 like to make the palm light go on with. If I click on
 the about button the about form popups up. but if I
 click on the clear button (which should only turn the
 light on or off) the about form will popup after the
 light goes on??

 static Boolean MainFormHandleEvent(EventPtr eventP)
 {
Boolean handled = false;
FormPtr frmP;

   switch (eventP-eType)
   {
   case ctlSelectEvent:
   UInt16  ctrlID = eventP-data.ctlSelect.controlID;
   ControlPtr ctrlPtr=
 eventP-data.ctlSelect.pControl;

   if (ctrlID == MainAboutButton)
   {
   frmP = FrmInitForm (AboutForm);
   FrmDoDialog (frmP);
   FrmDeleteForm (frmP);
   handled = true;
   }

   if (ctrlID == MainClearButton)
   {
   EventType theEvent;


   theEvent.eType = keyDownEvent;
   theEvent.data.keyDown.chr = backlightChr ;
   theEvent.data.keyDown.keyCode = 0;
   theEvent.data.keyDown.modifiers = commandKeyMask;

   EvtAddEventToQueue(theEvent);
   handled = true;
   }


You are missing a break statement.

   case menuEvent:
   return MainFormDoCommand(eventP-data.menu.itemID);

   case frmOpenEvent:
   frmP = FrmGetActiveForm();
   MainFormInit( frmP);
   FrmDrawForm ( frmP);
   handled = true;
   break;

   default:
   break;

   }

   return handled;
 }

 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/

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



Shoot-to-Win

Protect the 2nd Amendment



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



RE: Turning on the lights

2001-08-16 Thread Johnathan Smith

thank for your help if you would like to im me my name
is redhatpusher


--- Avilla, Dane [EMAIL PROTECTED] wrote:
 I think you might need a break before 
 
 case menuEvent:
 
 Probably what is happening is that the event is
 falling through your
 ctlSelectEvent case statement, and then continues on
 through the menuEvent
 case, where MainFormDoCommand is called.  I would
 guess that
 MainFormDoCommand just pops up the about box . . . ?
 
 Cheers,
 
 -DGA
 
  Ok. I have two buttons on my form. One is the
 about
  button and the other on a clear button that I
 would
  like to make the palm light go on with. If I click
 on
  the about button the about form popups up. but if
 I
  click on the clear button (which should only turn
 the
  light on or off) the about form will popup after
 the
  light goes on??
  
  static Boolean MainFormHandleEvent(EventPtr
 eventP)
  {
 Boolean handled = false;
 FormPtr frmP;
  
  switch (eventP-eType) 
  {
  case ctlSelectEvent:
  UInt16  ctrlID = 
  eventP-data.ctlSelect.controlID;
  ControlPtr ctrlPtr=
  eventP-data.ctlSelect.pControl;
  
  if (ctrlID == MainAboutButton)
  {
  frmP = FrmInitForm (AboutForm);
  FrmDoDialog (frmP);
  FrmDeleteForm (frmP);
  handled = true;
  }
  
  if (ctrlID == MainClearButton)
  {
  EventType theEvent;
  
  
  theEvent.eType = keyDownEvent;
  theEvent.data.keyDown.chr = 
  backlightChr ;
  theEvent.data.keyDown.keyCode = 0;
  theEvent.data.keyDown.modifiers 
  = commandKeyMask;
  
  EvtAddEventToQueue(theEvent);
  handled = true;
  }
  
  
  case menuEvent:
  return 
  MainFormDoCommand(eventP-data.menu.itemID);
  
  case frmOpenEvent:
  frmP = FrmGetActiveForm();
  MainFormInit( frmP);
  FrmDrawForm ( frmP);
  handled = true;
  break;
  
  default:
  break;
  
  }
  
  return handled;
  }
 
 -- 
 For information on using the Palm Developer Forums,
 or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/


__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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