ketxu Posted August 6, 2011 Share Posted August 6, 2011 Goodmorning all, I want to save all tile in a DCL dialog when it unload (store in a list), and when it reload, Dialog can restore all value of controls from last value, how can i do it?? Yesterday i've write hello:dialog { label="Test"; : edit_box { label = "test"; key = "kPath"; [color=red] value = "default" ;[/color] } } When the first dialog load, it will show "default" Now i goto change it to "new" And i need in the next time load, it show "new", not "default" any more I find a link below, but i don't know what/ and how i can use http://www.cadtutor.net/forum/showthread.php?54791-DCL-Image-slide-by-list-box-amp-edit-box-help!& Thanks all Quote Link to comment Share on other sites More sharing options...
pBe Posted August 6, 2011 Share Posted August 6, 2011 One way is: hello:dialog { label="Test"; : edit_box { label = "test"; key = "kPath"; [color=blue]value = "" ;[/color] } } ..... (set_tile "kPath" (if (not def) "Default" def)) ..... (action_tile "kPath" "(setq def $value)") ..... You may want to look at localising variable by LM http://lee-mac.com/localising.html and prompting with a default option by LM http://lee-mac.com/promptwithdefault.html Quote Link to comment Share on other sites More sharing options...
ketxu Posted August 6, 2011 Author Share Posted August 6, 2011 Thank you,OK, i understand assign value to one control now, but i want do it with all of control in dialog (have many other control ) or i have to do with each of them ? I started learn DCL yesterday, so .... Quote Link to comment Share on other sites More sharing options...
pBe Posted August 6, 2011 Share Posted August 6, 2011 Thank you,OK, i understand assign value to one control now, but i want do it with all of control in dialog (have many other control ) or i have to do with each of them ? for multiple action_tile/set_tile it would be easier to name your variable the same as the key name. which means gloabal variables (setq KeyValueList (list "Key1" "key2" "key3")) Set_tile: (foreach Key KeyValueList (set_tile key (eval (read key)))) Action_tile: (foreach Key KeyValueList (action_tile Key (vl-prin1-to-string (quote (setq key $key))) ) or you could add an additional character at the end of the keyname (foreach Key KeyValueList (set_tile key (eval (read (strcat key "_X"))))) (foreach Key KeyValueList (action_tile Key (vl-prin1-to-string (quote (set (setq tmp (read (strcat $key "_X"))) $key))) ) ) Which gives you variable "key1_x" for key "Key1" Hope this helps Quote Link to comment Share on other sites More sharing options...
ketxu Posted August 6, 2011 Author Share Posted August 6, 2011 Thanks for ur reply, i'll try it ^^ Quote Link to comment Share on other sites More sharing options...
JohnM Posted August 6, 2011 Share Posted August 6, 2011 You might want to write the dialog input to a file then retrieve it when the dialog opens. This will give you more options later as you write bigger more complicated projects. Once you get comfortable with it you can have programs that allows the user to save different settings and then load those settings. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.