RE: [gtkmm] Dialog boxes

Am Sam, 2002-11-30 um 22.40 schrieb Dale Hirt:
> Barnaby,
> Frankly, I prefer the signal_clicked() method myself.  Makes for easier
> reading of sourcecode when I go through.  I personally have never used the
> on_response method, although if you have to do something with data from your
> main class, the signal_clicked() method will allow you to hook up to a
> function in your main class and do whatever you need there.  My $.02.

Well, I would use the response ID approach.  It simplifies things a lot
-- if your dialog has more than 2 or 3 buttons in the action area it's
probably broken UI wise anyway.

> Gtk::Dialog has the virtual method on_response for the buttons added
> with add_button to callback. I'm not entirely sure if I'm going about
> this the right way, but if I add my own button with add_button, and
> override on_response (calling the base one as a last resort) what
> value can I use for the response_id? Or is this the wrong way to go
> about it, and I should just create the button myself, and connect up
> to signal_clicked() ?

Barnaby, most of the time you will use the predefined response IDs in
gtkmm, e.g. Gtk::RESPONSE_OK.  If you really need your own IDs just use
an anonymous enum -- the builtin ones are all < 0 so that won't clash.


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