[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: another window
- From: Erik Mouw <J A K Mouw its tudelft nl>
- To: eei_gtk zipmail com br
- Cc: gtk-app-devel-list redhat com
- Subject: Re: another window
- Date: Tue, 1 Feb 2000 10:58:03 +0100 (MET)
On Tue, 01 Feb 2000 08:44:32 -0200 (EDT), Fernando Figaro wrote:
> I'm making a program using GTK and I had a problem working with the widget
> window.
>
>
> My program has the main window, and when the user clicks in a button, the
> program need to open another window to the user fill some fields....however, I
> can't do it.....
>
> void open(void) {
^^^^
Name clash! open() is already a function in the standard C library (see
"man 2 open"). _Always_ give your global functions and variables unique
names. To avoid name space pollution, it is even better to use a prefix on
each function name, especially in libraries (like GTK+: each function is
prefixed with "gtk_").
> GtkWidget window1;
^^^^^^^
GtkWidgets should _always_ be pointers and they should _always_ be
allocated with gtk_whatever_new().
> ....
> ....
> ....
> gtk_widget_show(window1);
> }
>
>
> int main(int argc, char **argv) {
> ....
> ....
> GtkWidget janela;
> GtkWidget button;
Again, widgets should be pointer variables, and they should be allocated
with gtk_whatever_new().
> ....
> ...
> ....
> gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(open),NULL)
Depending on the link order, you might as well be calling the libc open()
function over here.
> gtk_widget_show(janela);
Please use gcc's "-Wall" option when you're compiling your source code;
the compiler would have warned you about these errors.
Erik
--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2785859 Fax: +31-15-2781843 Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]