Link to home
Start Free TrialLog in
Avatar of efratk
efratk

asked on

Lock the Mask Edit Box control

hi,

how can i lock the Mask Edit Box control from the user to type into it.

the 'Lock' property is absence. and the 'Enabled' property doesnt serve my needs, because the tooltiptext is not dis[layed when the control is disabled.

thanx in advance
efratk
Avatar of Dalin
Dalin

In the Gotfocus event, add a code to send the focus to another control, such as:

command1.setfocus

or Text1.setfocus
Avatar of Éric Moreau
Sending the focus to another control is not like the Lock property.

You can trap the Keypress event and return KeyAscii = 0 to cancel any character entered.
Avatar of efratk

ASKER

sorry dalin, your answer hasnt satisfied me,

emoreau! your answer solved my problem thank u.
emoreau, please answer to my question that i could give u the points.

thanx to u all
efratk

ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of efratk

ASKER

thanx u all.
Avatar of efratk

ASKER

thanx u all.
Actually, Set the focus away is more like Lock it.

set the KeyASCII to 0 only prevent from keyboard entry, but user can use the mouse and copy/paste content to the control.
When a control (like the TextBox) is locked, you can use it a source for copy-and-paste operation. If you set the focus away, you loose this behavior.

I agree that keypress won't stop a paste operation. In addition (or instead) of trapping the keypress event, you can trap the change event (by keeping the original value in the getfocus event and reapplying it in the change event).
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.

This is the Community Support link, if help is needed, along with the link to All Topics since many new ones were recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thanks,
Moondancer
Moderator @ Experts Exchange