[yast-devel] Perl YUI TextEntry
I'm trying to get the value of a YUI TextEntry (all in Perl). I created the TextEntry via: my $TextInput = TextEntry("Some Text",""); This let me add it to the VBOX: my $c = VBox( $TextInput, PushButton("&OK") ); UI->OpenDialog($c); UI->UserInput(); UI->CloseDialog(); However, you can't get the value from either: $value = $TextInput->Value; // Most Logical $value = UI->QueryWidget( $TextInput, "Value" ); // Second Most Logical What do I have to do in order to do this? Is this just incomplete Perl bindings? --Justin Haygood -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
I attached the current code I have. It should work per duncanmv's comment in IRC, however it does not. I am using openSUSE Factory. On Tue, 2008-03-25 at 17:39 -0400, Justin Haygood wrote:
I'm trying to get the value of a YUI TextEntry (all in Perl).
I created the TextEntry via:
my $TextInput = TextEntry("Some Text","");
This let me add it to the VBOX:
my $c = VBox( $TextInput, PushButton("&OK") );
UI->OpenDialog($c); UI->UserInput(); UI->CloseDialog();
However, you can't get the value from either:
$value = $TextInput->Value; // Most Logical $value = UI->QueryWidget( $TextInput, "Value" ); // Second Most Logical
What do I have to do in order to do this? Is this just incomplete Perl bindings?
--Justin Haygood
Justin Haygood wrote:
my $c = VBox( $TextInput, PushButton("&OK") );
UI->OpenDialog($c); UI->UserInput(); UI->CloseDialog();
However, you can't get the value from either:
$value = $TextInput->Value; // Most Logical $value = UI->QueryWidget( $TextInput, "Value" ); // Second Most Logical
What do I have to do in order to do this? Is this just incomplete Perl bindings?
--Justin Haygood
When I mean add a value query I was refering to $value as it is a YCPValue, and I ignore if perl bindings do automatic casting to a scalar. The UI query widget you were doing seemed fine.
Duncan -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Tue, Mar 25, 2008 at 07:59:41PM -0400, Justin Haygood wrote:
I'm trying to get the value of a YUI TextEntry (all in Perl).
I created the TextEntry via:
my $TextInput = TextEntry("Some Text","");
This let me add it to the VBOX:
my $c = VBox( $TextInput, PushButton("&OK") );
UI->OpenDialog($c); UI->UserInput(); UI->CloseDialog();
However, you can't get the value from either:
$value = $TextInput->Value; // Most Logical $value = UI->QueryWidget( $TextInput, "Value" ); // Second Most Logical
What do I have to do in order to do this? Is this just incomplete Perl bindings?
Hi Justin, my $TextInput = TextEntry(id("Input"), "Some Text",""); This does not create the widget. It only creates a recipe (a term) for the widget. So $TextInput->Value does not work. However, $TextInput->name returns "TextEntry". Same with all the other widgets. The widgets only live in the dialogs, and you do not get objects representing them. You can only access them via UI functions using their ids as handles. So UI->QueryWidget( $TextInput, "Value" ) does not work either, but UI->QueryWidget(id("Input"), Symbol("Value") ) does. (The "Symbol" is a necessity that I forgot to do away with. In YCP it is just `Value vs "Value") The fact that widgets only live inside dialogs also means that after you close a dialog, you can no longer query its widgets. So QueryWidget must come before CloseDialog. Attached is a working version. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
That worked. Thank you so very much! On Wed, 2008-03-26 at 12:48 +0100, Martin Vidner wrote:
On Tue, Mar 25, 2008 at 07:59:41PM -0400, Justin Haygood wrote:
I'm trying to get the value of a YUI TextEntry (all in Perl).
I created the TextEntry via:
my $TextInput = TextEntry("Some Text","");
This let me add it to the VBOX:
my $c = VBox( $TextInput, PushButton("&OK") );
UI->OpenDialog($c); UI->UserInput(); UI->CloseDialog();
However, you can't get the value from either:
$value = $TextInput->Value; // Most Logical $value = UI->QueryWidget( $TextInput, "Value" ); // Second Most Logical
What do I have to do in order to do this? Is this just incomplete Perl bindings?
Hi Justin,
my $TextInput = TextEntry(id("Input"), "Some Text","");
This does not create the widget. It only creates a recipe (a term) for the widget. So $TextInput->Value does not work. However, $TextInput->name returns "TextEntry". Same with all the other widgets.
The widgets only live in the dialogs, and you do not get objects representing them. You can only access them via UI functions using their ids as handles. So UI->QueryWidget( $TextInput, "Value" ) does not work either, but UI->QueryWidget(id("Input"), Symbol("Value") ) does. (The "Symbol" is a necessity that I forgot to do away with. In YCP it is just `Value vs "Value")
The fact that widgets only live inside dialogs also means that after you close a dialog, you can no longer query its widgets. So QueryWidget must come before CloseDialog.
Attached is a working version.
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Duncan Mac-Vicar Prett
-
Justin Haygood
-
Martin Vidner