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
[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 - Note and FsetMany

Note and FsetMany

A PocketC native palm library offering native forms and assorted utilities

Postby tthkbw on Sun Oct 20, 2002 12:54 am

I have a large array of buttons and want to use FsetMany to quickly set them to values from an array. I do the following:

int row_data[0];
int j;

for (j=0;j<9;j++) {
row_data[j] = j;//player[column_statlist[j]];
}
FsetMany(0x4000,1,1,0,9,row_data);

The result is that the buttons have their attributes changed (the background and foreground colors change, but the text does not. If I set the values for row_data to the "real" stuff (the player data structure value), then nothing happens.

I am using PtoolBoxLib 7.4.4 and running on the emulator using a 3.5.0 ROM.

I don't see any sample code showing the use of FsetMany. Can someone help with an example??

Also, if I use Note and reference the MemoDB, is it safe to use string sizes larger than 4096? It seems to work, but I don't know if this is safe on all OS versions greater than 3.0?

thanks.


tthkbw
tthkbw
 
Posts: 75
Joined: Wed Nov 07, 2001 4:04 pm
Location: USA

Postby jstadolnik on Sun Oct 20, 2002 1:25 am

Your row_data array is of zero length. Is this correct?

For the switches you threw (step=1), you need 9 buttons with consecutive ID numbers starting with 0x4000 (i.e. 0x4000 through 0x4008). Make sure this is the case.

Below is one of my internal testcases for FsetMany/FgetMany.

The problem with using Memos larger than 4k is that the PalmDesktop tool will chop them up into 4k blocks. Other than that you can go up to 32k on editing memos and 64k if in non-edit mode.

Joe

-- ----------

//FsetMany.c
library "PToolboxLib"
include "Fctl.h"
main() {
int i;

string sstate[12] = {"1","1","1","0","0","0","0","1","1","0","1","0"};
int istate[12] = {1,2,3,4,5,6,7,8,9,10,11,12};
string sex[3] = {"male","female","-"};
pointer p,s,t;

clear();
p=Array("i,12");
s=Array("s,12");
t=Array("s,12");

Form(3000,"FsetMany/FgetMany test");

//populate form with objects
for(i=0;i<12;i++) {
Field(3001+i,0,5,1+(i*13),40,12,64,"");
Button(3020+i,2,50,i*13,0,0,"");
Button(3040+i,3,70,i*13,0,0,"-");
List(3060+i,70,i*13,40,3,3040+i);
FsetList(3060+i,0,3,sex);
}
Button(3200,0,120,140,0,0,"Next");

//draw form
Fctl(DRAW,3000);
while(Fevent(1) != 3200);

//flash in some values
FsetMany(3001,1,1,0,12,istate);
FsetMany(3020,1,1,0,12,sstate);

//get results
while(Fevent(1) != 3200);
FgetMany(3001,1,1,0,12,p);
FgetMany(3020,1,1,0,12,s);
FgetMany(3040,1,1,0,12,t);
for(i=0;i<12;i++) puts(p[i]+","+s[i]+","+t[i]+"\n");
}


The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby tthkbw on Sun Oct 20, 2002 1:30 pm

I am not using dynamic objects, but static objects compiled with pilrc. Is
there a problem with FsetMany when not used on dynamic objects? I tried your
sample code and it appears to work.

Yes, I made a typo on the size of the array.

Here is the definition of the buttons:

/* player 1 */
BUTTON "00" ID HS1_ROW1_BUTTON AT (STARTX HOMESTATY STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
LABEL "-" ID DASHFG1_LABEL AT (PREVRIGHT PREVTOP)
BUTTON "00" ID HS2_ROW1_BUTTON AT (PREVRIGHT-1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS3_ROW1_BUTTON AT (PREVRIGHT PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
LABEL "-" ID DASHFT1_LABEL AT (PREVRIGHT PREVTOP)
BUTTON "00" ID HS4_ROW1_BUTTON AT (PREVRIGHT-1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS5_ROW1_BUTTON AT (PREVRIGHT+1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS6_ROW1_BUTTON AT (PREVRIGHT+1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS7_ROW1_BUTTON AT (PREVRIGHT+1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS8_ROW1_BUTTON AT (PREVRIGHT+1 PREVTOP STAT1_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME
BUTTON "00" ID HS9_ROW1_BUTTON AT (PREVRIGHT+1 PREVTOP STAT2_BUTTON_WIDTH LINE_STEP) FONT 0 NOFRAME

given the following id declarations:

#define HS1_ROW1_BUTTON 4000
#define HS2_ROW1_BUTTON 4001
#define HS3_ROW1_BUTTON 4002
#define HS4_ROW1_BUTTON 4003
#define HS5_ROW1_BUTTON 4004
#define HS6_ROW1_BUTTON 4005
#define HS7_ROW1_BUTTON 4006
#define HS8_ROW1_BUTTON 4007
#define HS9_ROW1_BUTTON 4008


And here is the code:

int i;
pointer player;
int hbutton;
int vbutton;
int j;
int row_data[9];

for (i=0;i<5;i++) {
player = hlist[i];
hbutton = HS1_ROW1_BUTTON + i*9;
for (j=0;j<9;j++) {
row_data[j] = j;//player[column_statlist[j]];
}
//alert("row data: " + row_data[0] + row_data[1] + row_data[2]);
FsetMany(4000,1,1,0,9,row_data);
//
// FsetText(hbutton, player[column_statlist[0]]);
// FsetText(hbutton+1,player[column_statlist[1]]);
// FsetText(hbutton+2,player[column_statlist[2]]);
// FsetText(hbutton+3,player[column_statlist[3]]);
// FsetText(hbutton+4,player[column_statlist[4]]);
// FsetText(hbutton+5,player[column_statlist[5]]);
// FsetText(hbutton+6,player[column_statlist[6]]);
// FsetText(hbutton+7,player[column_statlist[7]]);
// FsetText(hbutton+8,player[column_statlist:?:]);
//
}


If I use the FsetText code that is commented out, it works perfectly. When I
use the FsetMany code instead it doesn't work.

It is interesting that I initialize the text of the buttons to "00", and if I
set the text in this code to the initial value of the player[column_stalist[0]]
array (which is zero), then nothing happens when I run the code. If, however,
I put in different values (the incremented j values), then buttons hbutton+1
and on (which have non-zero values) change. The way they change is that their
text remains "00", but they are now colored with a blue background and white
foreground text. Button hbutton, gets a value of zero, and it doesn't change
at all.

I would be more than happy to send you the entire code set so you could compile
yourself, if that is useful.

I am using PDE 4.4.1 to compile.

Thanks.


tthkbw
tthkbw
 
Posts: 75
Joined: Wed Nov 07, 2001 4:04 pm
Location: USA

Postby jstadolnik on Mon Oct 21, 2002 1:00 am

The OS treats dynamic and resource forms exactly the same once they have been created/loaded in memory.

The way FsetMany currently works for standard buttons is that it sets thier state and not thier text... which for this button type is pretty useless.

When I orginally wrote, FsetMany/FgetMany I didn't envision users would use it to change the text of standard buttons (only selectboxes and poptriggers). (I'm continously suprised at what users come up with :).)

The change to support this is minimal. You can expect to see it in the next release.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron