Ok - this might be a simple solution:)
Comment out the line "$mainwindow -> {-dialogui} = 1;" and it works...
I dont know what this option does, so I'm not sure it this would be a good
solution for you.
Cheers,
jez.
----- Original Message -----
From: [EMAIL PROTECTED]
To: Jez White
Cc: [email protected]
Sent: Wednesday, May 11, 2005 4:31 PM
Subject: Re: [perl-win32-gui-users] Button and RichEdit issues
Thank you for your replies.
I tried the DESTROY solution and it did indeed work, so thank you very much
:)
As far as the button hang goes, the below code has the same problems,
however, when you remove the StatusBar it doesnt. Its very odd and i'm not
sure how to go about debugging it. I tried to remove the StatusBar from my
main program, but that did not solve the issue, so I dont think it has to do
with the StatusBar, but something is obviously tripping it up there.
The reason I use TabFrame is because I am familiar with it, and because I
cannot find any examples on how to work with TabStrip (for example, I created a
TabStrip script, but could not figure out how to add widgets to it). I did
find one example by searching the mailing list for "AddTabStrip", however from
the example it looks like I have to hide each individual widget when changing
tabs. Is this correct? I must confess though, I have spent very little time
looking for TabStrip code, so I may be missing something entirely :)
Anyway, if anyone has any suggestions as to what may be causing my problems,
or how I could go about debugging it, they would be greatly appreciated.
Thanks for all the help.
Len
--------------------------[ Begin Code ]-------------------------------
use strict;
use warnings;
use Win32::GUI;
use Win32::GUI::TabFrame;
my $mainwindow;
create_mainwindow();
$mainwindow -> Show;
Win32::GUI::Dialog();
sub create_mainwindow {
my $windowheight = 400;
my $windowwidth = 700;
my $windowmenu;
$windowmenu = Win32::GUI::MakeMenu (
"Item &1" => "",
" > SubItem &1" =>
"Item1SubItem1",
" > SubItem &2" =>
"Item1SubItem2",
" > SubItem &3" =>
"Item1SubItem3",
" > -" => 0,
" > E&xit" => "AppExit",
"Item &2" => "",
" > SubItem &1" =>
"Item2SubItem1",
);
$mainwindow = Win32::GUI::Window -> new (
-name => "Main",
-width => $windowwidth,
-height => $windowheight,
-title => "Main Window",
-menu => $windowmenu,
);
$mainwindow -> AddStatusBar (
-name => "StatusBar"
);
$mainwindow -> AddTabFrame (
-name => "TabFrame",
-panel => "TabPage",
-tabstop => 1,
);
$mainwindow -> TabFrame -> InsertItem (
-text => "Tab1",
-border => 1,
);
$mainwindow -> TabFrame -> InsertItem (
-text => "Tab2",
-border => 1,
);
$mainwindow -> TabFrame -> TabPage1 -> AddListView (
-name => "ListView1",
-style => WS_CHILD | WS_VISIBLE | WS_VSCROLL | 1,
-fullrowselect => 1,
);
$mainwindow -> TabFrame -> TabPage1 -> ListView1 -> InsertColumn (
-index => 0,
-width => 220,
-text => "Column 1",
);
$mainwindow -> TabFrame -> TabPage1 -> ListView1 -> InsertColumn (
-index => 1,
-width => 220,
-text => "Column 2",
);
$mainwindow -> TabFrame -> TabPage1 -> AddButton (
-name => "Button1",
-text => "Button 1",
-default => 1,
-tabstop => 1,
);
$mainwindow -> TabFrame -> TabPage1 -> AddButton (
-name => "Button2",
-text => "Button 2",
-tabstop => 1,
);
$mainwindow -> {-dialogui} = 1;
}
sub Button1_Click {
print "DEBUG - Button 1 was Clicked\n";
}
sub Button2_Click {
print "DEBUG - Button 2 was Clicked\n";
}
sub AppExit_Click {
Main_Terminate();
}
sub Main_Terminate {
$mainwindow -> Hide();
exit 0;
}
sub Main_Resize {
my $windowheight = $mainwindow -> ScaleHeight();
my $windowwidth = $mainwindow -> ScaleWidth();
my $statusbar_height = $mainwindow -> StatusBar -> Height();
$mainwindow -> TabFrame -> Move (0, 0);
$mainwindow -> TabFrame -> Resize ($windowwidth, $windowheight -
$statusbar_height);
$mainwindow -> TabFrame -> TabPage1 -> ListView1 -> Move (0, 0);
$mainwindow -> TabFrame -> TabPage1 -> ListView1 -> Resize
($mainwindow -> TabFrame -> TabPage1 -> ScaleWidth, $mainwindow -> TabFrame ->
TabPage1 -> ScaleHeight - 40 );
$mainwindow -> TabFrame -> TabPage1 -> Button1 -> Move ($mainwindow
-> TabFrame -> TabPage1 -> ScaleWidth / 2 - 70, $mainwindow -> TabFrame ->
TabPage1 -> ScaleHeight - 30);
$mainwindow -> TabFrame -> TabPage1 -> Button2 -> Move ($mainwindow
-> TabFrame -> TabPage1 -> ScaleWidth / 2 , $mainwindow -> TabFrame -> TabPage1
-> ScaleHeight - 30);
$mainwindow -> StatusBar -> Move (0, $windowheight - $mainwindow ->
StatusBar -> Height);
$mainwindow -> StatusBar -> Resize ($windowwidth, $mainwindow ->
StatusBar -> Height);
}
--------------------------[ End Code ]-------------------------------
"Jez White" <[EMAIL PROTECTED]>
05/11/2005 03:24 AM
To [email protected], [EMAIL PROTECTED]
cc
Subject Re: [perl-win32-gui-users] Button and RichEdit issues
Ok - Ariel's solution (calling DESTROY) on the richedit controls before exit
solves the crash for your example:)
I must admit I'm a bit stumped at the button hang - I was able to reproduce
it. It must be something to do with TabFrame (probably a scoping issue) since
if the buttons are created directly on the tab strip they work fine. I'm not to
sure what to suggest - other than don't use the TabFrame package:)
Cheers,
jez.
------------------------------------------------------------------------------
Electronic Privacy Notice. This e-mail, and any attachments, contains
information that is, or may be, covered by electronic communications privacy
laws, and is also confidential and proprietary in nature. If you are not the
intended recipient, please be advised that you are legally prohibited from
retaining, using, copying, distributing, or otherwise disclosing this
information in any manner. Instead, please reply to the sender that you have
received this communication in error, and then immediately delete it. Thank you
in advance for your cooperation.
==============================================================================