Catching ENTER in a combobox

Started by Kerry, July 22, 2017, 05:52:57 PM

Previous topic - Next topic

Kerry

Salutations,

It's been a while since I've written some new OpenDCL stuff ...

Is there a built in way to catch ENTER in a ComboBox.
It seems there is no Key events associated.

I may be able to hack it by :
Setting ReturnAsTab to false.
Catch the OnCancelClose event for the form
Determine the control with the current focus ie (Setq rValue (dcl_GetFocus))

If this identifies the control I want to "handle" ENTER for, go ahead and handle it.

Of course, I'd rather use a built in Method if one exists :)

Regards,
Perfection is not optional.
My other home is TheSwamp

roy_043

This works (tested on BricsCAD):

Set ReturnAsTab to True for the control.
In the control's OnKillFocus event handler check the keystate of the Enter key:
(if (vl-position (acet-sys-keystate 13) '(-127 -128))
  (progn
    (princ "\nFocus removed by pressing Enter ")
    ; Do something.
  )
  (progn
    (princ "\nFocus removed ")
    ; Do something else.
  )
)

Kerry

Thanks Roy,

I can probably make that work for my situation.

I'll have a play.
Perfection is not optional.
My other home is TheSwamp