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 

N00b Needs 'Next' and 'Back' Button

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



Joined: 07 Apr 2008
Posts: 1

PostPosted: Mon Apr 07, 2008 11:25 am    Post subject: N00b Needs 'Next' and 'Back' Button Reply with quote

EDIT: After fiddling about for days, the minute after I post here, I fixed the problem - see my updated code. HOWEVER, any help anyone can give me on have a global next, back button solution as I describe below would be greatly appreciated!


Hey there, excuse my ignorance, hope someone can help!

I have been using C for some time, but only really for simple mathematical stuff, only just really started on gtk - I'm using Glade3 for the building but am having trouble with the guts of the coding.

Basically what I want is to have a Next and a Back button that destroy the current window and show the 'next' one, or the previous one. It seemed that it should be quite simple but I am having some problems, so at the moment I am struggling to even get a single instance of a next button to work...

Here is an example of what I have been trying - this one results in a segmentation fault...
Quote:


#include <gtk/gtk.h>
#include <glade/glade.h>

int main (int argc, char *argv[])

{
GladeXML *gxml;
GtkWidget *window;
GtkWidget *window2;
GtkWidget *next;

gtk_init (&argc, &argv);

gxml = glade_xml_new ("prac.glade", NULL, NULL);
window = glade_xml_get_widget (gxml, "window1");
window2 = glade_xml_get_widget (gxml, "window2");
next=glade_xml_get_widget (gxml,"button1");
g_signal_connect_swapped (G_OBJECT (next), "clicked",
G_CALLBACK (gtk_widget_hide), (gpointer)window);
g_signal_connect_swapped (G_OBJECT (next), "clicked",
G_CALLBACK (gtk_widget_show), (gpointer)window2);



gtk_widget_show (window);
gtk_widget_show (next);
gtk_main ();

return 0;
}


In the long run, I would like a global solution, ie so every next button on whatever page emits the same signal and it works out what page is the next one etc.

Thanks in advance for any help you guys can give me!
Back to top
bruce89



Joined: 19 Dec 2007
Posts: 3

PostPosted: Thu Apr 10, 2008 2:21 pm    Post subject: Reply with quote

Looks like you ought to be using GtkAssistant. It is a window which can have multiple stages and has previous/next buttons built in.
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