[perl-win32-gui-users] Win32::GUI::DIBitmap version 0.5

2002-01-20 Thread Laurent ROCHER
Hello,

I have release a new version of Win32::GUI::DIBitmap.

This module add :
- new image format for loading and writing (JPEG,PNG,TIFF,...).
- Convertion function
- Display function (Copy / Stretch, aplha channel support)
- Screen/Window capture
It's use FreeImage 2.5.0 library.

See more at : http://perso.club-internet.fr/rocherl/Win32GUI.html
(documentation, source code + sample, ppm package for ActivePerl 5.005 &
5.6)

Laurent ROCHER




[perl-win32-gui-users] win32:gui in a subroutine

2002-01-20 Thread Pete
my $Win = new Win32::GUI::Window(
   -left   => 276,
   -top=> 365,
   -width  => 580,
   -height => 361,
   -name   => "Win",
   -text   => "Single Runner"
   );
   
 my $Bad_Results = new Win32::GUI::Window(
   -left   => 460,
   -top=> 372,
   -width  => 300,
   -height => 300,
   -name   => "Results",
   -text   => "Results"
   );
 
 $Win->AddButton(
-text=> "Push Me!!",
-name=> "Button_1",
-left=> 200, 
-top => $Row,
-width   => 150,
-height  => 23,
-foreground=> 0,
   );  

  sub Button_1_Click 
  { $Bad_Results->Show();}

The eror message is of the following
 
