Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Recent issues

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