Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why does {alt+} throw away activecontrol?
Message
From
16/06/2002 00:53:01
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
15/06/2002 23:39:41
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00668976
Message ID:
00668985
Views:
25
>I have fixed this problem, but I want to know why it happens.
>
>Define myChkBox as ChkBox
>  Caption = 'Re\<fused'      && User can press {alt+f} to toggle value
&gt;  Procedure When()
&gt;    local lo
&gt;    lo = Thisform.ActiveControl
&gt;    This.Value = !This.Value
&gt;    lo.SetFocus()
&gt;    Return .F.
&gt;  EndProd
&gt;EndDefine
&gt;
>This works just fine when the user clicks on the chkBox with the mouse, but if the user uses {alt+f} to do it, error "ACTIVECONTROL IS NOT AN OBJECT" and debugger shows "" for ActiveControl.
>
>Why does the keyboard shortcut throw away the ActiveControl?

It seems like there's no activecontrol at that moment, which is not unusual. I have never managed to use form.ActiveControl without first checking whether it's an object. It is quite possible that no control on your form has the focus at any given moment, and that's when form.ActiveControl will be either null or undefined. So you better check for it.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform