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

Control Arrays

Discuss OrbForms Designer and PocketC Architect

Postby Gazza on Sun Dec 12, 2004 9:52 pm

Will there be any 'control arrays' on UI Objects in a future realse of orbforms.

Cheers in advance Gaz
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby dewey on Sat Dec 18, 2004 6:15 am

Can you explain what you mean by a "control array"?
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby Gazza on Sat Dec 18, 2004 6:35 pm

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
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby dewey on Fri Dec 31, 2004 11:22 pm

I have this feature request in the database and will consider it for the next major update.

Thanks for the suggestion!
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby FrankG on Tue Jan 04, 2005 2:42 pm

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
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby Gazza on Tue Jan 04, 2005 8:11 pm

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
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby FrankG on Wed Jan 05, 2005 12:38 pm

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
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby Gazza on Thu Jan 06, 2005 8:50 pm

Excellent,

Cheers Frank :D
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby Gazza on Fri Oct 28, 2005 3:22 pm

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 :)
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby dewey on Sat Oct 29, 2005 4:22 am

Control arrays aren't in the next release, but the 64k limit has been removed.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby Gazza on Sat Oct 29, 2005 10:01 pm

Thats great news dewey :D
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby ingluiseflorest on Sun Apr 16, 2006 11:40 pm

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
Luis Ernesto Flores
ingluiseflorest
 
Posts: 6
Joined: Sun Sep 19, 2004 1:23 am
Location: Mexico

Postby FrankG on Mon Apr 17, 2006 9:24 am

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
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron