Re: Problem with gtk_notebook_set_current_page()



My Inbox Happily Received This From Mirco Müller @ Wed, 25 Sep 2002 03:16:06 +0200

Hello everyone!

      I created a GtkNotebook with two pages (one holding a centered GtkLabel, the 
other a GtkGLArea). I disabled the rendering of tabs and borders for this 
GtkNotebook so the user does not notice that there is actually more "than 
meets the eye" :) I want to control the displayed tab of the GtkNotebook from 
within my program.

      This does not work as intended. Only some calls to 
gtk_notebook_set_current_page() work others don't. To cross-check things I 
added keyboard-shortcuts for each tab. With the keyboard I can switch between 
both tabs without any problem.

Furthermore I added some printf()s to the tab-switching like this (case 1):


maybe like that ?
gint i;
    if( (i =gtk_notebook_get_current_page( my_notebook )) == 0 )
        gtk_notebook_set_current_page( my_notebook, 1 );
    else
        printf( "loadEffect(): page 1 is already being displayed\n" );

and (case 2):

    if( (i = gtk_notebook_get_current_page( my_notebook )) == 1 )
        gtk_notebook_set_current_page( my_notebook, 0 );
    else
        printf( "loadEffect(): page 0 is already being displayed\n" );

      For some reason the message (either case) gets printed to console although 
the page/tab tested for isn't really displayed at all.

try to print the value returned by gtk_notebook_get_current_page()
perhaps that may help in the debugging

i think this should work,

gint i = gtk_notebook_get_current_page(GTK_NOTEBOOK(my_notebook));
switch (i)
case 0:
gtk_notebook_set_current_page( GTK_NOTEBOOK(my_notebook), 1 );
break;
case 1:
gtk_notebook_set_current_page( GTK_NOTEBOOK(my_notebook), 0 );
break;
default:
break;

-- 
----------------
-- Katoob Main Developer
Linux registered user # 224950
ICQ # 58475622
With Great Power, Comes Great Responsibilities.

Attachment: pgpw9TARYYTxa.pgp
Description: PGP signature



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