[perl-win32-gui-users] crashes...

2002-07-01 Thread Chris Ingrassia
If anyone could offer any insight here, it would be greatly 
aprpecaited.  I
have been struggling with Win32::GUI for a few days now, and I keep running
into the same problem.  Using ActivePerl (the latest build, I can't remember
the build number off the top of my head) inside a Windows Script Host
environment, the host application consistently crashes every single time I
return -1 from an event handler to terminate the message loop.  It seems
like as soon as the message loop exits, somebody, somewhere, tries to do
some cleanup and dereferences a null pointer somewhere along the line.
That's a best-guess on my part, as the host application is SoftQuad XMetaL
3, and I have no debugging symbols for it, or ActivePerl, and I can't figure
out if it's even possible to attach a debugger to a Win32::GUI app running
in such a fashion.  The only way I can get it to NOT crash is inside the
_Terminate event handler, by calling PostQuitMessage, and then returning 1,
which seems to destroy the window, and the application never crashes.  I can
delay the crash until somebody exits the application by hiding the window(s)
and returning 1 from my event handlers, but all that does is keep the window
handles floating around until the application closes, and then it crashes.
I need to make the windows shut down after a user clicks on certain buttons,
and I just can't seem to do it without making everything crash and burn.
Here are the things I've tried so far:

