Jump to content

Set getstring variable using a DCL input box?


Recommended Posts

Posted

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

Posted

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.

Posted

Hi there I searched edit_box

 

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

Posted

Really? I never noticed that.

 

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

Posted

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.

Posted

Nice... I can' set a limit with

 

edit_limit = (number);

 

withouth "()"

Posted

I tried it with

 

edit_limit = 512;

 

and it works fine :)

Posted

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?

Posted

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

Posted

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.

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