Spencer Chase wrote:
> Greetings perl-win32-users,
> 
> Providing a script the demonstrates the problem as per $Bill's
> suggestion. The script runs fine but fails with the above listed error
> message when I try to make an exe with parlapp. Here is the script.
> The error messages and portion of stayOnTop that the errors refer to
> are copied again below.

...

It has something to do with Switch.pm - not sure what.

I got it to run by recoding the switches in Tk::StayOnTop
(which has pretty ugly code) to elsifs :


sub stayOnTop {
        my $obj = shift;

$method = $obj->get_method;
#warn "Chosen method is $method";

if ($method == METHOD_WINAPI) {
        $obj->update;
        # HWND_TOPMOST (-1) and SWP_NOSIZE+SWP_NOMOVE (3)
        $win32_winpos->Call(hex($obj->frame()),-1,0,0,0,0,3);

} elsif ($method == METHOD_ATTRIB) {
        $obj->attributes(-topmost => 1);

} elsif ($method == METHOD_WMSTATE) {
        my($wrapper) = $obj->toplevel->wrapper;
        $obj->property('set', '_NET_WM_STATE', "ATOM", 32,
                ["_NET_WM_STATE_STAYS_ON_TOP"], $wrapper);

} elsif ($method == METHOD_SIMPLE) {
        my $stay_above_after;
        $obj->bind("<Visibility>" => sub {
                if ($repeat_id) {
                        $obj->deiconify;
                        $obj->raise;
                }
        });
        $repeat_id = $obj->repeat(1000, sub {
                $obj->deiconify;
                $obj->raise;
                undef $stay_above_after;
        }) unless defined $repeat_id;

} else {
        die "Invalid method type [$method]";    
}

}

sub dontStayOnTop {
        my $obj = shift;

$method = $obj->get_method;

if ($method == METHOD_WINAPI) {
        $obj->update;
        # HWND_NOTOPMOST (-2) and SWP_NOSIZE+SWP_NOMOVE (3)
        $win32_winpos->Call(hex($obj->frame()),-2,0,0,0,0,3);
} elsif ($method == METHOD_ATTRIB) {
        $obj->attributes(-topmost => 0);
} elsif ($method == METHOD_WMSTATE) {
        my($wrapper) = $obj->toplevel->wrapper;
        $obj->property('delete', "_NET_WM_STATE_STAYS_ON_TOP", $wrapper);
} elsif ($method == METHOD_SIMPLE) {
        $obj->afterCancel($repeat_id);
        $repeat_id = undef;
} else {
        die "Invalid method type [$method]";    
}

}

I added these to the script too:
use Tk::Button;
use Tk::Canvas;
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to