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 1566
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 the
window is not created by a script, the onclick command does not work.
These files are simply meant to be clicked on by the user and
displayed in their browser of choice. Any suggestions?
Kevin Partin
<!DOCTYPE HTML PUBLIC "-//W3C//DTD...
|
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 the menu content in the same
part of the page where the menu goes (BODY). The content of the page
is generated dynamically so I can't put the menu content it on the
headers.
|
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 on it and choose Open from
the context menu, I want the form to reappear. For that, I got the point
covered. Even when the form is minimize, the behavior is like MSN Messenger.
But one problem arose. When I close the form (the first time), it...
|
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", acViewPreview
AC.Visible = True
AC.DoCmd.ShowToolbar "Print Preview", acToolbarNo
AC.DoCmd.ShowToolbar "Menu Bar", acToolbarNo
|
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 application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
| |
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 and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means...
|
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 dynamically add some querystring value to that URL. So I
need the menu item to do something like
window.open("http://newurl/page.aspx?value=5");
|
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 is the link ,or you can see the attachment with of the screen grab.
HERE IS THE CODE FOR THAT MENU
.suckerdiv ul{
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
margin-left: 0px;
margin-right:0px;
margin-top:0px;
|
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 disappears can any one help in this
here is the link you can watch the left menu here link
here is the code
var menuids= //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length;...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |