On Feb 9, 2007, at 9:00 AM, Dean Davis wrote:

There are some things that can really trip you up on dynamically created and destroyed control arrays. I just started getting into them as part of a project to mimic the look and funtionality of Apple Mail's "Add Rule" dialog
sheet.

I'm still working out the details in order to submit a bug report but one of the things is that control arrays aren't really arrays at all as we think of
them.
The .index property of a control in an a "array" is writable which means you can create a control in code and set its index to 100 if you'd like even
though you only have two controls in the array.

So you can create two controls so you have control(0), control(1) and
control(2) but if you call control(1).close this doesn't reduce the array, control(3) still exists. And if you change its index, in code, from 2 to 1 then create a new control it has the possibility of becoming control (3) even though at this point you only have control(0) and control(1) on the window.

Like I said I'm still experimenting and working all the details but there
are bugs in the RBs implementation. Some of the bugs can cause hard
application crashes.

FYI, one way to work around many of these bugs is to put your control on a
new "container control" and then manage your own array in code. Less
convenient but it does work better in some cases.


The way to do what you want is to maintain your own array of controls, thus providing precise control over ordering. You will need this if you want to insert rows as in the Mail.app rule editor. You must redim any such arrays to -1 in the window's Close event handler, or you will cause a crash.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to