Re: GTK PROGRAM STRUCTURE
- From: Flavio Ribeiro <flavio hackpalace com>
- To: gtk-list gnome org
- Subject: Re: GTK PROGRAM STRUCTURE
- Date: Tue, 06 Feb 2001 12:28:29 -0200
Try creating structures that cointain important parts of your user
interface and making functions that initialize these structures. Declare
instances of the structure inside main() and call handlers with a
pointer to the structure (or to an array of relevant structures) as the
argument.
This way the variables won't all be global and the widgets will be
grouped in blocks.
Flavio
--
CyborgHead netscape net wrote:
> Hi.
> A quick question, which is more one of style and programming
> practice. What is the best way to structure a GTK Program. I have
> written a program which contains many dialog boxes, all which hold
> buttons, text boxes etc.. I felt that the best way to program this
> would be to use classes as I am used to object orientated programming
> however I found that it could not be effectively done.
>
> Having created an instance of a class , b I tried to call
>
> gtk_signal_connect_object( GTK_OBJECT( button_setup ), "clicked",
> GTK_SIGNAL_FUNC( b.setup ), NULL );
>
> This did not work, I then tried to pass the class as a parameter ie.
>
> gtk_signal_connect_object( GTK_OBJECT( button_setup ), "clicked",
> GTK_SIGNAL_FUNC( global_void_function ), b );
>
> and this did not work.
> Since most of my functions need access to alot of the GtkWidgets I
> have made nearly all my variables global so they can be accessed by
> all the functions, but this is crap, and need to improve it cause it
> is an important project for college. How do you think I should
> structure the program to have good programming practive and have the
> variables available to numerous functions.
>
> Ciaran
>
> __________________________________________________________________
> Get your own FREE, personal Netscape Webmail account today at
> http://webmail.netscape.com/
>
> _______________________________________________
> 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]