Can I locked a input widget instead of disable it??

NickA

Member
Not sure what you're trying to do

You mean, won't receive focus, but not greyed out or anything? There's no attribute for that AFAIK, so it'd have to be code.

How about...
Code:
ON ENTRY ... RETURN-NO-APPLY

What are you trying to do?
 
Do you know VB? VB's object has an attribute locked, but set to true, the input box can't be updated. But it remains enabled and can receive focus. That's why I want to do.
 

NickA

Member
So, what we're looking for is a fill in that will receive focus, but not respond to any attempts to change the contents? I'm assuming there's a good reason why you're not just setting the widget to 'View as text' or something.

Try trapping the ANY-KEY event. You want to stop all printable input, plus key functions like 'DELETE' etc. but not things like 'TAB'.

See if you can build this into something re-usable like...
Code:
{lkfill.i &LOCK="FILL-IN-1,FILL-IN-2"}

/* lkfill.i */

ON ANY-KEY OF {&LOCK}:
  ..
  IF KEYFUNCTION(LASTKEY) ....
  ..
  RETURN NO-APPLY.
  ..
END.
HTH
 

jennil

New Member
Try setting READ-ONLY attribute

You could set the attribute for that field by doing this..

=====================
def var v-1 as char.
def var v-2 as char.

form
v-1
v-2
with frame f1.

enable all with frame f1.
v-2:read-only = true.


wait-for window-close of this-procedure.
=======================
In this example, v-1 and v-2 are enabled and recieve focus, but no input can be recieved by v-2.

Hope this helps!
Jenni
 

NickA

Member
V9 specific

Ah, I see... one of those new fangled V9 things.

On V8 (Which is still my main development environment) you can only apply that to browses, columns, menu items and editors.

So, as long as Kenneth is on V9, he should be OK using that. If he's on V8.. he'll have to do it the way I suggested.
 
Top