Jump to content

[Help] Save and load all tile in DCL ?


ketxu

Recommended Posts

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 o:)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ....

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...