I am trying to develop a script to make A5 operable by use of the keyboard to a larger extent, but don't want records to be modeless as this will create all kinds of problems for our operation. Use of the mouse slows down data entry considerably. (Also with the recent OSHA regulation on ergonomics, I think a lot of corporations will be looking for ways to get away from the mouse)
My idea is to open a form with allow_change set to F and as long as it is set to false trap the keystrokes and use them for enrty control. (pretty much like in A4)If the user selects "E" or "C" then allow_change will be set to T and the onkey events will no longer be valid. Below is what I have tried and it doesn't do anything except not allow changes. What am I doing wrong on the onkey part. I have this attached to the onactivate event of the form. I hope to make this a global function so I can use it with any form. I will use a dummy menu with choices but the choices will really be processed by the onkey event, the menu on screen is just a guide. In writing this I'm also thinking maybe this is the wrong way to go about this and maybe it can be done with a toolbar but it has to be global so it works with any form. Has anyone done something like this? Does anyone know if this capability is in V5 by default? I have heard that V5 will be modal.
thanks
Russ
mode=this.mode_get()
this.allow_change(.F.)
if mode="0"
select
case ut(a_user.key.value)="C"
this.allow_change(.T.)
case ut(a_user.key.value)="E"
this.allow_change(.T.)
this.new_record()
end select
end if
if mode="1".or.mode="2"
select
case a_user.key.value={F10}
this.commit()
end select
end if
end
My idea is to open a form with allow_change set to F and as long as it is set to false trap the keystrokes and use them for enrty control. (pretty much like in A4)If the user selects "E" or "C" then allow_change will be set to T and the onkey events will no longer be valid. Below is what I have tried and it doesn't do anything except not allow changes. What am I doing wrong on the onkey part. I have this attached to the onactivate event of the form. I hope to make this a global function so I can use it with any form. I will use a dummy menu with choices but the choices will really be processed by the onkey event, the menu on screen is just a guide. In writing this I'm also thinking maybe this is the wrong way to go about this and maybe it can be done with a toolbar but it has to be global so it works with any form. Has anyone done something like this? Does anyone know if this capability is in V5 by default? I have heard that V5 will be modal.
thanks
Russ
mode=this.mode_get()
this.allow_change(.F.)
if mode="0"
select
case ut(a_user.key.value)="C"
this.allow_change(.T.)
case ut(a_user.key.value)="E"
this.allow_change(.T.)
this.new_record()
end select
end if
if mode="1".or.mode="2"
select
case a_user.key.value={F10}
this.commit()
end select
end if
end
Comment