Variable "$Bad_Results" will not stay shared at rts_gui.pm line 435 (#1)
(W closure) An inner (nested) named subroutine is referencing a
lexical variable defined in an outer subroutine.
 
When the inner subroutine is called, it will probably see the value of
the outer subroutine's variable as it was before and during the *first*
call to the outer subroutine; in this case, after the first call to the
outer subroutine is complete, the inner and outer subroutines will no
longer share a common value for the variable.  In other words, the
variable will no longer be shared.
 
Furthermore, if the outer subroutine is anonymous and references a
lexical variable outside itself, then the outer and inner subroutines
will never share the given variable.
 
This problem can usually be solved by making the inner subroutine
anonymous, using the sub {} syntax.  When inner anonymous subs that
reference variables in outer subroutines are called or referenced, they
are automatically rebound to the current values of such variables.
 



[perl-win32-gui-users] perl-win32-gui-users win32:gui in a subroutine

2002-01-20 Thread Pete
I'm trying to get a routine running as either a subroutine or more ideally
an object(using strict and diagnostic). It works fine if it  is all in the
main body but once I put it in  a subroutine It generates errors when trying
to access the subroutine called from the "button Click" subroutine. So far I
can't see any way round this. I have include an extract below. Thanks in
advance.

my $Win = new Win32::GUI::Window(
   -left   => 276,
   -top=> 365,
   -width  => 580,
   -height => 361,
   -name   => "Win",
   -text   => "Single Runner"
   );

 my $Bad_Results = new Win32::GUI::Window(
   -left   => 460,
   -top=> 372,
   -width  => 300,
   -height => 300,
   -name   => "Results",
   -text   => "Results"
   );

 $Win->AddButton(
-text=> "Push Me!!",
-name=> "Button_1",
-left=> 200,
-top => $Row,
-width   => 150,
-height  => 23,
-foreground=> 0,
   );

  sub Button_1_Click
  { $Bad_Results->Show();}

The eror message is of the following

Variable "$Bad_Results" will not stay shared at rts_gui.pm line 435 (#1)
(W closure) An inner (nested) named subroutine is referencing a
lexical variable defined in an outer subroutine.

When the inner subroutine is called, it will probably see the value of
the outer subroutine's variable as it was before and during the *first*
call to the outer subroutine; in this case, after the first call to the
outer subroutine is complete, the inner and outer subroutines will no
longer share a common value for the variable.  In other words, the
variable will no longer be shared.

Furthermore, if the outer subroutine is anonymous and references a
lexical variable outside itself, then the outer and inner subroutines
will never share the given variable.

This problem can usually be solved by making the inner subroutine
anonymous, using the sub {} syntax.  When inner anonymous subs that
reference variables in outer subroutines are called or referenced, they
are automatically rebound to the current values of such variables.


___
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users




Re: [perl-win32-gui-users] perl-win32-gui-users win32:gui in a subroutine

2002-01-20 Thread Jeremy Blonde
I'm not quite understanding what you are asking here Pete.  Are you simply
saying that you want the "$Bad_Results" window to appear every time you
click "Button_1"?

If so, then create the "$Bad_Results" window inside of the "Button_1_Click"
subroutine.  If you place "my $Bad_Results;" outside of that subroutine,
then the window object will be available to other subroutines, after it has
been created.

When you create the window outside of the subroutine, display it, and then
close it, you've just destroyed the window (by calling the default
_Terminate subroutine).  Once the object is destroyed, you obviously can't
call it's methods anymore which is why "$Bad_Results->Show();" stopped
working.

I may be way off in what you are asking here, so correct me if I'm wrong.

jb
- Original Message -
From: "Pete" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; 
Sent: Sunday, January 20, 2002 9:56 AM
Subject: [perl-win32-gui-users] perl-win32-gui-users win32:gui in a
subroutine


> I'm trying to get a routine running as either a subroutine or more ideally
> an object(using strict and diagnostic). It works fine if it  is all in the
> main body but once I put it in  a subroutine It generates errors when
trying
> to access the subroutine called from the "button Click" subroutine. So far
I
> can't see any way round this. I have include an extract below. Thanks in
> advance.
>
> my $Win = new Win32::GUI::Window(
>-left   => 276,
>-top=> 365,
>-width  => 580,
>-height => 361,
>-name   => "Win",
>-text   => "Single Runner"
>);
>
>  my $Bad_Results = new Win32::GUI::Window(
>-left   => 460,
>-top=> 372,
>-width  => 300,
>-height => 300,
>-name   => "Results",
>-text   => "Results"
>);
>
>  $Win->AddButton(
> -text=> "Push Me!!",
> -name=> "Button_1",
> -left=> 200,
> -top => $Row,
> -width   => 150,
> -height  => 23,
> -foreground=> 0,
>);
>
>   sub Button_1_Click
>   { $Bad_Results->Show();}
>
> The eror message is of the following
>
> Variable "$Bad_Results" will not stay shared at rts_gui.pm line 435 (#1)
> (W closure) An inner (nested) named subroutine is referencing a
> lexical variable defined in an outer subroutine.
>
> When the inner subroutine is called, it will probably see the value of
> the outer subroutine's variable as it was before and during the
*first*
> call to the outer subroutine; in this case, after the first call to
the
> outer subroutine is complete, the inner and outer subroutines will no
> longer share a common value for the variable.  In other words, the
> variable will no longer be shared.
>
> Furthermore, if the outer subroutine is anonymous and references a
> lexical variable outside itself, then the outer and inner subroutines
> will never share the given variable.
>
> This problem can usually be solved by making the inner subroutine
> anonymous, using the sub {} syntax.  When inner anonymous subs that
> reference variables in outer subroutines are called or referenced,
they
> are automatically rebound to the current values of such variables.
>
>
> ___
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>
>
> ___
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: [perl-win32-gui-users] wrapping label text

2002-01-20 Thread Johan Lindstrom

Haven't seen any response to this one yet so here goes...

At 16:19 2002-01-18 -0800, ed wrote:

I want to put a label on my window after the user
opens up a file to edit.
It's a long string of text, it's the full path to the
file.
The label displays, but if it's too long it just runs
until it gets cut off
by the right border of the main window.
I've been searching docs and email archives and can't
seem to find the solution.
I don't know if it matters, but I add the label from
the sub that handles the opening
of the file.


Two things.

First, I would suggest you build the entire window at once (including the 
Label for the path), then you can modify the contents as you go along. Do 
that like this:


$main->current_file_label()->Text("Currently editing file: $OPENED_FILE . ")


Second, I think your problem is that you assign the label a location, but 
not a size. So although you have correctly set the option -wrap => 1, maybe 
the label itself runs off the edge of the window. Set the label -width and 
-height options as well.



/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: "What does efficient mean!"






Re: [perl-win32-gui-users] perl-win32-gui-users win32:gui in a subroutine

2002-01-20 Thread Johan Lindstrom

At 17:56 2002-01-20 +, Pete wrote:

I'm trying to get a routine running as either a subroutine or more ideally
an object(using strict and diagnostic). It works fine if it  is all in the
main body but once I put it in  a subroutine It generates errors when trying
to access the subroutine called from the "button Click" subroutine. So far I
can't see any way round this. I have include an extract below. Thanks in
advance.


I think I see what you are trying to do, but please post the entire piece 
of code to clarify the situation.


Basically, the problem with Win32::GUI event handlers is that there is no 
context (i.e. an object) passed to them when the event is fired. So you 
need to keep track of the Win32::GUI object yourself. The easiest way to do 
that is in a global var of some sort. If you think that sucks/is poor form, 
well yes you're right. Deal with it :)



Also, since it looks like you're using modules it might be good know that 
event handlers are (almost) always located in package main. Consider this code:



package MyMod;

#This will never be called
sub winMain_Terminate {
return(-1);
}

#This will be called
sub main::winMain_Terminate {
return(-1);
}

#This is the same as package main
sub ::winMain_Terminate {
return(-1);
}


If you want to put a window/control in another package, set the -name 
option like this:


-name => "MyModule::ControlName"

But that makes accessing the control a bit difficult (but not impossible).


/J

 --  --- -- --  --  -- -  - -
Johan LindströmSourcerer @ Boss Casinos [EMAIL PROTECTED]

Latest bookmark: "What does efficient mean!"






[perl-win32-gui-users] win32:gui as a subroutine

2002-01-20 Thread Pete
I'm trying to get a routine running as either a subroutine or more ideally
an object(using strict and diagnostic). It works fine if it  is all in the
main body but once I put it in  a subroutine It generates errors when trying
to access the subroutine called from the "button Click" subroutine. So far I
can't see any way round this. I have include an extract below. Thanks in
advance.

my $Win = new Win32::GUI::Window(
   -left   => 276,
   -top=> 365,
   -width  => 580,
   -height => 361,
   -name   => "Win",
   -text   => "Single Runner"
   );

 my $Bad_Results = new Win32::GUI::Window(
   -left   => 460,
   -top=> 372,
   -width  => 300,
   -height => 300,
   -name   => "Results",
   -text   => "Results"
   );

 $Win->AddButton(
-text=> "Push Me!!",
-name=> "Button_1",
-left=> 200,
-top => $Row,
-width   => 150,
-height  => 23,
-foreground=> 0,
   );

  sub Button_1_Click
  { $Bad_Results->Show();}

The eror message is of the following

Variable "$Bad_Results" will not stay shared at rts_gui.pm line 435 (#1)
(W closure) An inner (nested) named subroutine is referencing a
lexical variable defined in an outer subroutine.

When the inner subroutine is called, it will probably see the value of
the outer subroutine's variable as it was before and during the *first*
call to the outer subroutine; in this case, after the first call to the
outer subroutine is complete, the inner and outer subroutines will no
longer share a common value for the variable.  In other words, the
variable will no longer be shared.

Furthermore, if the outer subroutine is anonymous and references a
lexical variable outside itself, then the outer and inner subroutines
will never share the given variable.

This problem can usually be solved by making the inner subroutine
anonymous, using the sub {} syntax.  When inner anonymous subs that
reference variables in outer subroutines are called or referenced, they
are automatically rebound to the current values of such variables.