Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

Article Preview


Buy Now

Print:
PDF:

Beginner's Corner

Dynamic Controls

Mastering Arrays of Controls

Issue: 5.1 (September/October 2006)
Author: Marc Zeedar editor-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 13,713
Starting Page Number: 36
RBD Number: 5114
Resource File(s):

Download Icon 5114.sit Updated: Friday, September 29, 2006 at 11:33 AM
Download Icon 5114.zip Updated: Friday, September 29, 2006 at 11:33 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

The other day I created an application with a dynamic interface. It was an XML-editing app and I wanted certain XML tags to be available on a floating palette, but I didn't want to hard-code those tags into the application. Instead, I wanted the app to read the current list of available tags from a text file and configure the tool palette automatically -- that way new tags could be added without recompiling the application. But how to do that?

One way is to create a palette with the maximum number of buttons on it. Then when I read in my configuration file, I programmatically set up each button with the appropriate tag and delete the extra buttons and shrink the window to the smaller size.

But what if I don't want a maximum limit? If I set the number absurdly high -- say a thousand -- I'd be creating buttons all night!

What would be ideal is if I could create just a single prototype button and then programmatically duplicate it as many times as I needed.

Well it just so happens that REALbasic includes a feature that does exactly that. That feature is a control array. A control array is just an array of controls. Each control in the array has the same name but a unique array index.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com