View previous topic :: View next topic |
Author |
Message |
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Fri Jul 24, 2009 9:37 pm Post subject: Need help with Dialog |
|
|
I can create a simple dialog with buttons but I can't figure out how to add a label and a input box to it. I tried using getContentArea and getActionArea but i keep getting access violation.
An example would help a lot. |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Sat Jul 25, 2009 3:13 pm Post subject: |
|
|
This is working for me:
Code: | module gtk.DialogTest;
import gtk.Main;
import gtk.Label;
import gtk.Dialog;
import gtk.Button;
import gtk.Widget;
import gdk.Event;
void main(string[] args)
{
void exit(Button btn)
{
Main.quit();
}
bool windowDelete(Event event, Widget widget)
{
Main.quit();
return false;
}
Main.init(args);
Dialog dlg = new Dialog();
auto vbox = dlg.getContentArea();
vbox.add(new Label("Hello World"));
auto hbox = dlg.getActionArea();
hbox.add(new Button(StockID.CLOSE, &exit));
dlg.addOnDelete(&windowDelete);
dlg.showAll();
Main.run();
} |
|
|
Back to top |
|
|
mike
Joined: 28 Dec 2008 Posts: 34
|
Posted: Sat Jul 25, 2009 3:41 pm Post subject: |
|
|
Thanks for the example. I figured out that I was using the wrong dlls.
Thanks Mike Wey. |
|
Back to top |
|
|
|