2011-06-28 12:04 UTC
I have been working with opendcl for a few weeks now, and it is fun, thanks a lot to all of you.
Now, on my first "serious" piece of code I encounter a problem I could not solve: everything works fine, with one exception: my listboxes are just empty the first time I recall the function. Closing the box and recalling the function shows them just the way I want them. I tried to move code around, but once I had the listboxes properly filled, the OK-button did not work anymore. Here is the code:
; Ensure the appropriate OpenDCL ARX file is loaded
(command "OPENDCL")
(defun c:s203 ()
; Create the lists the user will choose a value from:
(setq s203Breite '(" 624 (2 Schuppengläser)"
" 924 (3 Schuppengläser)"
"1224 (4 Schuppengläser)"
"1524 (5 Schuppengläser)"
"1824 (6 Schuppengläser)"
"2124 (7 Schuppengläser)"
"2424 (8 Schuppengläser)"
"2724 (9 Schuppengläser)"
"3024 (10 Schuppengläser)"
"3324 (11 Schuppengläser)"
"3724 (12 Schuppengläser)")
s203Achsen '("0" "1" "2" "3")
s203Glastyp '("VSG/ESG"
"Heat Mirror"
"ESG/ESG (nur CH!)")
)
; call the method to load the s203.odcl file.
(dcl_Project_Load "s203" T)
; call the method to show the s:203 dialog box
(dcl_Form_Show s203_Form1)
(defun c:s203_Form1_OnInitialize (/)
(dcl_ListBox_AddList s203_Form1_RIM-H s203Breite)
(dcl_ListBox_AddList s203_Form1_AnzahlMittelAchsen s203Achsen)
(dcl_ListBox_AddList s203_Form1_GlasTyp s203Glastyp)
)
(defun c:s203_Form1_OK_Button_OnClicked (/)
(setq Val_RIM-B (atof (dcl_Control_GetText s203_Form1_RIM-B)))
(setq Val_RIM-H (dcl_ListBox_GetSelectedItems s203_Form1_RIM-H))
(setq Val_AnzahlMittelAchsen (dcl_ListBox_GetSelectedItems s203_Form1_AnzahlMittelAchsen))
(setq Val_GlasTyp (dcl_ListBox_GetSelectedItems s203_Form1_GlasTyp))
(if (or
(< Val_RIM-B 400.)
(> Val_RIM-B 5200.)
(= Val_RIM-H NIL)
(= Val_AnzahlMittelAchsen NIL)
(= Val_GlasTyp NIL))
(dcl_messagebox "Es muss in jedem Feld ein Wert angeklickt sein, ausserdem muss die Breite minimal 400 mm / maximal 5200 sein. Bitte korrigieren Sie Ihre Eingabe")
(dcl_Form_Close s203_Form1)
)
)
)
I'll attach both the lsp and odcl files. The error will be stupid, I assume, but since I only am a "part time programer", more at home on the engineering side of life, I just can't identify the fault.
Thanks a lot in advance,
Holger
Now, on my first "serious" piece of code I encounter a problem I could not solve: everything works fine, with one exception: my listboxes are just empty the first time I recall the function. Closing the box and recalling the function shows them just the way I want them. I tried to move code around, but once I had the listboxes properly filled, the OK-button did not work anymore. Here is the code:
; Ensure the appropriate OpenDCL ARX file is loaded
(command "OPENDCL")
(defun c:s203 ()
; Create the lists the user will choose a value from:
(setq s203Breite '(" 624 (2 Schuppengläser)"
" 924 (3 Schuppengläser)"
"1224 (4 Schuppengläser)"
"1524 (5 Schuppengläser)"
"1824 (6 Schuppengläser)"
"2124 (7 Schuppengläser)"
"2424 (8 Schuppengläser)"
"2724 (9 Schuppengläser)"
"3024 (10 Schuppengläser)"
"3324 (11 Schuppengläser)"
"3724 (12 Schuppengläser)")
s203Achsen '("0" "1" "2" "3")
s203Glastyp '("VSG/ESG"
"Heat Mirror"
"ESG/ESG (nur CH!)")
)
; call the method to load the s203.odcl file.
(dcl_Project_Load "s203" T)
; call the method to show the s:203 dialog box
(dcl_Form_Show s203_Form1)
(defun c:s203_Form1_OnInitialize (/)
(dcl_ListBox_AddList s203_Form1_RIM-H s203Breite)
(dcl_ListBox_AddList s203_Form1_AnzahlMittelAchsen s203Achsen)
(dcl_ListBox_AddList s203_Form1_GlasTyp s203Glastyp)
)
(defun c:s203_Form1_OK_Button_OnClicked (/)
(setq Val_RIM-B (atof (dcl_Control_GetText s203_Form1_RIM-B)))
(setq Val_RIM-H (dcl_ListBox_GetSelectedItems s203_Form1_RIM-H))
(setq Val_AnzahlMittelAchsen (dcl_ListBox_GetSelectedItems s203_Form1_AnzahlMittelAchsen))
(setq Val_GlasTyp (dcl_ListBox_GetSelectedItems s203_Form1_GlasTyp))
(if (or
(< Val_RIM-B 400.)
(> Val_RIM-B 5200.)
(= Val_RIM-H NIL)
(= Val_AnzahlMittelAchsen NIL)
(= Val_GlasTyp NIL))
(dcl_messagebox "Es muss in jedem Feld ein Wert angeklickt sein, ausserdem muss die Breite minimal 400 mm / maximal 5200 sein. Bitte korrigieren Sie Ihre Eingabe")
(dcl_Form_Close s203_Form1)
)
)
)
I'll attach both the lsp and odcl files. The error will be stupid, I assume, but since I only am a "part time programer", more at home on the engineering side of life, I just can't identify the fault.
Thanks a lot in advance,
Holger