Jump to content
Brick_top

Set getstring variable using a DCL input box?

Recommended Posts

Brick_top

Hi i'm new to dcl and would like to know how can I set a getstring variable using a DCL input box.

 

I thought it would be easy but I haven't figured it out.

 

thanks

Share this post


Link to post
Share on other sites
pBe

edit_box

 

An edit box is a field that enables the user to enter or edit a single line of text. An optional label can appear to the left of the box. If the entered text is longer than the length of the edit box, the edit box scrolls horizontally.

Share this post


Link to post
Share on other sites
Brick_top

Hi there I searched edit_box

 

It seems it limits the input text to 132 characters. Anyway to avoid that?

Share this post


Link to post
Share on other sites
pBe

Really? I never noticed that.

 

Can you post your code here for us to looked at? Maybe we can suggest a different approach.

Share this post


Link to post
Share on other sites
Brick_top

I just copied a tutorial from a web page and was trying to adapt it to my code.

 

here is the dcl part

SAMPLE2 : dialog { 
         label = "Pesquisa de Projetos"; 
         : column { 
           : boxed_column { 
             : edit_box {
               key = "username";
               label = "Informação a pesquisar:";
               edit_width = 50;
               value = "";
               initial_focus = true;
             }
//              : edit_box {
//                key = "userage";
//                label = "Enter your Age:";
//                edit_width = 15;
//                value = "";
//              }
           }
           : boxed_row {
             : button {
               key = "accept";
               label = " Ok ";
               is_default = true;
             }
             : button {
               key = "cancel";
               label = " Cancel ";
               is_default = false;
               is_cancel = true;
             }
           }
         }

}

 

here is the lisp part

 

(defun saveVars()
 (setq userName(get_tile "username"))
 ;(setq userAge(atoi(get_tile "userage")))
)

(defun C:SAMPLE2()

 ;;;--- Load the dcl file
 (setq dcl_id (load_dialog "SAMPLE2.dcl"))

 ;;;--- Load the dialog definition if it is not already loaded
 (if (not (new_dialog "SAMPLE2" dcl_id))
   (progn
    (alert "The SAMPLE2.DCL file could not be loaded!")
     (exit)
   )
 )

 ;;;--- If an action event occurs, do this function
 (action_tile "accept" "(setq ddiag 2)(saveVars)(done_dialog)")
 (action_tile "cancel" "(setq ddiag 1)(done_dialog)")

 ;;;--- Display the dialog box
 (start_dialog)

 ;;;--- Unload the dialog box
 (unload_dialog dcl_id)

 ;;;--- If the user pressed the Cancel button
 (if(= ddiag 1)
   (princ "\n Sample2 cancelled!")
 )

 ;;;--- If the user pressed the Okay button
 (if(= ddiag 2)
   (progn
     (princ "\n The user pressed Okay!")
   )
 )

 ;;;--- Suppress the last echo for a clean exit
 (princ)

) 

 

I can post my code but it is very specific to a drawing file, don't know if that helps.

 

Anyway in both this code and in this example. The resulting string length is 132 characters.

Share this post


Link to post
Share on other sites
Brick_top

Nice... I can' set a limit with

 

edit_limit = (number);

 

withouth "()"

Share this post


Link to post
Share on other sites
Brick_top

I tried it with

 

edit_limit = 512;

 

and it works fine :)

Share this post


Link to post
Share on other sites
Brick_top

But now there is something that bothers me.

 

Anyway I could increase the edit box size so that all of the characters were visible while i type?

Share this post


Link to post
Share on other sites
Lee Mac

Use edit_width

Share this post


Link to post
Share on other sites
Brick_top

sorry for not being clear, but as it seems it only scrools horizontally?

 

I would like it to scrool vertically?

 

sorry if my english sounds weird.. I don't know if all the words I write exist

Share this post


Link to post
Share on other sites
Lee Mac

Not possible using a standard DCL edit_box - you can change the height, but the text will not move onto the next line. Unfortunately standard DCL doesn't offer a "text_area" tile, the closest you can get (in appearance) is a list_box, but this of course cannot accept text input.

Share this post


Link to post
Share on other sites
Brick_top

ok, thanks a lot for your info.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×