Re: Can a subclassed Dialog return a variable?




On Jul 5, 2008, at 1:42 PM, zentara wrote:

I was trying to create a subclassed Dialog that returned
the settings of some Scales. As hard as I tried, the Dialog
would only return the integer assigned to the buttons.

The response id gets attached to the action widget when you do add_button() (or the Buildable equivalent). There appears to be no way to change it.



The problem is that $self->{result} gets set and won't change.
I'm trying to change it from 42 to 43.

Actually, $self->{result} in your example *does* get changed. The simple code here does nothing with it, however. Try adding print "$self->{result}\n"; and $self->{result}++; to do_response() and click the ok button a bunch of times.

The GtkDialog::response signal does not actually have a return value, so that's not doing what you think. And the signal invocation cannot alter the response id during the invocation.

But i don't understand why you're trying to get run() to return a value other than one of the responses added when the dialog was created. You could override ->run() in traditional perl style, but i think that was rather violate the Principle of Least Surprise.


package RGBDialog;

Any particular reason not to use Gtk2::ColorSelectionDialog?



--
The stereo, playing the Beastie Boys' "Rhymin' and Stealin'": "I'll steal your girlie like I stole your bike!"

Elysse:  "You mean, take off the chain and ride away?"





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