OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Kerry on July 22, 2017, 05:52:57 PM

Title: Catching ENTER in a combobox
Post by: Kerry on July 22, 2017, 05:52:57 PM
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,
Title: Re: Catching ENTER in a combobox
Post by: roy_043 on August 04, 2017, 01:38:42 PM
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.
  )
)
Title: Re: Catching ENTER in a combobox
Post by: Kerry on August 07, 2017, 03:58:42 PM
Thanks Roy,

I can probably make that work for my situation.

I'll have a play.