GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

window instance problem

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
kedar



Joined: 11 Apr 2007
Posts: 3

PostPosted: Thu Apr 12, 2007 4:04 am    Post subject: window instance problem Reply with quote

sorry friend, i will explain my problem with code

i create windwo using
GtkWidget *window1;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

creating two buttons , one button callbacks like this

on_button1_clicked (GtkButton *button,
gpointer user_data)
{
window1 = create_window1();
gtk_widget_show (window1);
}
and second button callbacks like this
void
on_button2_clicked (GtkButton *button,
gpointer user_data)
{
gtk_widget_destroy(window1));
}

when i press first button more than one time somany windows are opend
at that time i press second button only one window will close remaing windows are
same?

so how can i solve that one?
can u help na
bye
Manju
Back to top
frychiko



Joined: 24 Mar 2007
Posts: 3

PostPosted: Thu Apr 12, 2007 2:54 pm    Post subject: Reply with quote

Your problem is not very clear...

Is this what you want the buttons to do?
button1 - show the window
button2 - close the window
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 465
Location: Portland, OR USA

PostPosted: Thu Apr 12, 2007 4:41 pm    Post subject: Reply with quote

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
GtkWidget *window1 = NULL;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

on_button1_clicked (GtkButton *button,
gpointer user_data)
{
  if (window1 == NULL)
  {
    window1 = create_window1();
    gtk_widget_show (window1);
  }
}

void
on_button2_clicked (GtkButton *button,
gpointer user_data)
{
  if (window1 != NUL) gtk_widget_destroy(window1));
}
Back to top
kedar



Joined: 11 Apr 2007
Posts: 3

PostPosted: Fri Apr 13, 2007 5:12 am    Post subject: thanks for ur response Reply with quote

thank u very much
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP