|
From: Kieren D. <Kie...@ha...> - 2010-02-25 10:43:32
|
> -----Original Message-----
> From: az...@nu... [mailto:az...@nu...]
> Sent: 25 February 2010 03:54
> To: per...@li...
> Subject: [perl-win32-gui-users] Need to dynamically change the -tip
>
> Hi,
>
> I have developed a software using Win32::GUI and I need to have my
> user to choose their desired language during the time when
> they login
> to the system. This will change not only the interface language but
> also the tooltip. I don't have any problem doing so for
> others but for
> the -tip I've never succeeded.
Hi Azlan.
If you used an explicit Tooltip object instead of the -tip option, it
has a
special method to change the text. A Tooltip is a set of tooltips rather
than a
single one, so common methods (such as Text) don't work as I had
expected.
For example:
use Win32'GUI '';
my $w = Win32'GUI'Window->new('-text', 'Window', '-size', [100, 100]);
my $b = $w->AddButton('-text', 'test');
my $c = $w->AddButton('-text', 'test', '-pos', [0, 50]);
my $t = $w->AddTooltip();
$t->AddTool('-text', 'Click me.', '-subclass', 1, '-window', $b);
$t->AddTool('-text', 'Click me too.', '-subclass', 1, '-window', $c);
$b->Change('-onClick', sub() {$t->UpdateTipText($b, 'Cliquez moi.')});
$c->Change('-onClick', sub() {$t->UpdateTipText($c, 'Cliquez moi
aussi.')});
$w->Show;
Win32'GUI'Dialog;
The other way to change the text is to recreate the component which has
the
tooltip, but the above should usually be simpler.
Kieron
|