Below is part of some code.  I want to be able to change the Notify Icon
tip based on the status of the main window:

If window is visible, tip should be "Hide PCKeys", if not visible, tip
should be "Show PCKeys".  Can this be done?   I have tried several
different things and nothing has worked.  I have the hide/show part in
my NI_Click sub, but cant change the tip text... Help...

Joe Frazier, Jr
Technical Support Engineer
PeopleClick
919-645-2916
[EMAIL PROTECTED]
 

use Win32::GUI;

$Window = new Win32::GUI::Window(
    -name   => "Window",
    -topmost => 1,
    -left   => 300,
    -top    => 400,
    -width  => 205,
    -height => 228,
    -maxsize  => [205,228],
    -minsize  => [205,228],
    -text   => "PC 4.0 Keys",
 -maximizebox => 0,
 

);

$icon = new Win32::GUI::Icon('SECUR05.ICO');
$Window->ChangeIcon($icon);
$ni = $Window->AddNotifyIcon(-name => "NI", -id => 1,
                               -icon => $icon, -tip => "PCKeys");

$Window->Show();
Win32::GUI::Dialog();

#=====================
sub Window_Terminate {
#=====================
$ni = $Window->AddNotifyIcon(-name => "NI", -id => 1,
                               -icon => '', -tip => "Hide PCKeys");
    return -1;
}

sub NI_Click {
 if ($Window->IsVisible){
  $Window->Disable();
         $Window->Hide();
         $Window->NI->{-tip} = "Show PCKeys";
  return 1;
 }
 else {
         $Window->Enable();
         $Window->Show();
         $Window->NI->{-tip} = "Hide PCKeys";
  return 1;
 }
}

Reply via email to