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 - FsetText and Form lifecycle

FsetText and Form lifecycle

A PocketC native palm library offering native forms and assorted utilities

Postby Manoj on Mon Sep 22, 2003 2:57 pm

Hi,

I want to change the text of the lables on my form and I cannot seem to do that. I used FsetText but that did not work. My code looks like this:

main() {
//Create Form1
//populate Form1 with widgets (Buttons, Labels etc)

//Create Form2
//populate Form2 with widgets (Buttons, Lables etc)

//Show Form1
Fctl(DRAW, Form1);

//start event loop
while(1) {
...
...
case SHOWFORM2:
//populate Labels in Form2
//show Form2
Fctl(DRAW, FORM2);
break;
...
...
}
}

In "populate Labels in Form2", I get data from DB and then use that to set the Label values as follows:
{
pointer p;
p = Array(...);
...
DBgetrec(...);
alert(p[0]);
FsetText(LABEL0, p[0]);
alert(p[1]);
FsetText(LABEL1, p[1]);
alert(p[2]);
FsetText(LABEL2, p[2]);
...
...
}

The alert() confirms that data is correctly been retrieved from DB. Only that FsetText does not seem to work.

When run, the Form2 displays with the original values that were assigned when creating the labels with Label() method.

I have got around this problem, but I do not like the solution. To get round the problem, I do not instantiate Form2 in main() immediately after Form1. I instantiate Form2 in event loop. When the event occurs, I get info from DB, instantiate Form2, populate it with widgets and assign text obtained from DB as default text.

This works OK, but then forces me to keep tracks of all active forms and then destroy them. I like the simplicity of creating all forms beforehand and then reassigning different values to widgets at runtime.

By the way, you already know that these are dynamic forms. PToolBox v7.6.1.

Any suggestions?
Manoj
 
Posts: 16
Joined: Mon Sep 15, 2003 2:08 pm
Location: United Kingdom

Postby jstadolnik on Mon Sep 22, 2003 3:19 pm

It seems that you might be trying to set the label values on a form which is not the "current" form. (i.e. FORM1 may be the active form when you are trying to update the labels on FORM2).

Try the following:

oldform=Fctl(SETFORM,FORM2);
//populate form2 labels here
Fctl(SETFORM,oldform);

Another possibility is the the FsetText may be setting the text correctly, but that it may not be refreshing the display. If this is the case, doing a Fctl(UPDATE) after you set the labels should remedy the problem.

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

Postby Manoj on Mon Sep 22, 2003 4:16 pm

Hi Joe,

I tried Fctl(UPDATE). That did not work.

I have tried to stay away from SETACTIVE and SETFORM as these are 'power' commands. I am a newbie so I do not think I need this powerful stuff. However, this does brings up another point:

Three Questions.

Q1. What is the difference between ACTIVE form, CURRENT form and Visible Form. I thought all three were the same.

Q2. When does a form change state from active to/from current to/from Visible.

Q3. And, finally, under what circumstances would you normally use SETACTIVE and SETFORM.
Manoj
 
Posts: 16
Joined: Mon Sep 15, 2003 2:08 pm
Location: United Kingdom

Postby jstadolnik on Mon Sep 22, 2003 4:59 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
Q1. What is the difference between ACTIVE form, CURRENT form and Visible Form. I thought all three were the same.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

The active form is the form which responds to events.

The current form is the form upon which the form functions (FsetState, FgetText, etc) operate on.

Unless you use the SETACTIVE or SETFORM Fctl commands to change things, the current and active forms are one in the same.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
Q2. When does a form change state from active to/from current to/from Visible.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

When you create a new form (Form or Dialog) or load a form (via Fctl LOAD), that form becomes the "current" form.

When you use the Fctl DRAW command, the form specified becomes the "current" and "active" form. If you do a Fctl FREE, the previous active form becomes the new current and active form.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
Q3. And, finally, under what circumstances would you normally use SETACTIVE and SETFORM.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

SETFORM should be used when you want to modify or query another form which is not the active form. Just be sure to set the current form back to the active one when done with your form modifications.

SETACTIVE can be used to disable the current form entirely. For example, suppose you want to use a Ccontrols style menu on a PToolbox form (since dynamic menus are not supported). When the menu event is trapped, you can use SETACTIVE to deactive the current form (e.g. by switching to an empty form). This way pen taps don't trigger any form objects. Then you pop your Ccontrols menus. When done, use SETACTIVE to return to the previous active form.

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

Postby Manoj on Mon Sep 22, 2003 7:47 pm

Well worth its weight in gold.
Thanks Joe,
Manoj
 
Posts: 16
Joined: Mon Sep 15, 2003 2:08 pm
Location: United Kingdom

Postby Manoj on Mon Sep 22, 2003 7:50 pm

Well worth its weight in gold.
Thanks Joe,
Manoj
 
Posts: 16
Joined: Mon Sep 15, 2003 2:08 pm
Location: United Kingdom


Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 2 guests

cron