For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > May 2005 > Checkbutton problem









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 Checkbutton problem
scottmf

2005-05-19, 8:57 pm

I have several checkbuttons in a main window and a getOpenFile dialog box
that opens over them. When you double click on a file in the dialog box
the checkbutton below the dialog box is also activated. Is there any easy
way to fix this without changing the geometry?

Here is an example:

use Tk;
use strict;

my @vals = (1,2,3,4,5,6,7,8);
my ($key, %bt);

my $mw = MainWindow -> new(-title => 'a test program');
$mw ->geometry("300x300+150+90");
foreach $key (@vals) {
$bt{$key} = $mw -> Checkbutton(-text => $key) -> pack();
}
my $open = $mw -> Button(-text => 'open',
-command => \&open)-> pack();
my $exit_but = $mw -> Button(-text => 'Exit',
-command => \&close) -> pack();

MainLoop;

sub open {
$mw -> getOpenFile();
}

sub close {
$mw -> destroy;
}


Marc Dashevsky

2005-05-19, 8:57 pm

In article < ae4e3b984230dd7b5b33cd56ea53977a@localho
st.talkaboutprogramming.com>,
fleming.scott@nospam says...
> I have several checkbuttons in a main window and a getOpenFile dialog box
> that opens over them. When you double click on a file in the dialog box
> the checkbutton below the dialog box is also activated. Is there any easy
> way to fix this without changing the geometry?


What OS? Which version of Tk? I don't see this on Windows 2000,
ActiveState v5.8.6, Tk 804.027.

> Here is an example:
>
> use Tk;
> use strict;
>
> my @vals = (1,2,3,4,5,6,7,8);
> my ($key, %bt);
>
> my $mw = MainWindow -> new(-title => 'a test program');
> $mw ->geometry("300x300+150+90");
> foreach $key (@vals) {
> $bt{$key} = $mw -> Checkbutton(-text => $key) -> pack();
> }
> my $open = $mw -> Button(-text => 'open',
> -command => \&open)-> pack();
> my $exit_but = $mw -> Button(-text => 'Exit',
> -command => \&close) -> pack();
>
> MainLoop;
>
> sub open {
> $mw -> getOpenFile();
> }
>
> sub close {
> $mw -> destroy;
> }


--
Go to http://MarcDashevsky.com to send me e-mail.
scottmf

2005-05-19, 8:57 pm

Sorry;

Windows XP
ActiveState v5.6 Tk 800.024

~Scott

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com