Page 1 of 1

PostPosted: Wed Apr 19, 2006 5:12 pm
by Tom Miller
In OrbForms, is there a way to define and/or reference buttons programmatically (i.e. at run time)?

I would like to populate a form with buttons based on the contents of a user-changeable database, including labeling the buttons from an array of strings from the database. Kind of like so:

button[i].text = buttonString[i];


PostPosted: Wed Apr 19, 2006 7:46 pm
by mlambrigger
In OrbForm, you can not create a button, but you can create a pointer on a button. Exemple:

UIButton* button[10]; //array of 10 pointers on buttons

button[0] = &button1052;
button[1] = &button1010; // etc...
for(i=0; i<n; i++){
button[i]->text = buttonString[i];

You must initiate the array before using it!! Really important!

Marc Lambrigger

PostPosted: Thu Apr 20, 2006 4:17 pm
by Tom Miller
Thanks Marc! I figured if there was a workaround it would involve pointers, but I had no idea how to go about it. So, thanks for the example.