Notifications
Clear all
[Closed] dot net control collection
Nov 03, 2014 3:50 pm
How do I collect all the controls(buttons) on a dot net form in a array ? form.controls() doesn’t produce the actual controls
1 Reply
1 Reply
Sometime I use this fn to collect all form controls.
fn getFormCtrls dnCtrl ctrls:#() =
(
-- next line will also collect actual form
if dnCtrl.Parent == undefined do append ctrls dnCtrl
for i in 0 to dnCtrl.Controls.count-1 do
(
ctrl = dnCtrl.Controls.Item[i] ; append ctrls ctrl
if ctrl.HasChildren and ((ctrl.gettype()).name) != "NumericUpDown" do (getFormCtrls ctrl ctrls:ctrls)
) ; ctrls
)
Later you can simply use other two fn’s to set “lifetime control” or to “dispose” form controls.
mapped fn setLifetimeControl control = dotnet.setLifetimeControl control #dotnet
mapped fn disposeControl control = control.dispose()