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
[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 - Any way to tell if a field has focus?

Any way to tell if a field has focus?

Discuss OrbForms Designer and PocketC Architect

Postby sgibson on Wed Jan 22, 2003 8:10 pm

I've got a modal form that I want to use for date of birth entry. It has three fields (month, day, year) and an increment button and a decrement button. I want it so that the user can either manually input the data in the fields or, by using the increment/decrement buttons, change the values on whichever field has the current focus.

The problem is I don't know if there is a way to tell of a field has focus or not. There is no .hasfocus property that I can see. And the relfocus and grabfocus methods don't really do me any good in this situation. There is a .dirty property for fields, but I don't know quite what that means.

Can anyone think of a way to programatically tell whether or not a field has focus?

-Steve

perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-Steve
sgibson
 
Posts: 24
Joined: Mon Oct 14, 2002 3:18 pm
Location: USA

Postby nyates on Thu Jan 23, 2003 1:27 pm

Steve - the easiest thing that I can think of is to create a global (at least to the form) variable named something like CurrentField and put a line in the onselect handler for each of the fields that assigns that field's name to the CurrentField variable.

Nick
nyates
 
Posts: 9
Joined: Wed May 16, 2001 5:10 pm

Postby dewey on Thu Jan 23, 2003 3:23 pm

You can also call UIForm.activefield() to get a pointer to the currently active field.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby sgibson on Thu Jan 23, 2003 6:44 pm

Nick - I initially thought of something along those lines but fields don't seem to have "onselect" handlers.

Dewey, that sounds like a promising option. However, I guess I'm a little dense when it comes to these things, I'm not sure what to do with a pointer to a field once I've got it... so far I have this:
Code: Select all
handler fooButton.onselect() {
    UIField* activefield;

    activefield = DOBForm.activefield();
    // now what ?
}

If I try something like *activefield.id the compiler complains that it isn't a struct.

Any help with understanding how to use this pointer to a field would be much appreciated!

Thanks,
Steve

perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-Steve
sgibson
 
Posts: 24
Joined: Mon Oct 14, 2002 3:18 pm
Location: USA

Postby dewey on Fri Jan 24, 2003 1:49 am

The compiler complains because the . operator has higher precedence than the * operator. To access the fields through a pointer, you should use the -> operator:
Code: Select all
handler fooButton.onselect() {
    UIField* activefield;

    activefield = DOBForm.activefield();
    if (activefield) { // it could be null
        activefield->copy();
        // or
        (*activefield).copy(); // but you won't get code completion with this syntax
    }
}
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby sgibson on Fri Jan 24, 2003 4:11 am

Cool, works like a champ. Thanks!

perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-Steve
sgibson
 
Posts: 24
Joined: Mon Oct 14, 2002 3:18 pm
Location: USA

Postby jerryse on Sat Jan 25, 2003 10:31 pm

Question?

I build a test form with 3 fields and one button.
I can not get it to work with the "first" field.
I have tried this twice with 3 fields or 6 fields.
But, it will not recognize the first field.
Code below:

Code: Select all
// mainform.oc
// Created for mainForm

handler mainForm.onopen() {
   // TODO: handle onopen event
}

handler button104.onselect() {
   //TODO: handle event
   UIField* activefield;

    activefield = mainForm.activefield();
    if (activefield) { // it could be null
        activefield->cut();
        // or
        //(*activefield).copy(); // but you won't get code completion with this syntax
    }

}


Thanks
Jerry
jerryse
 
Posts: 21
Joined: Tue Apr 30, 2002 2:32 am

Postby FrankG on Sun Jan 26, 2003 10:26 am

Jerry,

I was able to reproduce your problem. It seems odd that it's working/not working that way. So I tried creating a one menu, one item menu bar in which I pasted your code. I rebuilt and the button worked for all three fields even though I forgot to associate the menu bar with the form. Both the button and menu item worked once I did that.

Odd.....

Frank
FrankG
 
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby jerryse on Sun Jan 26, 2003 4:34 pm

FrankG

I tried your test and you are right twice!
It works and it is "odd".
Maybe Jeremy will see this and off a suggestion.

Thanks
Jerry
jerryse
 
Posts: 21
Joined: Tue Apr 30, 2002 2:32 am


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 1 guest

cron