TheSwamp

Code Red => Visual DCL Programming => AutoLISP (Vanilla / Visual) => OpenDCL => Topic started by: mkweaver on December 08, 2011, 06:58:37 PM

Title: foreach control in a list of controls - what's wrong
Post by: mkweaver on December 08, 2011, 06:58:37 PM
This works:
Code: [Select]
(dcl_Control_SetVisible CommandList_cmdl_main_cbFilter nil)
 
But this doesn't?
Code: [Select]
(foreach ctl '(CommandList_cmdl_main_cbFilter
CommandList_cmdl_main_lblFilter
CommandList_cmdl_main_cbRecent
CommandList_cmdl_main_lblRecent
)
    (dcl_Control_SetVisible ctl nil)
  )

What is wrong with the foreach?
Title: Re: foreach control in a list of controls - what's wrong
Post by: MP on December 08, 2011, 07:02:26 PM
Just a guess, but try:

Code: [Select]
(foreach ctl '(CommandList_cmdl_main_cbFilter
CommandList_cmdl_main_lblFilter
CommandList_cmdl_main_cbRecent
CommandList_cmdl_main_lblRecent
)
    (dcl_Control_SetVisible (eval ctl) nil)
  )
Title: Re: foreach control in a list of controls - what's wrong
Post by: DanW on December 13, 2011, 05:44:12 AM
You can't explicitly quote a list of ODCL control names. Use "list" instead.

Code: [Select]
(foreach ctl (list CommandList_cmdl_main_cbFilter
CommandList_cmdl_main_lblFilter
CommandList_cmdl_main_cbRecent
CommandList_cmdl_main_lblRecent
)
    (dcl_Control_SetVisible ctl nil)
  )

Kind Regards