Now THAT is easy.  Here, use this function.

ControlPtr buttonP;
CharPtr labelP;
// Get the object pointer...see the Palm OS Companion or Knowledge Base
// it's a really simple function, and store the object pointer of the 
// button in buttonP
labelP = CtlGetLabel(buttonP);

Voila!  labelP is a null-terminated string with the label of the control
(button or otherwise).

Then deal with the string however you please (you may want to do a 
conversion of some sort if you need to do an arithmetic operation.)

-Rus

>-----Original Message-----
>From: Patrick Ouellet [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, July 12, 2000 12:30 PM
>To: Palm Developer Forum
>Subject: Re: Newbie to Palm question about using variable
>
>
>Since everyone is talking about my syntax
>and not about what I want to know
>
>I'll change my question a little bit...
>
>How would you do this...
>
>I want to insert into a string the caption of the button that has been
>pressed
>now insert code in this...
>
>static Boolean MainFormHandleEvent(EventPtr eventP)
>{
>
>    Boolean handled = false;
>    FormPtr frmP;
>
> switch (eventP->eType)
> {
>  case ctlSelectEvent:
>  {
>   switch(eventP->data.ctlEnter.controlID)
>   {
>    case MainBtnStarButton:
>    break;
>
>    case MainBtnToeButton:
>     break;
>
>    case MainBtn0Button:
>     break;
>
>    case MainBtn1Button:
>     break;
>
>    case MainBtn2Button:
>     break;
>
>    case MainBtn3Button:
>     break;
>   }
>
>   handled = true;
>   break;
>  }
>
>  case menuEvent:
>   return MainFormDoCommand(eventP->data.menu.itemID);
>
>  case frmOpenEvent:
>   frmP = FrmGetActiveForm();
>   MainFormInit( frmP);
>   FrmDrawForm ( frmP);
>   handled = true;
>   break;
>
>  default:
>   break;
>
>  }
> return handled;
>}
>
>Where MainBtn""Button are numpad like button
>Star is *
>and Toe is for the # button
>
>
>--
>Patrick Ouellet, Programmeur/Analyste
>D�partement: Recherche & D�veloppement
>Les Entreprises Microtec Inc.
>4780 rue St-F�lix, St-Augustin, Qc, G3A-2J9
>(418) 864-7644 poste 130
>[EMAIL PROTECTED]
>http://www.microtecsecurite.com/
>
>
>
>-- 
>For information on using the Palm Developer Forums, or to 
>unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
>

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

Reply via email to