Re: Referencing Widgets?
- From: Mikoyan <miko2 pandora be>
- To: Steve Woodward <stevew goes com>
- Cc: gtk-list gnome org
- Subject: Re: Referencing Widgets?
- Date: 01 Sep 2003 19:24:26 +0200
On Mon, 2003-09-01 at 18:48, Steve Woodward wrote:
> I'm sure this is an FAQ but I've been unable to find the right answer.
> I'm new to GTK and Linux programming, my background is C programming in
> Windows and a little for the Mac. I'm using Glade to build an interface
> to a simple one window conversion type app. The confusion I am facing
> revolves around referencing widgets. Let's say I want to get the
> contents of an entry field. It seems that I cannot reference the entry
> field directly as in:
>
> temp = gtk_editable_get_chars(GTK_EDITABLE(entryStartNum), 0, -1);
>
> The above results in a seg fault. I've seen something about
> lookup_widget, but you have to specify some other widget as the first
> parameter.
> So I guess what I am ultimately asking is how to reference
> widgets...many thanks in advance.
First of all, questions about gtk programming or gtk app programming
belong in gtk-app-devel list.
To answer your question. Glade-2 produces an interface.h file. In this
file several *create functions are declared. E.g. create_window1().
This function creates obviously a window and returns it as a GtkWidget*.
E.g:
GtkWidget *myWindow = create_window1();
Make sure the widgets you want to reference are proper named via the
glade-2 editor. I assume your entryStartNum has the name "entryStartNum"
:-)
Use lookup_widget as in the next example:
GtkWidget *myEntry = lookup_widget(myWindow, "entryStartNum");
It's that simple. Btw, it may proof usefull to look at libglade2 where
the glade files (which are xml files) are used to create your UI.
Steven
> Steve W
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]