Author Topic: DCL - Making button default  (Read 2816 times)

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
DCL - Making button default
« 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.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
DCL - Making button default
« Reply #1 on: April 15, 2005, 03:40:51 PM »
is_default = true;
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
DCL - Making button default
« Reply #2 on: April 15, 2005, 03:43:29 PM »
I was thinking allow_accept = true-false;
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
DCL - Making button default
« Reply #3 on: April 15, 2005, 03:44:34 PM »
RTFM ............. :)

Programmable Dialog Box Reference
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
DCL - Making button default
« Reply #4 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;
}
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
DCL - Making button default
« Reply #5 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.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
DCL - Making button default
« Reply #6 on: April 15, 2005, 10:52:17 PM »
Nice one Kerry.

Here is another way: http://www.theswamp.org/phpBB2/viewtopic.php?t=2715
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.