Re: Beginner questions ...
- From: Keith Sharp <kms passback co uk>
- To: gtk-list gnome org
- Subject: Re: Beginner questions ...
- Date: Wed, 15 Dec 2004 22:59:46 +0000
On Wed, 2004-12-15 at 18:29 +0100, Sam B wrote:
> Hello and thank you for reading my post !
>
> I have a few questions about gtk+, sorry, I am a beginner :
>
> 1) I use the widget to get a filename with a menu (I don't remember its
> name). I connected the "Cancel" button signal to "widget_destroy" and this
> is OK. But I would like the app to do a few functions and then close the
> widget used to choose the filename. How could I close a widget from a
> function called by this widget ? Now, when I click OK, the widget asking me
> to choose a file is still open and sould be closed !
Your question is not clear, what do you mean by "widget"? However, what
you probably want to do is pass a pointer to the widget as the final
argument to g_signal_connect() when you hook up the callback to the OK
button.
A snippet of the main function would be:
GtkWidget *widget;
GtkButton *button;
/* Create the widget, button, and other stuff as required */
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (ok_button_cb), widget);
gtk_widget_show_all (widget);
gtk_main ();
And the callback would be:
static void
ok_button_cb (GtkButton *button, gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
/* Do the things you want */
gtk_widget_destroy (widget);
return;
}
> 2) I vould like to make a Notebook with a variable number of tabs, depending
> on the user's actions. Which function does this ?
Just add another page to the notebook for each tab your user needs. You
can either prepend or append:
http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#gtk-notebook-prepend-page
http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#gtk-notebook-append-page
All of the functions about notebooks can be found:
http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html
Keith.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]