Author Topic: foreach control in a list of controls - what's wrong  (Read 3966 times)

0 Members and 1 Guest are viewing this topic.

mkweaver

  • Bull Frog
  • Posts: 352
foreach control in a list of controls - what's wrong
« 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?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: foreach control in a list of controls - what's wrong
« Reply #1 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)
  )
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

DanW

  • Mosquito
  • Posts: 18
Re: foreach control in a list of controls - what's wrong
« Reply #2 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