dcl_ComboBox_SetCurSel with current value

Started by Peter2 · 2014-11-17 07:47 UTC · 3 replies · SMF topic #2197

I'm sure there is an existing, obvious function in OpenDCL, but at the moment I'm blind to see it ...

- I have a ComboBox with some entries: (list "Jim" "John "Sue "Anne")
- Somewhere in Lisp there is: (setq myvalue "Sue")

-> How to use "dcl_ComboBox_SetCurSel" with "Sue"?

I use "vl-position", but I'm sure there is a better way:
(dcl_ComboBox_SetCurSel haupt_cbxModus (vl-position selMode (dcl_Control_GetList haupt_cbxModus)))

Have a  fine week!
The normal pattern is to either call (dcl-ComboBox-SelectString) to select the first item with matching prefix, or else (dcl-ComboBox-FindStringExact) plus (dcl-ComboBox-SetCurSel) if you need to ensure an exact match.
author=owenwengerd link=topic=2197.msg11029#msg11029 date=1416239981 wrote:
The normal pattern is to ...

Thanks. I was sure there is a simple solution  :)
author=Peter2 link=topic=2197.msg11020#msg11020 date=1416210470 wrote:
I'm sure there is an existing, obvious function in OpenDCL, but at the moment I'm blind to see it ...

- I have a ComboBox with some entries: (list "Jim" "John "Sue "Anne")
- Somewhere in Lisp there is: (setq myvalue "Sue")

-> How to use "dcl_ComboBox_SetCurSel" with "Sue"?

I use "vl-position", but I'm sure there is a better way:
(dcl_ComboBox_SetCurSel haupt_cbxModus (vl-position selMode (dcl_Control_GetList haupt_cbxModus)))

Have a  fine week!