Or, if you only care about the first character:

if( *Commandl == 'I' ) { do your thing };

or

if( Commandl[0] == 'I' ) {do your thing );

Remember, theres more than one way to skin an Ogre (I didn't want to get in trouble from any cat lovers ;)

spike

>From: "Richard Burmeister" <[EMAIL PROTECTED]>
>Reply-To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>Subject: RE: Getting text.
>Date: Fri, 13 Jul 2001 17:50:40 -0500
>
> > From: [EMAIL PROTECTED]
> >
> > case MainExecuteButton:
> > frmP=FrmGetActiveForm();
> > fld=( FieldPtr ) GetObjectPtr (MainCommandField);
> > Commandl=FldGetTextPtr (fld);
> > if(Commandl=="l")
> > SndPlaySystemSound(sndAlarm);
> > break;
> >
>
>Have you read a basic book on the C programming language? FldGetTextPtr
>returns a pointer. A pointer is not likely to ever be equal to "l". You
>need to use something to compare two strings. In standard C, that would be
>strcmp() or one of the related functions. When programming for a Palm OS
&! gt;device, use the Palm function StrCompare(). For example,
>
> if ( 0 == StrCompare(Command1, "l") )
> SndPlay...
>
>Now for the strictly Palm portion of this discussion:
>
>When you handle a button press, you have to tell the OS that you have done
>so. Therefore, before the break, you need to insert
> handled = true;
>or
> return true;
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/


Get your FREE download of MSN Explorer at http://explorer.msn.com

--
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