Author Topic: Graphicbutton name problem  (Read 799 times)

pascal_dedi

  • Member
  • *
  • Posts: 10
Graphicbutton name problem
« on: December 19, 2013, 08:15:13 AM »
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
)
« Last Edit: December 19, 2013, 08:16:51 AM by pascal_dedi »

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 2563
    • Outside The Box
Re: Graphicbutton name problem
« Reply #1 on: December 19, 2013, 08:51:29 AM »
You can use the string form of specifying a control:
  1. (setq lza_gbn "GraphicButton12")
  2. (dcl_Control_SetPicture "Layer_Manager" "Form1" lza_gbn 107)

pascal_dedi

  • Member
  • *
  • Posts: 10
Re: Graphicbutton name problem
« Reply #2 on: December 19, 2013, 09:12:43 AM »
thank you so much Owen.

i like Open DCL.

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 2563
    • Outside The Box
Re: Graphicbutton name problem
« Reply #3 on: December 19, 2013, 10:07:04 AM »
FWIW, your code can be much simpler with (foreach):

  1. (defun c:layer_zustand_akt (/ lza_LayerList lza_Eleman)
  2.   (setq lza_LayerList
  3.     '(
  4.       ("Layer1" "GraphicButton12")
  5.       ("Layer2" "GraphicButton13")
  6.       ("Layer3" "GraphicButton14")
  7.      )
  8.   )
  9.   (foreach lza_Eleman lza_LayerList
  10.     (dcl_Control_SetPicture
  11.       "Layer_Manager" "Form1" (cadr lza_Eleman)
  12.       (if (< (cdr (assoc 62 (tblsearch "layer" (car lza_Eleman)))) 0) 107 106)
  13.     )
  14.   )
  15. )
  16.  

pascal_dedi

  • Member
  • *
  • Posts: 10
Re: Graphicbutton name problem
« Reply #4 on: December 20, 2013, 02:10:19 AM »
Hi Owen
thank you for Support, very simply and nice. i will so writen always , thank you