Re: [gtk-list] Gtk_Text question (2)



Lixin Tang wrote:
> 
> Hello,
> 
> Here is another odd phenomenon: Running the following code (to display a
> string in Gtk_Text widget) gave me 2 windows - seems that the Gtk_Text
> window flies itself out of the base window. Can someone give me a help on
> this?
> 
> Lixin
> 
> ============================ code start ================================
> void main( int argc, char* argv[] )
> {
>   Gtk_Main m( &argc, &argv );
> 
>   Gtk_Text* text  = new Gtk_Text(NULL, NULL);
>   text->show();
>   text->realize();
>   text->insert(NULL, NULL, NULL, "Hello World", -1);
> 
>   Gtk_Window* window = new Gtk_Window( GTK_WINDOW_TOPLEVEL );
>   window->add(text);
>   window->show();
> 
>   m.run();
> }
> ========================== code end ==================================

I think it's because of the GTK--. It happened the same to me. My
program read a file from the command line and displays it in a text
widget. I was forced to do the insertion in the show_event of the main
window.

Ionutz

PS: the trick with realize works in plain gtk+, if I'm not wrong !



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]