Sign up

problem with Dialog

hi,

i am trying to create a simple customized Dialog for user input, see test case below. unfortunately, it won't show the content part, only the buttons. doesn't work using packStart() either. what is wrong with my code?

import gtk.Main, gtk.Label, gtk.Dialog, gtk.Entry;
import std.stdio;

void main(string[] args){

string ret = "";
Main.init(args); 

auto dlg = new Dialog(
    "test",
    null,
    DialogFlags.MODAL,
    ["OK", "Cancel"],
    [ResponseType.ACCEPT, ResponseType.CANCEL]
);
auto q = new Entry( "write something" );
auto vbox = dlg.getContentArea();
vbox.add( new Label("test") );
vbox.add( q );

if( ResponseType.ACCEPT == dlg.run() ){
    ret = q.getText();
}
dlg.destroy();

writeln(ret);

}

Re: problem with Dialog

On Wed, 04 Sep 2013 22:05:41 GMT, det wrote:

hi,

i am trying to create a simple customized Dialog for user input, see test case below. unfortunately, it won't show the content part, only the buttons. doesn't work using packStart() either. what is wrong with my code?

... code ...

Your code seems to be correct, i'll see if i can find out whats wrong (probably during the weekend).

Re: problem with Dialog

On Thu, 05 Sep 2013 20:44:50 GMT, Mike Wey wrote:

On Wed, 04 Sep 2013 22:05:41 GMT, det wrote:

hi,

i am trying to create a simple customized Dialog for user input, see test case below. unfortunately, it won't show the content part, only the buttons. doesn't work using packStart() either. what is wrong with my code?

... code ...

Your code seems to be correct, i'll see if i can find out whats wrong (probably during the weekend).

great, thanks! and there is also the issue with the FileChooserDialog emitting lots of critical messages to the console ...
( http://forum.gtkd.org/groups/GtkD/thread/42/ )

cheers,

det

Re: problem with Dialog

On 09/06/2013 05:56 PM, det wrote:

On Thu, 05 Sep 2013 20:44:50 GMT, Mike Wey wrote:

Your code seems to be correct, i'll see if i can find out whats wrong (probably during the weekend).

great, thanks! and there is also the issue with the FileChooserDialog emitting lots of critical messages to the console ...
( http://forum.gtkd.org/groups/GtkD/thread/42/ )

cheers,

det

It seem you need to call vbox.showAll(); before dgl.run for it's content
to show up.

The FileChooserDialog doesn't emit any errors on Linux, i still need to
try it on Windows.

Re: problem with Dialog

On Sat, 07 Sep 2013 22:51:47 +0200, Mike Wey wrote:

It seem you need to call vbox.showAll(); before dgl.run for it's content
to show up.

indeed!

dlg.showAll() and then dlg.run() does the trick too. isn't this curious? this is a bit redundant and not quite straightforward. i am still new to GTK, only use it with/from D. wondering if this is a gtkD quirk or standard GTK behavior...but hey, it is working now - all i really needed.

thanks a lot for your help, mike!

/det

Re: problem with Dialog

On Tue, 10 Sep 2013 07:24:10 GMT, det wrote:

dlg.showAll() and then dlg.run() does the trick too. isn't this curious? this is a bit redundant and not quite straightforward. i am still new to GTK, only use it with/from D. wondering if this is a gtkD quirk or standard GTK behavior...but hey, it is working now - all i really needed.

It's the Gtk+ behavior run will show the dialog but not it's children, that is left up to you.

thanks a lot for your help, mike!

/det