Hi
I am having a problem in closing a menu window using TK module dynamically.
I use the following program. -
use Tk;
-
-
$mw = MainWindow->new;
-
$mw->geometry("1024x768");
-
$mw->title("Menu Test");
-
-
$main_menu = $mw->Menu();
-
$mw->configure(-menu => $main_menu);
-
$file_menu = $main_menu->cascade(-label=>"File", -underline => 0, -tearoff=>0);
-
$file_menu->command(-label=>"Exit", -underline=>0, -command=>sub{exit});
-
$settings_menu = $main_menu->cascade(-label=>"Settings", -underline => 0, -tearoff=>0);
-
$settings_menu->command(-label=>"Sub Menu1", -underline=>0, -command=>sub{&sub_func1});
-
MainLoop;
-
sub sub_func1
-
{
-
$s_mw = MainWindow->new;
-
$s_mw->geometry("800x550+150+100");
-
$s_mw->title("Sub Menu");
-
$sub_menu1 = $s_mw->Menu();
-
$s_mw->configure(-menu => $sub_menu1);
-
$label1 = $s_mw->Label(-anchor => "w", -text => "Perl Path:", -background => "#D4D0C8", -cursor => "");
-
$txt1 = $s_mw->Entry(-borderwidth => 1, -cursor => "", -font => "Tahoma 8 normal", -foreground => "#000000", -relief => "sunken");
-
-
$closeParent = $s_mw->Button(-background => "#FFFFFF", -borderwidth => 1, -text => "Close Main Window",-command => sub {&parent_close}, -cursor => "");
-
$cmdClear = $s_mw->Button(-background => "#FFFFFF", -borderwidth => 1, -text => "CLEAR",-command => sub{Clear()}, -cursor => "");
-
$cmdCancel = $s_mw->Button(-background => "#FFFFFF", -borderwidth => 1, -text => "EXIT",-command => [$s_mw => 'destroy'], -cursor => "");
-
$label1->place(-width => 96, -height => 24, -x => 25, -y => 25 );
-
$txt1->place(-width => 180, -height => 20, -x => 130, -y => 25);
-
-
$closeParent->place(-width => 100, -height => 20, -x => 200, -y => 500);
-
$cmdClear->place(-width => 60, -height => 20, -x => 350, -y => 500);
-
$cmdCancel->place(-width => 60, -height => 20, -x => 500, -y => 500);
-
-
MainLoop;
-
}
-
-
sub Clear
-
{
-
$txt1->delete(0, 'end'); $txt2->delete(0, 'end');
-
}
-
-
sub parent_close
-
{
-
#Invoking close a window..
-
$mw => 'destroy';
-
}
-
I do know how to close a window dynamically in other menu...
looking any help regarding this.
Thanks
1 1543
Hi.,
I found one the method to close a window..
Let me know if anyother method available.
Thanks,
Sabarish
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Kevin Partin |
last post by:
I am creating HTML documents that have the same structure as shown
below. As a convenience to the user, I wanted to simply put a button
on the bottom of the page to close the window. However, since...
|
by: Stromboli |
last post by:
hi people,
My problem is that I need to build a dynamic menu (preferably that
works in all the browsers) that appears when I mouseover a certain
link.
The problem is that I have to declare...
|
by: ThunderMusic |
last post by:
Hi,
I'm trying to have a MSN Messenger like form/app closing behavior. When I
click on the X button, I only want the form to disappear and when I
double-click on the notify icon or right-click...
|
by: nick_faye |
last post by:
Hi,
I am still a newbie to VB and using MS Access 2000. I am currently
trying to provide a preview of reports before printing them. My
program is simple:
AC.DoCmd.OpenReport "MyReport",...
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the...
|
by: Tom |
last post by:
How is the best way to avoid validation when closing a
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then...
|
by: lstuyck73 |
last post by:
Hi there,
I use a menu control that is bound to a sitemap to display menu items,
no problems there.
I now have one menu item that needs to open an url in a new window,
and I have to...
|
by: omerbutt |
last post by:
hi all,
i have a menu based on <ul> and <li> it is working fine on mozilla all versions IE 6 and 7 all versions and google chrome ver 2.0.172.31 , the only problem is occuring is with the IE8 here...
|
by: omerbutt |
last post by:
hi every one i have a menu li and ul based the problem is when any specific category in the li is hovered the li or the sub-cat items appear but as i move my mouse over the sub-cat or level two li it...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |