Obtain the list controls into form

Started by Emiliano, February 25, 2015, 08:33:12 PM

Previous topic - Next topic

Emiliano

I need to make a loop on all the controls within a form.
For each control I would like to determine its name and according to this effect some operations such as. disable it.

I found the "dcl-Form-GetControls", but I have noticed that returns a list of entities.
(entget) returns nil on these entities.

Does anyone have some sample code to disable all the controls on a form except one?
Or any suggestions?

Thanks in advance.

owenwengerd

The returned list are not entity handles, but control handles. You can pass these control handles as arguments to any OpenDCL functions that expect control handle arguments.

marcoheuer

hello emiliano,
Code (autolisp) Select
(foreach x (dcl_Form_GetControls "dialogName" "formName") (dcl_Control_SetVisible x T))

best regards
marco
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

Emiliano

Thanks to your suggestions, I wrote this:

Code (autolisp) Select

(foreach x (dcl-Form-GetControls FormName) (princ (strcat "\n" (dcl-Control-GetName x))))


and now I can do what I need;-)

Thank You

Emiliano

mmmmmmmmmmmmm

other problem  :'(

How can I check if a control is located in a given TabStrip, or directly in ControlBar?

owenwengerd

One way is to use a naming convention that you can use to identify the associated tab. For example, you could use a special prefix for controls on the main form, then identify those controls at runtime by testing for the prefix.

Emiliano

This is a good idea, but I hope not having to edit code.

Thanks for the suggestion.