Re: perltray/tk intercept windows minimize function
listmail <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Rob Seegel wrote:
>
> listmail wrote:
>
> >> I appreciate the response, I was able to clean up some code and
> I removed the Win32Util module altogether. I've been trying to
> understand the bit AND operation and how it removes the buttons.
>
> Basically, the operation clears the bits that correspond to those
> styles. Rather than going into it here at length, check out the
> following link. It was the first thing to pop up in a google search,
> and covers the various bitwise operators well:
> http://www.eskimo.com/~scs/cclass/int/sx4ab.html
>
> >> I was trying to remove just the minimize button, for example,
> but something like $style &= ~(WS_MINIMIZEBOX); only ~greys~ out the
> minimize button and does not remove it. Can you explain that piece
> to me?
>
>
> The bitwise portion should be explained by the link I supplied. Per
> Win32 standards, you cannot get rid of only the Minimize OR Maximize
> buttons -- they come as a pair. You either get rid of or display both.
> The best you can hope for is to disable one or the other. You'll find
> that this is true whether you use VB, C++, C#, or whatever. It may not
> be precisely the look you are going for, but it does effectively
> prevent the user from using the disabled button.
>
> Now that I've gone back over some of the past emails, I have another
> recommendation: so long as you are doing so many Win32-specific
> things, why not simply use Win32::GUI for your application? It seems
> to me (unless I'm misunderstanding) that what you're looking for is
> Win32::GUI::NotifyIcon. It seems to do what you were describing.
>
Well it may seem like I'm doing a lot of Win32 specific things, but
perhaps it is more that my persistence to change the minimize
functionality was leading towards trying all sorts of things using the
Win32 modules. I had thought of using a Win32::GUI window, but I don't
know how you would run several Tk widgets within or attached to a
Win32::GUI window. My main tk application consists of an Hlist, Text,
several labels; checkbuttons; buttons, and entry widget(s). To try and
implement such or convert over seems highly unnecessary, at least after
my initial tests of $mw->bind('<FocusOut>'...).
> The following snippet was taken from Win32::GUI How-to (Aldo Calpini
> and Erick Bourgeois). Here one link to a copy:
> http://jeb.ca/perl/win32-gui-docs/index.pl/how-to
>
> and the slightly modified code.
> use Win32::GUI;
>
> my $mw = Win32::GUI::Window->new(
> -name => 'Main',
> -text => 'Perl',
> -width => 200,
> -height => 200
> );
>
> my $ico = "c:\\Perl\\site\\lib\\Win32\\GUI\\demos\\guiperl.ico";
> my $icon = new Win32::GUI::Icon($ico);
>
> my $ni = $main->AddNotifyIcon(
> -name => "NI",
> -id => 1,
> -icon => $icon,
> -tip => "Hello"
> );
>
> Win32::GUI::Dialog();
>
> sub Main_Terminate { -1; }
>
> sub Main_Minimize
> {
> $mw->Disable();
> $mw->Hide();
> 1;
> }
>
> sub NI_Click
> {
> $mw->Enable();
> $mw->Show();
> 1;
> }
> __END__
>
> Rob
>
>
>
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
> server. If you wish to unsubscribe from this mailing list, send the
> message body of "unsubscribe ptk" to [email protected]
>
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]