Re: Learning GTK / GUI Programming



On Fri, Aug 29, 2003 at 07:03:25PM -0400, Rick Sutphin wrote: 
> Does anyone have any suggestions of how to learn to write clean well
> designed GUI applications (in GTK or just in general)? 

The best suggestion is to read code of existing applications. 
Gnumeric and things of that nature.

Some general advice:

 1. write your application data structures first, then write a GUI to
    display them. e.g. if your app has concepts like "chat channel" or
    "user account" have objects for those things that are not tied to
    the GUI.

 2. use model-view; the app objects should not have any direct 
    knowledge of the UI, instead the UI monitors the app objects
    for changes and reflects their state.

    Never write:

      set_model_attribute_foo();
      update_view_to_display_new_value();

    always instead:

      connect (model, "foo_changed", update_view_callback);
      set_model_attribute_foo();

 3. use glade + libglade for dialogs, to limit the amount of hardcoded
    GUI code cruft

Havoc



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