Mailinglist Archive: yast-devel (191 mails)

< Previous Next >
Re: [yast-devel] Perl YUI TextEntry
  • From: Justin Haygood <jhaygood@xxxxxxxxxxx>
  • Date: Wed, 26 Mar 2008 10:19:02 -0400
  • Message-id: <1206541142.7472.0.camel@xxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >