Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to disable tab key
Message
From
07/08/1998 07:14:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00124536
Message ID:
00124716
Views:
17
>>>>>is it possible to disable tab key, or other keys for that matter?
>>>>
>>>>Timothy,
>>>>
>>>>In a form class set the KeyPreview property to .T. and put this in the KeyPress;
>>>>
>>>>
>>>>IF nKeyCode = 9
>>>>   NODEFAULT
>>>>ENDIF
>>>well what I am getting at is that when a textbox receives the focus, the users should onlt be allowed to hit enter or click on QUIT. There are other controls but if user clicks on them, trouble occurs. I'd hate to issue disables all over the place then enabled them afterwards, alot of code.
>>Tim,
>>Setall("En/Disabled"...) might be more handy. And for a quick disable of clicks you could temporarily place a transparent shape over the form as a click shield.
>
>Cetin, question: can you give an example code using setall? Also I never heard of the transparant thing. It is a fake mask?

Enable/disable all :
* A button click or your textbox gotfocus
thisform.setall("Enabled",.f.)  && Disable all
this.enabled = .t.              && Except this

* If used textbox gotfocus in valid enable all
* Would fire when Enter pressed
thisform.setall("Enabled",.t.)  && Enable all
A click shield trick :
(User could only use keyboard - unless shape passes clicks in code)
* Make the shield
thisform.addobject("ClickShield","Shape")
with thisform.ClickShield
   .left = .parent.left
   .top = .parent.top
   .height = .parent.height
   .width = .parent.width
   .borderstyle = 0 && Transparent border
   .backstyle = 0   && Transparent
   .visible = .t.   && Not visible in fact but to put into work
endwith
* All mouse events would be intercepted by shape
* If desired it could be made into a class
* and add code to dblclick, click etc mouse events
* to be filtered and passed to only desired controls
* here another simple trick to get underlying control

* this.zorder(1)   && Put the shield at back of other control
* thisform.scalemode = 3 && Pixels
* oObjectAtCurrentpos = sys(1270,;
*                           nXcoord + this.left, ;
*                           nYcoord + this.top)
* this.zorder(0)   && Put in front
* Here do whatever with control ie: oObjectAtCurrentpos.click

* Remove the shield
thisform.removeobject("ClickShield")
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform