Re: Getting a refrence to a widget



Rick Stewart wrote:

  Heres my problem.  I have UI code all put together in a perl module.  I
include this in my script using 'use'.  My problem is I have a widget I
would like to access.  Since the scalar used in its creation is local,
I have no way to get that varriable so I may modify the widget its self.
This is sorta like my first question.  It can be done in C but not perl.
Any ideas?
Hi, a few ideas.

1) return a hash of all the widgets that you construct to the script
like:
    my $widgets = UI->new;
    $widgets->{'name'}->set_text("text");

2) declare the script to be in the same package as the UI.pm file. It
was
    ages before I realised that many files can be in the same package
and
    many packages can be the same file. Then: $widget->set_text("text");

3) access the scalar as $UI::widget->set_text("text");

I hope that I have understood your question.

Regards, Dermot






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