Home > Archive > PerlTk > March 2005 > perl/tk window w/o frame
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
perl/tk window w/o frame
|
|
| yahavba@towersemi.com 2005-03-21, 3:58 pm |
| Hi All,
Is it possible to create a window that hasn't got the WM frame with the
'close' 'minimize' etc. buttons, but still to be able to drag it around
the desktop somehow ?
I'm using solaris, but i saw many apps in Windows env that have this
feature.
Thanks !!
Yahav Bar yosef
| |
| thundergnat 2005-03-21, 8:57 pm |
| yahavba@towersemi.com wrote:
> Hi All,
>
> Is it possible to create a window that hasn't got the WM frame with the
> 'close' 'minimize' etc. buttons, but still to be able to drag it around
> the desktop somehow ?
> I'm using solaris, but i saw many apps in Windows env that have this
> feature.
>
> Thanks !!
>
> Yahav Bar yosef
>
Not perhaps the best way to do it, but it should give you an idea of
how to procede:
use warnings;
use strict;
use Tk;
my $top = MainWindow->new;
$top->geometry('200x200+200+200');
$top->overrideredirect(1);
$top->Label(
-text => 'Click and Drag'
)->pack(
-expand => 1,
-fill => 'both'
);
$top->Button(
-text => 'Exit',
-command => sub{$top->destroy}
)->pack;
my @deltaxy;
$top->bind('<1>' => \&getdelta);
$top->bind('<B1-Motion>' => \&mousemove);
MainLoop;
sub mousemove{
my ($width,$height,$x,$y) = split/[+x]/, $top->geometry;
$x = $top->pointerx - $deltaxy[0];
$y = $top->pointery - $deltaxy[1];
$top->geometry($width.'x'.$height."+$x+$y");
}
sub getdelta{
@deltaxy = ($top->pointerx - $top->x, $top->pointery - $top->y);
}
| |
| yahavba@towersemi.com 2005-03-22, 3:58 pm |
| Hi Thundergnat,
That's a realy nice solution- works great for me.
Thanks for your help !
Yahav Bar yosef
|
|
|
|
|