GtkD Dialog layout

Vitaly Livshic vitaly_himki at mail.ru
Wed May 15 06:35:15 UTC 2019


Good day.

I need simple Dialog with two buttons and some fields:

public class ActivationDialog : Dialog
{
     private Entry codeEntry;

     this(Window parent)
     {
         StockID[] buttons = [ StockID.OK, StockID.CANCEL ];
         ResponseType[] responses = [ GtkResponseType.OK, 
GtkResponseType.CANCEL ];
         super("Some header", parent, GtkDialogFlags.MODAL, 
buttons, responses);

         auto box = new Grid;
         box.setColumnHomogeneous(false);
         box.setRowHomogeneous(true);
         box.setRowSpacing(3);
         box.setColumnSpacing(5);
         box.setBorderWidth(8);

         auto label = new Label("Some Text: ");
         box.attach(label, 0, 0, 1, 1);
         label = new Label("shiche at tralala.com");
         box.attach(label, 1, 0, 1, 1);
         label = new Label("Enter number");
         box.attach(label, 0, 1, 1, 1);
         codeEntry = new Entry;
         box.attach(codeEntry, 1, 1, 1, 1);

         getContentArea.packStart(box, true, true, 0);
     }
}

  Compiles fine, no warnings, but I see only two buttons. GTK 
shows no warnings. I replace 'packStart' with add but it no 
effect too.

  How to add Grid to dialog properly?


More information about the Digitalmars-d-dwt mailing list