Simulate Keypress Event

New to Clarion. How do I simulate a keypress event, like Tab?

Like this:

1 Like

You can use PRESSKEY(), but whether it’s the best approach really depends on what you’re trying to accomplish and where you’re trying to accomplish it.

In addition to PRESSKEY( TabKey )
you can also use


In this particular case, I’d use PRESSKEY

1 Like

I have a radio button and when it is selected I want to automatically tab over to the text box that the user need to edit. I can get it to tab over, but when it does, it won’t select the radio.

I gave up and the user can just tab over themselves. :confused:

For radio buttons, it usually works best to respond to events on their parent OPTION control.

I would use

select (?youcontrol) or POST(Event:Accepted, ?yourcontrol) insead of presskey…

RADIO gets only Event:Selected. OPTION gets only Event:Accepted. Try in the OPTION’s Event:Accepted embed code like:

IF OptionVar=TheOneWithText AND ~0{PROP:AcceptAll} THEN

In a Form Template ?OK will have a SELECT(null) that will send an Event:Accepted to all controls so checking Prop:AcceptALL prevents your code running again when ?OK is pressed.

I think I recall a bug that if in a RADIO Event:Selected you do a SELECT(?SameRadio) it prevents the Accepted or Radio change. Maybe your Select(?text) in the Radio is similar. Maybe that’s intended that a SELECT in a Radio cancels the Radio change like CYCLE does in some events.

You may want to consider adding “AND KeyCode()=MouseLeft”. If the user is using the Keyboard to move down the radios with the arrows it is kind of rude to suddenly jump him to another control, unless that radio is the last one.