Graphicbutton name problem

Started by pascal_dedi, December 19, 2013, 07:15:13 AM

Previous topic - Next topic

pascal_dedi

hi evryone
i have a Problem

if i the GB Name so take off a list does not go.

I do not want to write so "Layer_Manager_Form1_GraphicButton12" on Picture Change.


(defun c:layer_zustand_akt (/ )
(setq   lza_LayerList
    '(
      ("Layer1" "Layer_Manager_Form1_GraphicButton12")
     )
  )

(setq lza_sayi (length lza_LayerList) n 0)
(repeat lza_sayi
    (setq lza_eleman (nth n lza_Layerlist))
    (setq lza_layer (nth 0 lza_eleman))
    (setq lza_gbn (nth 1 lza_eleman))

(setq lza_sor (tblsearch "layer" lza_layer))

(setq lza_sonuc (cdr (assoc 62 sor)))
  (if (< lza_sonuc 0)
(dcl_Control_SetPicture lza_gbn  107)
(dcl_Control_SetPicture lza_gbn  106)
)

    (setq n (+ n 1))
  )               ;repeat
)

owenwengerd

You can use the string form of specifying a control:
Code (autolisp) Select
(setq lza_gbn "GraphicButton12")
(dcl_Control_SetPicture "Layer_Manager" "Form1" lza_gbn 107)

pascal_dedi

thank you so much Owen.

i like Open DCL.

owenwengerd

FWIW, your code can be much simpler with (foreach):

Code (autolisp) Select

(defun c:layer_zustand_akt (/ lza_LayerList lza_Eleman)
  (setq lza_LayerList
    '(
      ("Layer1" "GraphicButton12")
      ("Layer2" "GraphicButton13")
      ("Layer3" "GraphicButton14")
     )
  )
  (foreach lza_Eleman lza_LayerList
    (dcl_Control_SetPicture
      "Layer_Manager" "Form1" (cadr lza_Eleman)
      (if (< (cdr (assoc 62 (tblsearch "layer" (car lza_Eleman)))) 0) 107 106)
    )
  )
)

pascal_dedi

Hi Owen
thank you for Support, very simply and nice. i will so writen always , thank you