1. canFocus dosen't work
- Posted by doncole2009 Apr 20, 2009
- 790 views
canFocus dosen't work.
According to the docs,
If flag is w32True, the control id is set to have CanFocus, otherwise it is set off. The default for controls is on.
If id is a single control id, then the return value is a integer. If id is a sequence of controls, then the return value is a sequence containing one status flag per control referenced in id.
id can be either a single control id or a list of ids in a sequence.
CanFocus means that when the control gets focus, and if it's CanFocus property is off, then the focus is not set.
Test:
VOID=canFocus(EditText7,w32True)
?VOID returns 1
VOID=canFocus(EditText7,w32False)
?VOID returns 1
Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
2. Re: canFocus dosen't work
- Posted by Mike777 Apr 20, 2009
- 841 views
Don,
Why do you say it doesn't work? The first sets the CanFocus property to True. The second sets the CanFocus property to False. In both cases, the return value of the routine is a 1, no doubt indicating that it successfully did what you instructed it to do. In order to test it, you would need to issue a SetFocus command after setting the CanFocus property to True (and noting that the control received the focus) or after setting the CanFocus property to False (and noting that the control did not receive the focus).
Mike
3. Re: canFocus dosen't work
- Posted by ArthurCrump Apr 20, 2009
- 777 views
According to the documentation, the function canFocus does not return a success code, it returns the previous setting of canFocus.
Before your first call to canFocus, it was unlikely to be anything but true.
After that it would be true because of the first call, so it would be true before the second call as well.
Since canFocus returns the PREVIOUS state, it would return 1 (for true) both times.
4. Re: canFocus dosen't work
- Posted by doncole2009 Apr 20, 2009
- 769 views
- Last edited Apr 21, 2009
Ok I guess I got it backwards,
VOID=canFocus(EditText5,w32True) stops the control from excepting focus.
VOID=canFocus(EditText5,w32False) allows the control to focus.
What I don't understand is this,
I have 3 controls EditText5,EditText6,EditText7.
procedure EditText5_onKeyDown (integer self, integer event, sequence params)--params is ( atom scanCode, atom shift ) VOID=canFocus(EditText5,w32True) VOID=canFocus(EditText7,w32True) setFocus(EditText6)--dosen't focus end procedure setHandler( EditText5, w32HKeyDown, routine_id("EditText5_onKeyDown")) procedure Window1_onActivate (integer self, integer event, sequence params) setFocus(EditText5) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate"))
EditText6 never focuses.
Don Cole
A Bug is an un-documented feature.
A Feature is a documented Bug.