TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: JohnK on April 15, 2005, 02:49:44 PM

Title: DCL - Making button default
Post by: JohnK on April 15, 2005, 02:49:44 PM
I would like to make the "ok" button default so when i hit enter the dialog goes away.  (Im horrible at DCL)

Code: [Select]
ibox : dialog {

    key = "title";
    : edit_box {
    key = "eb1";
          }
    ok_cancel;

       }


Any help would be appreciated.
Title: DCL - Making button default
Post by: CAB on April 15, 2005, 03:40:51 PM
is_default = true;
Title: DCL - Making button default
Post by: Mark on April 15, 2005, 03:43:29 PM
I was thinking allow_accept = true-false;
Title: DCL - Making button default
Post by: Mark on April 15, 2005, 03:44:34 PM
RTFM ............. :)

Programmable Dialog Box Reference
Title: DCL - Making button default
Post by: Kerry on April 15, 2005, 05:50:49 PM
I think this is the sort of thing you're looking for :
My understanding is the allow_accept will only work if the control it is located in has focus when ENTER is pressed
Code: [Select]

texteditor : dialog {
    label = "Edit Text";
    initial_focus = "text_edit";

    : edit_box {
       label = "Text:";
       key = "text_edit";
       edit_width = 100;
       edit_limit = 1536;
       allow_accept = true;
    }
    ok_cancel;
}
Title: DCL - Making button default
Post by: JohnK on April 15, 2005, 09:37:09 PM
Kerry, That looks like it will work perfectly.  Thanx man.  (Although the edit width is a bit big. :lol:)
...
Works awesome! Thanx Kerry.
Title: DCL - Making button default
Post by: CAB on April 15, 2005, 10:52:17 PM
Nice one Kerry.

Here is another way: http://www.theswamp.org/phpBB2/viewtopic.php?t=2715