Graphicbutton name problem

Started by pascal_dedi · 2013-12-19 15:15 UTC · 4 replies · SMF topic #2079

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
)
You can use the string form of {2}:
(setq lza_gbn "GraphicButton12")
(dcl_Control_SetPicture "Layer_Manager" "Form1" lza_gbn 107)
thank you so much Owen.

i like Open DCL.
FWIW, your code can be much simpler with (foreach):


(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)
    )
  )
)
Hi Owen
thank you for Support, very simply and nice. i will so writen always , thank you