Re: newbie and ask show window
- From: Jean Bréfort <jean brefort normalesup org>
- To: Ade Amrillah <adegaos gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: newbie and ask show window
- Date: Wed, 10 May 2006 08:51:46 +0200
Le mercredi 10 mai 2006 �3:23 +0700, Ade Amrillah a �it :
> hi all
> i'm newbie in gtk+. i was create simple programme for testing
> "gtk_widget_show()" function.
> my program has tow windows
> first window i put button for call second window, i develop GUI with
> Glade and anjuta for code.
> my code are
>
> void on_openbtn_clicked (GtkButton *button,gpointer user_data)
> {
> GtkWidget * window2;
> window2=create_window2();
> gtk_widget_show(window2);
>
> }
>
> and it's working. but if i press button again a new window (window2)
> will be create.
> i want just one window created if i press again button.
> ask: how i change the programme for show window for only one show?
> for illustrated:
> i use gedit and i click preferences (menu edit->preperences) just one
> window showed and if i click again did not show again new window.
> sorry for my english :)
Use something like:
GtkWidget * window2 = NULL;
void on_openbtn_clicked (GtkButton *button,gpointer user_data)
{
if (window2 != NULL)
return;
window2=create_window2();
gtk_widget_show(window2);
}
and add an event handler to reste window2 to NULL when the window is
destroyed.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]