Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Control Arrays
Page 1 of 1

PostPosted: Sun Dec 12, 2004 9:52 pm
by Gazza
Will there be any 'control arrays' on UI Objects in a future realse of orbforms.

Cheers in advance Gaz

PostPosted: Sat Dec 18, 2004 6:15 am
by dewey
Can you explain what you mean by a "control array"?

PostPosted: Sat Dec 18, 2004 6:35 pm
by Gazza
Hi dewey,

I first come across this in VB6,

It allows you to create a control array on a UI object, e.g command button.

Once you have created the control array object, the default event is thus:

Code: Select all
Private Sub cmdOptions_Click(Index As Integer)

End Sub

PostPosted: Fri Dec 31, 2004 11:22 pm
by dewey
I have this feature request in the database and will consider it for the next major update.

Thanks for the suggestion!

PostPosted: Tue Jan 04, 2005 2:42 pm
by FrankG
Gazza,

I know you didn't ask this question but if anyone can't wait until control arrays are implemented, you can define an array of UI object pointers, initialize them to point to the actual UI objects in the form load handler (form open? I forget which) and then treat them as a control array via pointer notation.

I created a jewel game that is a 8x8 matrix of buttons whose events and (x,y) positions needed to be handled in an array fashion. Similarly emulating a [scrollable] table with text fields or buttons as row elements is possible with pointer notation (in liu of control arrays, that is.)

Regards,
Frank

PostPosted: Tue Jan 04, 2005 8:11 pm
by Gazza
Hi Frank,

Thats a fine solution. I am a novice at pointers so will not be able to implement it. I look foward to this feature in the next release of orbforms. Thanks dewey.

Could you post a little source code Frank, so I can see how this works.

Cheers Gaz

PostPosted: Wed Jan 05, 2005 12:38 pm
by FrankG
I hope this helps!
Code: Select all
....
//Declare the button pointer array
UIButton *ButG[64];  // in the GUI, I built 64 real buttons ButG0-63
....

In the form.onopen() handler, initialize the array:
Code: Select all
  ButG[00] = &ButG0;
  ButG[01] = &ButG1;
  ButG[02] = &ButG2;
  ButG[03] = &ButG3;
  ButG[04] = &ButG4;
....
  ButG[63] = &ButG63;

Each button can now be referred to through the array via pointer notation to get or set properties, as in this simple loop to arrange the buttons in a matrix on the screen. Note that OFD is savvy enought to provide the usual properties / methods pop up after you type the -> !:)
Code: Select all
  for (row=0;row<8;row++)
    for (col=0;col<8;col++) {
      indx = row*8+col;
      ButG[indx]->x = col*20;
      ButG[indx]->y = (row+1)*17;
      ButG[ri]->visible = true;
    }

Receiving button events is sort of easy. Define a handler for each button that passes the button index to your code that actually processes the event:
Code: Select all
void DoButG(int indx) {   // My code to handle event
   //alert("Hey! Button #"+indx+" was tapped.");
   ButG[indx]->bmpid = BmpXedOut;// Change button image to "x" graphic
   ButG[indx]->visible = true;   // Repaint
}
....
handler ButG0.onselect() {DoButG(0);} // Convert event to subscript
handler ButG1.onselect() {DoButG(1);}
handler ButG2.onselect() {DoButG(2);}
handler ButG3.onselect() {DoButG(3);}
handler ButG4.onselect() {DoButG(4);}
....
handler ButG63.onselect() {DoButG(63);}


Regards,
Frank

PostPosted: Thu Jan 06, 2005 8:50 pm
by Gazza
Excellent,

Cheers Frank :D

PostPosted: Fri Oct 28, 2005 3:22 pm
by Gazza
Hi Dewey,

Are Control Arrays due for the next release? With having a 64k limit on the coding side, I am having to find new ways to reduce code.

If not I can still reduce my code using Franks method, though I am looking forward to this feature in the future.

Cheers Gaz :)

PostPosted: Sat Oct 29, 2005 4:22 am
by dewey
Control arrays aren't in the next release, but the 64k limit has been removed.

PostPosted: Sat Oct 29, 2005 10:01 pm
by Gazza
Thats great news dewey :D

PostPosted: Sun Apr 16, 2006 11:40 pm
by ingluiseflorest
Hello. I am following the advice that Frank gave to Gazza. I am making a program with three arrays of fields, the problem is that, when I declare two arrays it works fine. When I try to declare the third one a message on the emulator appears and says "Addr: 140 Func:mainForm.onopen invalid global reference"
What sould I do to avoid it?
Thanks in advance.

Luis Ernesto Flores

PostPosted: Mon Apr 17, 2006 9:24 am
by FrankG
Hmmm..... I guess it's hard to tell without seeing any code but some ideas pop into mind:

- When you created the 3rd array or the code that references it, did you use some copy / paste scheme by which you forgot to change a name from the 1st or 2nd array to the 3rd array name?

- Since you cannot reference by name an object from a form that is not open, be sure not to similarly use pointer notation to point to an object on a form that isn't currently open.

HTH,
Frank