Create Controls on Initialise

Started by ScottBolton, March 24, 2026, 08:26:12 AM

Previous topic - Next topic

ScottBolton

Hi, chaps.
I know how to modify existing control properties via lisp, but is it possible to create NEW controls and assign events to them? Something like:

(setq Y 20)
(foreach control '("CheckBox1" "CheckBox2" "CheckBox3")
(dcl-Control-Create control (list 50 Y)) ; < create this control at a specified coordinate
(dcl-Control-SetOnClick control (runthisroutine)) ; assign an event
(setq Y (- Y 20)) ; change the Y coordinate of the next control
)

owenwengerd

I don't think there is any way to dynamically create controls. You can turn them on and off, but for dynamic layouts you'll need to either have them pre-created (for example, a form could have 100 of them at 0,0, all hidden, then you move and show them at runtime) or you can use a List or Grid control and add your dynamic controls to the grid cells.
Owen Wengerd (Outside The Box) / ManuSoft

ScottBolton

OK. Thanks for the response, Owen.