Re: I need another hint Setting properties

From: Tim Gimmel <tjg_at_gimmel.org>
Date: Sun, 28 Dec 2008 01:13:23 -0600
To: Dmitry Karasik <dmitry_at_karasik.eu.org>

On Sat, 2008-12-27 at 23:50 +0100, Dmitry Karasik wrote:
> Hi Tim!
>
> On 27 дек 08 at 23:06, "Tim" (Tim Gimmel) wrote:
> Tim> I can't figure out how to call the objects and I
> Tim> cannot find a comprehensive list of methods that I know will work.
>
> I'm unsure about what do you mean by "calling the objects".

Changing the properties of different widgets in the "window", like
enabling a button, changing text, etc.

>
> Tim> have found that in a widget $self->set(prop => value); seems to do
> Tim> the trick, but I never really found the description for "set".
>
> set() is a common method that allows setting object properties. F.ex.
>
> $obj-> name(1);
> $obj-> text(2);
>
> is the same as
>
> $obj-> set( name => 1, text => 2);
>
> Tim> the code editor? I tried "Prima::Lable::lblUSB" but that did not
> Tim> work. My form is "Form1" (I know, how creative), I have tried
>
> Is your question how to reach objects from the form? Given $form is
> your Form1, $form->lblUSB should be what you need.

Yes, almost. I need to get to widgets from the built in code editor. If
you look at the code below:

my $t = Prima::Timer -> create(
             timeout => 250,
             onTick => sub {
 
my $mode = getMode('a');
chomp($mode);
        if ($mode eq "USB") {
                   $self->set( enabled => 1 );
                   print "Tick\n";
        } elsif ($mode eq "LSB") {
                   $self->set( enabled => 0 );
                   print "Tock\n";
        }
    },
);
$t->start; (I realize $self in the code window wouldn't work)

If I place this code into say, onCreate event in the label widget
"lblUSB" it works perfect, the current widget object appears to be in
in $self. However if I place this same code into the "code editor", it
executes (the tick tock's), but I am unable to access the lblUSB, no
matter what name I use. To make things more confusing to me:

>your Form1, $form->lblUSB should be what you need.

I cannot find anywhere in the .frm file an object name that I can use!
I guess I am really confused where all the name-spaces reside.

Thanks for all you help so far,
Tim

>
>
Received on Sun 28 Dec 2008 - 08:10:36 CET

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET