(set_tile "edit1" "Enter Layer Name")
(set_tile "edit2" "Layer Color")
(set_tile "edit3" "Distance of Grids")
(set_tile "edit5" "Text Size")
(set_tile "edit6" "Cross Size")
(action_tile "edit1" "(setq layy $value)")
(action_tile "edit2" "(setq coll $value)")
(action_tile "edit3" "(setq elv $value)")
(action_tile "edit5" "(setq txtsze $value)")
(action_tile "edit6" "(setq ticsze $value)")
when i run the program for the first time i will put the "layer name" "Layer Color" all the parameters i will enter what i want when i have eneterd the parameters once and i run the program they sould appear in the DCL box and i change only the one i need.
Thanks
kulfi,
long time I do not use DCL, but maybe something like this
(or layy (setq layy "Enter Layer Name")) (or coll (setq coll "Layer Color")) (set_tile "edit1" layy) (set_tile "edit2" coll) (action_tile "edit1" "(setq layy $value)") (action_tile "edit2" "(setq coll $value)")
hope that helps
Henrique
@Anonymous wrote:
when i run the program for the first time i will put the "layer name" "Layer Color" all the parameters i will enter what i want when i have eneterd the parameters once and i run the program they sould appear in the DCL box and i change only the one i need.
Thanks
another
(setq InitVal '(("layy" "Enter Layer Name") ("coll" "Layer Color") ("elv" "Distance of Grids") ("txtsze" "Text Size") ("ticsze" "Cross Size"))) (foreach Var InitVal (if (setq dflt (eval (read (car var)))) dflt (set (read (car var)) (cadr var)) ) )
;;;; after DCL_load ;;;; (set_tile "edit1" layy) (set_tile "edit2" coll) (set_tile "edit3" elv) (set_tile "edit5" txtsze) (set_tile "edit6" ticsze) (action_tile "edit1" "(setq layy $value)") (action_tile "edit2" "(setq coll $value)") (action_tile "edit3" "(setq elv $value)") (action_tile "edit5" "(setq txtsze $value)") (action_tile "edit6" "(setq ticsze $value)")
HTH
Below is how i have arrange in my Program but when i run the program second time all the boxes are empty
this is not what i need
i need whatever the values i enterd the first time they should appear in the boxes.
thanks
(if (not (new_dialog "laygrid" dcl_id))(exit))
(setq InitVal '(("layy" "Enter Layer Name") ("coll" "Layer Color") ("elv" "Distance of Grids") ("txtsze" "Text Size") ("ticsze" "Cross Size")))
(foreach Var InitVal (if (setq dflt (eval (read (car var)))) dflt (set (read (car var)) (cadr var))))
(start_dialog) ;;;; after DCL_load ;;;;
(set_tile "edit1" layy)
(set_tile "edit2" coll)
(set_tile "edit3" elv)
(set_tile "edit5" txtsze)
(set_tile "edit6" ticsze)
(action_tile "edit1" "(setq layy $value)")
(action_tile "edit2" "(setq coll $value)")
(action_tile "edit3" "(setq elv $value)")
(action_tile "edit5" "(setq txtsze $value)")
(action_tile "edit6" "(setq ticsze $value)")
(unload_dialog dcl_id)
@Anonymous wrote:Below is how i have arrange in my Program but when i run the program second time all the boxes are empty
this is not what i need
i need whatever the values i enterd the first time they should appear in the boxes.
thanks
(if (not (new_dialog "laygrid" dcl_id))(exit))
(setq InitVal '(("layy" "Enter Layer Name") ("coll" "Layer Color") ("elv" "Distance of Grids") ("txtsze" "Text Size") ("ticsze" "Cross Size")))
(foreach Var InitVal (if (setq dflt (eval (read (car var)))) dflt (set (read (car var)) (cadr var))))
(start_dialog) ;;;; after DCL_load ;;;;
(set_tile "edit1" layy)
(set_tile "edit2" coll)
(set_tile "edit3" elv)
(set_tile "edit5" txtsze)
(set_tile "edit6" ticsze)
(action_tile "edit1" "(setq layy $value)")
(action_tile "edit2" "(setq coll $value)")
(action_tile "edit3" "(setq elv $value)")
(action_tile "edit5" "(setq txtsze $value)")
(action_tile "edit6" "(setq ticsze $value)")
(unload_dialog dcl_id)
This lines should run before DCL loading
(setq InitVal '(("layy" "Enter Layer Name") ("coll" "Layer Color") ("elv" "Distance of Grids") ("txtsze" "Text Size") ("ticsze" "Cross Size")))
(foreach Var InitVal (if (setq dflt (eval (read (car var)))) dflt (set (read (car var)) (cadr var))))
(if (not (new_dialog "laygrid" dcl_id))(exit))
(set_tile "edit1" layy)
(set_tile "edit2" coll)
(set_tile "edit3" elv)
......
and you probably declared variables layy/coll/elv/txtsze/ticsize as local, should be global
(Defun c:commandname (/ variables above should not be here)
....
)
@hmsilva wrote:pbejse,
just one question, my method would work if define these variables as global variables?
Cheers
Henrique
Of course It will work Henrique, i just suggested an alternative kind sir. 🙂
<quote from my first post >
another
(setq InitVal '(("layy" "Enter Layer Name").....
Cheers Henrique
@Anonymous wrote:(set_tile "edit1" "Enter Layer Name")
(set_tile "edit2" "Layer Color")
(set_tile "edit3" "Distance of Grids")
(set_tile "edit5" "Text Size")
(set_tile "edit6" "Cross Size")
(action_tile "edit1" "(setq layy $value)")
(action_tile "edit2" "(setq coll $value)")
(action_tile "edit3" "(setq elv $value)")
(action_tile "edit5" "(setq txtsze $value)")
(action_tile "edit6" "(setq ticsze $value)")
when i run the program for the first time i will put the "layer name" "Layer Color" all the parameters i will enter what i want when i have eneterd the parameters once and i run the program they sould appear in the DCL box and i change only the one i need.
Thanks
Still yet is another method that should be more easy to understand (and structurally more correct):
;Declare a function [USERSETUP is the gremlin here]:
(defun USERSETUP_GET ()
(setq USERSETUP (list
(get_tile "edit1")
(get_tile "edit2")
(get_tile "edit3") ;etc.
))
);defun
;Initialize your settings:
(if (not USERSETUP)
(setq USERSETUP (list
"Name"
"Color"
"Grid" ;etc.
))
);if
;<--load the dcl here-->
(set_tile "edit1" (nth 0 USERSETUP))
(set_tile "edit2" (nth 1 USERSETUP))
(set_tile "edit3" (nth 2 USERSETUP))
(action_tile "accept" "(USERSETUP_GET)(done_dialog 1)")
(setq sd (start_dialog))
;<-- unload here-->
;To process your values [done_dialog returns a value to start_dialog]:
(if (and sd (= sd 1))
[your main program here]
);if
(setq sd nil)
Hope this helps.
Do a keyword search of my handle and you will find other DCL examples I have provided that are very similar with this type of structure.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
@scot-65 wrote:Still yet is another method that should be more easy to understand (and structurally more correct):
Ouch !! 😄
For kulfi,
The snippet below will convert the variable values back into a string , get_tile function return values is a "string" now depending on the main program where you do the conversion from string to a valid value [elv/coll/txtsize/ticsize] and you ended up with a none string value.
(foreach Var '(("layy" "Enter Layer Name") ("coll" "Layer Color") ("elv" "Distance of Grids") ("txtsze" "Text Size") ("ticsze" "Cross Size")) (set_tile (car var) (set (read (car var)) (if (setq dflt (eval (read (car var)))) (cond ((eq (setq ty (type dflt)) 'STR) dflt) ((eq ty 'REAL) (rtos dflt 2 2)) ((eq ty 'INT) (itoa dflt))) (cadr var))) ) )
Now this would be inside load/unload dialog
HTH
There was a start dialog declaration in one of the responses that was in the wrong place.
...that's why the comment.
🙂
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
@Anonymous wrote:
Hi, thanks to every one helping me but the problem here when I enter all the values first time and come back the second time , all the dcl boxes are empty even I declare all the variables globally because I am using these variables in rest of the program. Thanks
kulfi, you may have a better chance of understanding the code posted by scot-65,
The last code i posted combines assigning the default and passing the value to set_tile all at one go. only thing you need to change are the tile key names on your DCL and lisp code
"edit1 to "layy"
"edit2" to "coll"
"edit3" to "elv"
"edit5" to "txtsze"
"edit6" to "ticsze"
Otherwise . post you code here to give us a beter picture on why its not working for you