Calling $Window->PostQuitMessage from inside my button event handlers
Returning -1 from my event handlers
Loading the DestroyWindow function through Win32::API, and then calling it
with the {-handle} of my main window
Calling $Window->DestroyWindow
Calling $Window->PostMessage(WM_QUIT, 0, 0)
   """"   "" WM_DESTROY

And just about every single combination thereof.  I can't track down the
problem much more specifically, but I know it happens when the
Win32::GUI::Dialog loop terminates, and I know it crashes inside of
Perl56.dll somewhere.  I think a lot of it just has to do with the fact that
were I not running in a somewhat persistent Windows Script Host environment,
more garbage collection would be done by perl, but since I can't force a
reload of the scripting environment, I'm kind of stuck... I've also tried
everything I could think of to trick perl into running a garbage collection
pass on my windows, but they all ended up with the application crashing at
one point or another.

  If I can't get this to work, I'll be forced to use Visual Studio, and I
_REALLY_ don't want to :) So if anyone has had any similar problems, or has
any ideas, I'd really love to hear them.

Thanks,

Chris




RE: [perl-win32-gui-users] crashes...

2002-07-01 Thread Piske, Harald
Win32-GUI Versions 0.558 and 0.665 are totally different, the latter being a
thorough rework. If you use one, try the other to see if it helps.

I've made a post the other day about GUI crashing when I use DoEvents() -
like you, I could only do some magic to shift the crash to a different
point. What seemed to help: putting something into $_ (without using local).
Maybe there IS an issue with garcol as you suggest because at the point
where I experienced crashes, the $_ from the caller usually held a reference
to a complex struct, so doing $_=0 must have caused some cleanups.

Here's something you might not like: I've tested the crashy script under
GUI558 and 665, Win2k and 98, Perl618 and 631 and many combinations of those
and the crash doesn't seem to care.

Here's another idea you might not like: when I came to a dead end in another
project (not due to GUI crashing, but because it fails with some graphics
elements under 98), I switched to Tk. Sometimes, depending on the project,
personal taste and probably moonlight, it beats VB and if you already have
the core functionality in Perl, it may be worth the effort of picking up Tk,
if you're not yet familiar with it. Its most commonly used window manager
('pack') is less like GUI and more like Java in that it arranges "floating"
widgets, but there are also ways to use fixed pixel coords.

I'm not too good in Tk myself, I don't know if it comes with all the widgets
of windows (haven't seen combo boxes yet and did not need accelerators). The
trick seems to be NOT to try and make it do exactly what you're used from
GUI but just take what it offers - I found some things a lot easier than
with GUI and some more tricky.

Have fun,
Harald



RE: [perl-win32-gui-users] crashes...

2002-07-01 Thread Chris Ingrassia
Heh... should've mentioned I tried it under two builds of ActivePerl and
v558 and 665 of Win32::GUI :) What I have found is that if I load up
DestroyWindow via Win32::API, and then do an "exit", right afterwards, it
disappears (presumably because the perl environment thinks it's dying, and
cleans up after itself)... but at least in the script host environment I'm
in, calling exit doesn't seem to do much of anything except keep it from
crashing :)

Thanks for the suggestion regarding TK, however, it's very important in
this particular instance that everthing look "Windowsy", my users are very
change-phobic and they'll probably be frightened of anything unfamiliar :)

I'll give the $_ trick a shot and see if it does anything for me.

-chris

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Piske, Harald
Sent: Monday, July 01, 2002 11:21 AM
To: 'Chris Ingrassia'; [email protected]
Subject: RE: [perl-win32-gui-users] crashes...


Win32-GUI Versions 0.558 and 0.665 are totally different, the latter being a
thorough rework. If you use one, try the other to see if it helps.

I've made a post the other day about GUI crashing when I use DoEvents() -
like you, I could only do some magic to shift the crash to a different
point. What seemed to help: putting something into $_ (without using local).
Maybe there IS an issue with garcol as you suggest because at the point
where I experienced crashes, the $_ from the caller usually held a reference
to a complex struct, so doing $_=0 must have caused some cleanups.

Here's something you might not like: I've tested the crashy script under
GUI558 and 665, Win2k and 98, Perl618 and 631 and many combinations of those
and the crash doesn't seem to care.

Here's another idea you might not like: when I came to a dead end in another
project (not due to GUI crashing, but because it fails with some graphics
elements under 98), I switched to Tk. Sometimes, depending on the project,
personal taste and probably moonlight, it beats VB and if you already have
the core functionality in Perl, it may be worth the effort of picking up Tk,
if you're not yet familiar with it. Its most commonly used window manager
('pack') is less like GUI and more like Java in that it arranges "floating"
widgets, but there are also ways to use fixed pixel coords.

I'm not too good in Tk myself, I don't know if it comes with all the widgets
of windows (haven't seen combo boxes yet and did not need accelerators). The
trick seems to be NOT to try and make it do exactly what you're used from
GUI but just take what it offers - I found some things a lot easier than
with GUI and some more tricky.

Have fun,
Harald


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Perl-Win32-GUI-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users




[perl-win32-gui-users] How do I read the information in a textbox?

2002-07-01 Thread Steven Swenson
Ok, This feels like a silly question.  However the documentation I have on 
Win32::Gui does not seem to specify a method by which I can actually read 
the content of a text file.  All select, selectAll do is tell me they are 
successful.  And Change() is called for every character... so I hope 
someone can give me a hand.


--Steve




RE: [perl-win32-gui-users] How do I read the information in a tex tbox?

2002-07-01 Thread Piske, Harald
I'm assuming you want to get the contents of a text field, not text file ...
;-)
There is the Text() method, defined as a general function, i.e. should be
valid for all widgets. It returns all of a field's contents. If you want the
bit that's selected:

($from, $to) = $Main->MyField->Selection()
$selectedText = substr ($Main->MyField->Text(), $from, $to - $from);

I'm not too sure about special cases (what are the values of Selection()
when there is nothing selected, what if the selection includes the very last
character, do you have to adjust the values by one for each crlf etc), but
that's the basic idea.

Have fun,
Harald

> -Original Message-
> From: Steven Swenson [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 01, 2002 15:06
> To: [email protected]
> Subject: [perl-win32-gui-users] How do I read the information in a
> textbox?
> 
> 
> Ok, This feels like a silly question.  However the 
> documentation I have on 
> Win32::Gui does not seem to specify a method by which I can 
> actually read 
> the content of a text file.  All select, selectAll do is tell 
> me they are 
> successful.  And Change() is called for every character... so I hope 
> someone can give me a hand.
> 
> --Steve
> 
> 
> 
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> Perl-Win32-GUI-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> 



RE: [perl-win32-gui-users] How do I recognize that the user has pressed enter inside a text box?

2002-07-01 Thread Steven Swenson
Basically I want the equivalent of the pascal readln or perl $input = 
; from within a textbox.
the Text() method does allow me to gain access to the information entered 
but does not tell me whether the information
was committed to by the user.  I don't want to use a button if I can get 
away with it.


any ideas?

--Steve


At 06:03 PM 7/1/02, you wrote:

Uh-oh ... that's a tricky one as far as I remember. Never did it myself, I
only have dialogs where the user triggers something with a button anyway. If
you want to capture the enter key, I'm afraid you have to go with those very
much not trivial accelerators. There has been a recent posting about them,
if that doesn't help you, you should go back to the list and post a
follow-up question.

cya
Harald

> -Original Message-
> From: Steven Swenson [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 01, 2002 16:03
> To: Piske, Harald
> Subject: RE: [perl-win32-gui-users] How do I read the information in a
> tex tbox?
>
>
> You assumed correctly :).  However, the Text() method doesn't
> appear to
> return either a \r or a \n ... so how do I determine whether
> the user has
> in fact entered the data?
>
> --Steve
>
>
> At 05:14 PM 7/1/02, you wrote:
> >I'm assuming you want to get the contents of a text field,
> not text file ...
> >;-)
> >There is the Text() method, defined as a general function,
> i.e. should be
> >valid for all widgets. It returns all of a field's contents.
> If you want the
> >bit that's selected:
> >
> >($from, $to) = $Main->MyField->Selection()
> >$selectedText = substr ($Main->MyField->Text(), $from, $to - $from);
> >
> >I'm not too sure about special cases (what are the values of
> Selection()
> >when there is nothing selected, what if the selection
> includes the very last
> >character, do you have to adjust the values by one for each
> crlf etc), but
> >that's the basic idea.
> >
> >Have fun,
> >Harald
> >
> > > -Original Message-
> > > From: Steven Swenson [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, July 01, 2002 15:06
> > > To: [email protected]
> > > Subject: [perl-win32-gui-users] How do I read the information in a
> > > textbox?
> > >
> > >
> > > Ok, This feels like a silly question.  However the
> > > documentation I have on
> > > Win32::Gui does not seem to specify a method by which I can
> > > actually read
> > > the content of a text file.  All select, selectAll do is tell
> > > me they are
> > > successful.  And Change() is called for every
> character... so I hope
> > > someone can give me a hand.
> > >
> > > --Steve
> > >
> > >
> > >
> > > ---
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > ___
> > > Perl-Win32-GUI-Users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > >
>





RE: [perl-win32-gui-users] How do I recognize that the user has pressed enter inside a text box?

2002-07-01 Thread Steven Swenson
Basically I want the equivalent of the pascal readln or perl $input = 
; from within a textbox.
the Text() method does allow me to gain access to the information entered 
but does not tell me whether the information
was committed to by the user.  I don't want to use a button if I can get 
away with it.


any ideas?

--Steve


At 06:03 PM 7/1/02, you wrote:

Uh-oh ... that's a tricky one as far as I remember. Never did it myself, I
only have dialogs where the user triggers something with a button anyway. If
you want to capture the enter key, I'm afraid you have to go with those very
much not trivial accelerators. There has been a recent posting about them,
if that doesn't help you, you should go back to the list and post a
follow-up question.

cya
Harald

> -Original Message-
> From: Steven Swenson [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 01, 2002 16:03
> To: Piske, Harald
> Subject: RE: [perl-win32-gui-users] How do I read the information in a
> tex tbox?
>
>
> You assumed correctly :).  However, the Text() method doesn't
> appear to
> return either a \r or a \n ... so how do I determine whether
> the user has
> in fact entered the data?
>
> --Steve
>
>
> At 05:14 PM 7/1/02, you wrote:
> >I'm assuming you want to get the contents of a text field,
> not text file ...
> >;-)
> >There is the Text() method, defined as a general function,
> i.e. should be
> >valid for all widgets. It returns all of a field's contents.
> If you want the
> >bit that's selected:
> >
> >($from, $to) = $Main->MyField->Selection()
> >$selectedText = substr ($Main->MyField->Text(), $from, $to - $from);
> >
> >I'm not too sure about special cases (what are the values of
> Selection()
> >when there is nothing selected, what if the selection
> includes the very last
> >character, do you have to adjust the values by one for each
> crlf etc), but
> >that's the basic idea.
> >
> >Have fun,
> >Harald
> >
> > > -Original Message-
> > > From: Steven Swenson [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, July 01, 2002 15:06
> > > To: [email protected]
> > > Subject: [perl-win32-gui-users] How do I read the information in a
> > > textbox?
> > >
> > >
> > > Ok, This feels like a silly question.  However the
> > > documentation I have on
> > > Win32::Gui does not seem to specify a method by which I can
> > > actually read
> > > the content of a text file.  All select, selectAll do is tell
> > > me they are
> > > successful.  And Change() is called for every
> character... so I hope
> > > someone can give me a hand.
> > >
> > > --Steve
> > >
> > >
> > >
> > > ---
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > ___
> > > Perl-Win32-GUI-Users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > >
>





RE: [perl-win32-gui-users] How do I recognize that the user has pressed enter inside a text box?

2002-07-01 Thread Rogers, John
Hi,
If you specify, -multiline=>1, when you define the textfield, then the 
Change() event occurs when the user presses enter.

My idea is you could search the text string as each character is typed 
and match on "enter".
something like this,

#untested code
sub textfield_Change{my $rtest = 0;
  my $input ='';
  $input=$MW->tf->Text();
  $rtest = $input=~s/\r\n/''/egsm;
  if($rtest){print "User pressed enter, better do somthing
here";
 }
} 


JohnR


> -Original Message-
> From: Steven Swenson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 2 July 2002 10:19 AM
> To: [email protected]
> Subject: RE: [perl-win32-gui-users] How do I recognize that 
> the user has
> pressed enter inside a text box?
> 
> 
> Basically I want the equivalent of the pascal readln or perl $input = 
> ; from within a textbox.
> the Text() method does allow me to gain access to the 
> information entered 
> but does not tell me whether the information
> was committed to by the user.  I don't want to use a button 
> if I can get 
> away with it.
> 
> any ideas?
> 
> --Steve
> 
> 
> At 06:03 PM 7/1/02, you wrote:
> >Uh-oh ... that's a tricky one as far as I remember. Never 
> did it myself, I
> >only have dialogs where the user triggers something with a 
> button anyway. If
> >you want to capture the enter key, I'm afraid you have to go 
> with those very
> >much not trivial accelerators. There has been a recent 
> posting about them,
> >if that doesn't help you, you should go back to the list and post a
> >follow-up question.
> >
> >cya
> >Harald
> >
> > > -Original Message-
> > > From: Steven Swenson [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, July 01, 2002 16:03
> > > To: Piske, Harald
> > > Subject: RE: [perl-win32-gui-users] How do I read the 
> information in a
> > > tex tbox?
> > >
> > >
> > > You assumed correctly :).  However, the Text() method doesn't
> > > appear to
> > > return either a \r or a \n ... so how do I determine whether
> > > the user has
> > > in fact entered the data?
> > >
> > > --Steve
> > >
> > >
> > > At 05:14 PM 7/1/02, you wrote:
> > > >I'm assuming you want to get the contents of a text field,
> > > not text file ...
> > > >;-)
> > > >There is the Text() method, defined as a general function,
> > > i.e. should be
> > > >valid for all widgets. It returns all of a field's contents.
> > > If you want the
> > > >bit that's selected:
> > > >
> > > >($from, $to) = $Main->MyField->Selection()
> > > >$selectedText = substr ($Main->MyField->Text(), $from, 
> $to - $from);
> > > >
> > > >I'm not too sure about special cases (what are the values of
> > > Selection()
> > > >when there is nothing selected, what if the selection
> > > includes the very last
> > > >character, do you have to adjust the values by one for each
> > > crlf etc), but
> > > >that's the basic idea.
> > > >
> > > >Have fun,
> > > >Harald
> > > >
> > > > > -Original Message-
> > > > > From: Steven Swenson 
> [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, July 01, 2002 15:06
> > > > > To: [email protected]
> > > > > Subject: [perl-win32-gui-users] How do I read the 
> information in a
> > > > > textbox?
> > > > >
> > > > >
> > > > > Ok, This feels like a silly question.  However the
> > > > > documentation I have on
> > > > > Win32::Gui does not seem to specify a method by which I can
> > > > > actually read
> > > > > the content of a text file.  All select, selectAll do is tell
> > > > > me they are
> > > > > successful.  And Change() is called for every
> > > character... so I hope
> > > > > someone can give me a hand.
> > > > >
> > > > > --Steve
> > > > >
> > > > >
> > > > >
> > > > > ---
> > > > > This sf.net email is sponsored by:ThinkGeek
> > > > > Welcome to geek heaven.
> > > > > http://thinkgeek.com/sf
> > > > > ___
> > > > > Perl-Win32-GUI-Users mailing list
> > > > > [email protected]
> > > > > 
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > > > >
> > >
> 
> 
> 
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> Perl-Win32-GUI-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> 


## 
Disclaimer 

If this e-mail has been sent to you in error, please notify 
Océ-Australia Limited immediately and delete this e-mail from 
your system. 

Any views expressed in this e-mail are those of the individual 
sender and may not necessarily reflect the views of 
Océ-Australia Limited. 
##



RE: [perl-win32-gui-users] How do I recognize that the user has pressed enter inside a text box?

2002-07-01 Thread Steven Swenson

Thanks Roger,
'-mulitline'  seems to do the trick!  I will have to do some 
cleaning but I think I can get it to work.  I already had a similar test
for Text() to check for return character by character and Text doesn't 
return those characters.


Thanks for your help.

--steve


At 09:02 PM 7/1/02, Rogers, John wrote:

Hi,
If you specify, -multiline=>1, when you define the textfield, then the
Change() event occurs when the user presses enter.

My idea is you could search the text string as each character is typed
and match on "enter".
something like this,

#untested code
sub textfield_Change{my $rtest = 0;
  my $input ='';
  $input=$MW->tf->Text();
  $rtest = $input=~s/\r\n/''/egsm;
  if($rtest){print "User pressed enter, better do somthing
here";
 }
}


JohnR


> -Original Message-
> From: Steven Swenson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 2 July 2002 10:19 AM
> To: [email protected]
> Subject: RE: [perl-win32-gui-users] How do I recognize that
> the user has
> pressed enter inside a text box?
>
>
> Basically I want the equivalent of the pascal readln or perl $input =
> ; from within a textbox.
> the Text() method does allow me to gain access to the
> information entered
> but does not tell me whether the information
> was committed to by the user.  I don't want to use a button
> if I can get
> away with it.
>
> any ideas?
>
> --Steve
>
>
> At 06:03 PM 7/1/02, you wrote:
> >Uh-oh ... that's a tricky one as far as I remember. Never
> did it myself, I
> >only have dialogs where the user triggers something with a
> button anyway. If
> >you want to capture the enter key, I'm afraid you have to go
> with those very
> >much not trivial accelerators. There has been a recent
> posting about them,
> >if that doesn't help you, you should go back to the list and post a
> >follow-up question.
> >
> >cya
> >Harald
> >
> > > -Original Message-
> > > From: Steven Swenson [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, July 01, 2002 16:03
> > > To: Piske, Harald
> > > Subject: RE: [perl-win32-gui-users] How do I read the
> information in a
> > > tex tbox?
> > >
> > >
> > > You assumed correctly :).  However, the Text() method doesn't
> > > appear to
> > > return either a \r or a \n ... so how do I determine whether
> > > the user has
> > > in fact entered the data?
> > >
> > > --Steve
> > >
> > >
> > > At 05:14 PM 7/1/02, you wrote:
> > > >I'm assuming you want to get the contents of a text field,
> > > not text file ...
> > > >;-)
> > > >There is the Text() method, defined as a general function,
> > > i.e. should be
> > > >valid for all widgets. It returns all of a field's contents.
> > > If you want the
> > > >bit that's selected:
> > > >
> > > >($from, $to) = $Main->MyField->Selection()
> > > >$selectedText = substr ($Main->MyField->Text(), $from,
> $to - $from);
> > > >
> > > >I'm not too sure about special cases (what are the values of
> > > Selection()
> > > >when there is nothing selected, what if the selection
> > > includes the very last
> > > >character, do you have to adjust the values by one for each
> > > crlf etc), but
> > > >that's the basic idea.
> > > >
> > > >Have fun,
> > > >Harald
> > > >
> > > > > -Original Message-
> > > > > From: Steven Swenson
> [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, July 01, 2002 15:06
> > > > > To: [email protected]
> > > > > Subject: [perl-win32-gui-users] How do I read the
> information in a
> > > > > textbox?
> > > > >
> > > > >
> > > > > Ok, This feels like a silly question.  However the
> > > > > documentation I have on
> > > > > Win32::Gui does not seem to specify a method by which I can
> > > > > actually read
> > > > > the content of a text file.  All select, selectAll do is tell
> > > > > me they are
> > > > > successful.  And Change() is called for every
> > > character... so I hope
> > > > > someone can give me a hand.
> > > > >
> > > > > --Steve
> > > > >
> > > > >
> > > > >
> > > > > ---
> > > > > This sf.net email is sponsored by:ThinkGeek
> > > > > Welcome to geek heaven.
> > > > > http://thinkgeek.com/sf
> > > > > ___
> > > > > Perl-Win32-GUI-Users mailing list
> > > > > [email protected]
> > > > >
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > > > >
> > >
>
>
>
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> Perl-Win32-GUI-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>


##
Disclaimer

If this e-mail has been sent to you in error, please notify
Océ-