+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default Set getstring variable using a DCL input box?

    Registered forum members do not see this ad.

    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

  2. #2
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    3,022

    Default

    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.

  3. #3
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

    Hi there I searched edit_box

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

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    3,022

    Default

    Really? I never noticed that.

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

  5. #5
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

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

    here is the dcl part
    Code:
    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

    Code:
    (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.

  6. #6
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

  7. #7
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

    Nice... I can' set a limit with

    edit_limit = (number);

    withouth "()"

  8. #8
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

    I tried it with

    edit_limit = 512;

    and it works fine

  9. #9
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

    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?

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,568

    Default

    Registered forum members do not see this ad.

    Use edit_width
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Issues with getstring
    By ordengate in forum AutoLISP, Visual LISP & DCL
    Replies: 17
    Last Post: 10th Feb 2011, 02:59 pm
  2. Getstring Question
    By harrison-matt in forum AutoLISP, Visual LISP & DCL
    Replies: 31
    Last Post: 19th Oct 2010, 10:57 pm
  3. getstring
    By jay3791 in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 29th Sep 2009, 07:21 pm
  4. no input box
    By alec in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 17th May 2009, 09:56 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts