Re: gtk custom widgets



Thanks Guys,

the main reason I'm creating a new widget is to enable me to store a
struct that contains info about a sound file that is displayed by this
widget. I don't see any other way to do it. If I don't create a
composite widget, this struct data will be lost once the signal handler
function which creates it completes.

Does this sound reasonable?

On Wed, 2004-10-20 at 18:22, Maciej Katafiasz wrote:
Dnia 20-10-2004, śro o godzinie 16:35 +0800, Daniel Piccoli napisał:
I was just reading the gtk tutorial and it says to only write a new
widget if there isn't one available that performs your required task.

I have found that I have to create a new widget to enable me to store
additional data that may effect the display of a widget. eg. I store
information about the audio samples to be displayed by a graphing widget
(that already exists). 

This is in a similar fashion to creating a big app class in Java (swing)
and making this class consist of a composition of widgets that already
exist as well as data objects that are needed for your application.

Yes. There's a difference between writing totally new widget from
scratch, which is not encouraged unless there isn't anything that can be
used instead, and creating your own composite widgets, which is very
common, and good, practice. Each time you have similar setup done in
more than one place, or if it's complicated, it's good idea to create
composite widget for that and use it wherever you'd use hand-written
setup code. Take a look at any non-trivial GNOME app, like gconf-editor,
gedit, etc. Each one has bunch of custom composite widgets used all over
the place for search dialogs and similar stuff

HTH,
Maciej




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