OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: ScottBolton on March 24, 2026, 08:26:12 AM

Title: Create Controls on Initialise
Post by: ScottBolton on March 24, 2026, 08:26:12 AM
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
)
Title: Re: Create Controls on Initialise
Post by: owenwengerd on March 24, 2026, 09:05:56 PM
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.
Title: Re: Create Controls on Initialise
Post by: ScottBolton on March 25, 2026, 02:01:49 AM
OK. Thanks for the response, Owen.