I wouldn't put the IDs in an array, but pointers to the buttons instead.
Otherwise you'll have to call FrmGetObjectPtr for all the buttons every
time you want to do an operation on all the buttons. Not a good idea as
you should minimize the code that's being executed inside a for loop...

Good luck,

Caspar

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt
Graham
Sent: Thursday, March 25, 2004 7:38 PM
To: Palm Developer Forum
Subject: Re: I want to put buttons in an array....

Eric Yun wrote:
> I created many buttons in a frame. Currently I use "buttonXY" to name
> for them, X and Y stands for the No. of the row and column of the
> button. For example, button24 means the button in the second row, and
> the forth column.
> 
> Right now I found such a scheme has some problems. For example, if I
> want to do an operation to all buttons, I have to call the same
> function many times. If, I think, I can put these buttons in an
> array, I will be able to use a "for" loop.
> 
> I cannot find a solution for this. It seems all buttons' IDs are type
> UInt16. I am using Codewarrior 9.2; how can I change their IDs (or
> just put them in a two-dimention array according to their positions)?

I think you answered your own question. Make an array (1D or 2D 
whichever is more appropriate for what you need to do with them) and 
just copy all the values into the array.

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

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

Reply via email to