Vertical line spacing and a Win98/WinXP issue

View: New views
5 Messages — Rating Filter:   Alert me  

Parent Message unknown Vertical line spacing and a Win98/WinXP issue

by John Whitney-5 :: Rate this Message:

| View Threaded | Show Only this Message

Question 1)

Anyone know how to get multiple lines in a Win32::GUI::Label to spread out
vertially, so there would be an extra 5 pixels between each line?  Yes, I
could create multiple labels, one for each line, and spread them out an
extra 5 pixels.  But a simple -linespacing => 5 would be nice.  Anything
like this in the Win32::GUI world?  Below is the label I have.

my $window_main_text_label = new Win32::GUI::Label
(
  $window_main ,
  -text       => "Line 1 \n Line 2 \n Line 3 \n Line 4 " ,
  -name       => 'window_settings_option_text_label' ,
  -font       => $font ,
  -pos        => [ 195 , 297 ] ,
  -size       => [ 280 , 100 ]
) ;


Question 2)

With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and
change the -foreground => 0x000000 value just fine to 0x000000 and 0xff0000
on my Win98SE PC.  But on my XP PC the $window_main_cb -> Change
( -foreground => 0xff0000 ) and the initial setting of the -foreground =>
0xff0000 has no effect.  Just always black.  I can change -background colors
on both Win98SE and WinXP platforms fine, but not -foreground.  Any
thoughts?  My solution is to have the radio button or checkbox without any
text, and add a text label near it that I can change the -foreground
and -background, but this is a kludge I would like to avoid.

John Whitney
Utah, USA
john at johnwhitney period com


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Re: Vertical line spacing and a Win98/WinXP issue

by Hulley, Rob (APJ GCC Storage TPM) :: Rate this Message:

| View Threaded | Show Only this Message

You could try the "style" common option parameter.
I think one of them is line-height.

-pushstyle
-pushstyle => NUMBER
Add the specified styles to the window's style mask. This option can be repeated multiple times, or values can be 'or'ed together.




-----Original Message-----
From: John Whitney [mailto:john@...]
Sent: Saturday, 25 September 2010 4:04 PM
To: perl-win32-gui-users@...
Subject: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue

Question 1)

Anyone know how to get multiple lines in a Win32::GUI::Label to spread out vertially, so there would be an extra 5 pixels between each line?  Yes, I could create multiple labels, one for each line, and spread them out an extra 5 pixels.  But a simple -linespacing => 5 would be nice.  Anything like this in the Win32::GUI world?  Below is the label I have.

my $window_main_text_label = new Win32::GUI::Label (
  $window_main ,
  -text       => "Line 1 \n Line 2 \n Line 3 \n Line 4 " ,
  -name       => 'window_settings_option_text_label' ,
  -font       => $font ,
  -pos        => [ 195 , 297 ] ,
  -size       => [ 280 , 100 ]
) ;


Question 2)

With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and change the -foreground => 0x000000 value just fine to 0x000000 and 0xff0000 on my Win98SE PC.  But on my XP PC the $window_main_cb -> Change ( -foreground => 0xff0000 ) and the initial setting of the -foreground =>
0xff0000 has no effect.  Just always black.  I can change -background colors on both Win98SE and WinXP platforms fine, but not -foreground.  Any thoughts?  My solution is to have the radio button or checkbox without any text, and add a text label near it that I can change the -foreground and -background, but this is a kludge I would like to avoid.

John Whitney
Utah, USA
john at johnwhitney period com


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Re: Vertical line spacing and a Win98/WinXP issue

by Kevin Marshall-4 :: Rate this Message:

| View Threaded | Show Only this Message

John,

Question 1:

After looking through the Windows SDK docs, as far as I can tell, labels
don't allow you to set the line spacing of the text. The best I can
think of is to either choose a font with a large line spacing, or you
could create an owner drawn control and draw the text yourself.

Question 2:

After doing a bit of digging, it seems that if you have themes enabled,
the method that Win32::GUI uses to change the background and foreground
colours doesn't work. Depending on the version of Perl that you use, the
themes may be enabled or not. For example, I use ActiveState Perl 5.12.0
which has themes enabled by default. Robert May released a module called
Win32::VisualStyles (it's on CPAN) which you can use to control the
styles applied to your window. Simply disable themes before creating the
checkbox and the foreground and background colors will be applied. Here
is an example:

#!perl
use strict;
use warnings;
use feature qw(:5.12);

use Win32::GUI qw();
use Win32::GUI::Constants qw(CW_USEDEFAULT);
use Win32::VisualStyles qw(:all);

# Enable themes only for window, disable for controls
SetThemeAppProperties(STAP_ALLOW_NONCLIENT);

my $win = Win32::GUI::Window->new(
     -name => 'win',
     -size => [ 320, 240 ],
     -left => CW_USEDEFAULT,
);
$win->AddCheckbox(
     -pos        => [ 5, 5 ],
     -text       => 'Checkbox',
     -foreground => 0x0000ff,
     -background => 0x00ff00,
);
$win->Show();

Win32::GUI::Dialog();

__END__

As an alternative, you could draw the text in the control yourself using
an owner drawn checkbox.

Hope this helps,

Kevin.

> Question 1)
>
> Anyone know how to get multiple lines in a Win32::GUI::Label to spread out
> vertially, so there would be an extra 5 pixels between each line?  Yes, I
> could create multiple labels, one for each line, and spread them out an
> extra 5 pixels.  But a simple -linespacing =>  5 would be nice.  Anything
> like this in the Win32::GUI world?  Below is the label I have.
>
> my $window_main_text_label = new Win32::GUI::Label
> (
>    $window_main ,
>    -text       =>  "Line 1 \n Line 2 \n Line 3 \n Line 4 " ,
>    -name       =>  'window_settings_option_text_label' ,
>    -font       =>  $font ,
>    -pos        =>  [ 195 , 297 ] ,
>    -size       =>  [ 280 , 100 ]
> ) ;
>
>
> Question 2)
>
> With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and
> change the -foreground =>  0x000000 value just fine to 0x000000 and 0xff0000
> on my Win98SE PC.  But on my XP PC the $window_main_cb ->  Change
> ( -foreground =>  0xff0000 ) and the initial setting of the -foreground =>
> 0xff0000 has no effect.  Just always black.  I can change -background colors
> on both Win98SE and WinXP platforms fine, but not -foreground.  Any
> thoughts?  My solution is to have the radio button or checkbox without any
> text, and add a text label near it that I can change the -foreground
> and -background, but this is a kludge I would like to avoid.
>
> John Whitney
> Utah, USA
> john at johnwhitney period com
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@...
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> http://perl-win32-gui.sourceforge.net/
>
>
>    


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Parent Message unknown Re: Vertical line spacing and a Win98/WinXP issue

by Kevin Marshall-4 :: Rate this Message:

| View Threaded | Show Only this Message

John,

Win32::VisualStyles has XS code that calls the underlying Windows
functions. You will either need to compile the module yourself, or you
should be able to install the module using the Perl Package Manager.

Kevin.

> Appreciate the response.
>
> In regard to Question 2, I tried to use your example program to see if problem is solved.  I got VisualStyles.pm file from CPAN and placed it in my c:/perl/site/lib/win32 folder.
>
> Then tried to run your example.  I get...
>
> Can't locate loadable object for module Win32::VisualStyles in @INC (@INC contains: . C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/lib/DynaLoader.pm line 118
> DynaLoader::croak('Can\'t locate loadable object for module Win32::VisualStyles ...') called at C:/Perl/lib/DynaLoader.pm line 196
> DynaLoader::bootstrap('Win32::VisualStyles', 0.02) called at C:/Perl/lib/XSLoader.pm line 111
> XSLoader::bootstrap_inherit('Win32::VisualStyles', 0.02) called at tmp.pl line 39
>
> This is out of my league to understand what I'm missing.  I have perl versions...
>
>     Perl v5.8.8 built for MSWin32-x86-multi-thread
>     Binary build 817 [257965] by ActiveState Mar 20 2006 17:54:25
>     WIN32::GUI version 1.06
>
> Am I missing something?
>
> John
>
>    
>>   -------Original Message-------
>>   From: Kevin Marshall<kejohm88@...>
>>   To: John Whitney<john@...>
>>   Cc: perl-win32-gui-users@...
>>   Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue
>>   Sent: 25 Sep '10 11:43
>>
>>   John,
>>
>>   Question 1:
>>
>>   After looking through the Windows SDK docs, as far as I can tell, labels
>>   don't allow you to set the line spacing of the text. The best I can
>>   think of is to either choose a font with a large line spacing, or you
>>   could create an owner drawn control and draw the text yourself.
>>
>>   Question 2:
>>
>>   After doing a bit of digging, it seems that if you have themes enabled,
>>   the method that Win32::GUI uses to change the background and foreground
>>   colours doesn't work. Depending on the version of Perl that you use, the
>>   themes may be enabled or not. For example, I use ActiveState Perl 5.12.0
>>   which has themes enabled by default. Robert May released a module called
>>   Win32::VisualStyles (it's on CPAN) which you can use to control the
>>   styles applied to your window. Simply disable themes before creating the
>>   checkbox and the foreground and background colors will be applied. Here
>>   is an example:
>>
>>   #!perl
>>   use strict;
>>   use warnings;
>>   use feature qw(:5.12);
>>
>>   use Win32::GUI qw();
>>   use Win32::GUI::Constants qw(CW_USEDEFAULT);
>>   use Win32::VisualStyles qw(:all);
>>
>>   # Enable themes only for window, disable for controls
>>   SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
>>
>>   my $win = Win32::GUI::Window->new(
>>        -name =>  'win',
>>        -size =>  [ 320, 240 ],
>>        -left =>  CW_USEDEFAULT,
>>   );
>>   $win->AddCheckbox(
>>        -pos        =>  [ 5, 5 ],
>>        -text       =>  'Checkbox',
>>        -foreground =>  0x0000ff,
>>        -background =>  0x00ff00,
>>   );
>>   $win->Show();
>>
>>   Win32::GUI::Dialog();
>>
>>   __END__
>>
>>   As an alternative, you could draw the text in the control yourself using
>>   an owner drawn checkbox.
>>
>>   Hope this helps,
>>
>>   Kevin.
>>   >  Question 1)
>>   >
>>   >  Anyone know how to get multiple lines in a Win32::GUI::Label to spread out
>>   >  vertially, so there would be an extra 5 pixels between each line?  Yes, I
>>   >  could create multiple labels, one for each line, and spread them out an
>>   >  extra 5 pixels.  But a simple -linespacing =>   5 would be nice.  Anything
>>   >  like this in the Win32::GUI world?  Below is the label I have.
>>   >
>>   >  my $window_main_text_label = new Win32::GUI::Label
>>   >  (
>>   >     $window_main ,
>>   >     -text       =>   "Line 1 \n Line 2 \n Line 3 \n Line 4 " ,
>>   >     -name       =>   'window_settings_option_text_label' ,
>>   >     -font       =>   $font ,
>>   >     -pos        =>   [ 195 , 297 ] ,
>>   >     -size       =>   [ 280 , 100 ]
>>   >  ) ;
>>   >
>>   >
>>   >  Question 2)
>>   >
>>   >  With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and
>>   >  change the -foreground =>   0x000000 value just fine to 0x000000 and 0xff0000
>>   >  on my Win98SE PC.  But on my XP PC the $window_main_cb ->   Change
>>   >  ( -foreground =>   0xff0000 ) and the initial setting of the -foreground =>
>>   >  0xff0000 has no effect.  Just always black.  I can change -background colors
>>   >  on both Win98SE and WinXP platforms fine, but not -foreground.  Any
>>   >  thoughts?  My solution is to have the radio button or checkbox without any
>>   >  text, and add a text label near it that I can change the -foreground
>>   >  and -background, but this is a kludge I would like to avoid.
>>   >
>>   >  John Whitney
>>   >  Utah, USA
>>   >  john at johnwhitney period com
>>   >
>>   >
>>   >  ------------------------------------------------------------------------------
>>   >  Start uncovering the many advantages of virtual appliances
>>   >  and start using them to simplify application deployment and
>>   >  accelerate your shift to cloud computing.
>>   >  http://p.sf.net/sfu/novell-sfdev2dev
>>   >  _______________________________________________
>>   >  Perl-Win32-GUI-Users mailing list
>>   >  Perl-Win32-GUI-Users@...
>>   >  https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>>   >  http://perl-win32-gui.sourceforge.net/
>>   >
>>   >
>>   >
>>
>>
>>      
>
>    


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Parent Message unknown Re: Vertical line spacing and a Win98/WinXP issue

by Kevin Marshall-4 :: Rate this Message:

| View Threaded | Show Only this Message

John,

It is odd that PPM could not find the module. I tried it on my computer and managed to find it OK. Note that the package would be called Win32-VisualStyles (:: replaced with -). The repository that I use is http://ppm4.activestate.com/MSWin32-x86/5.12/1200/packages.xml, though it would be slightly different for you as you are using a different version of Perl. Try going to the web page http://ppm4.activestate.com/ and browsing for the appropriate repository for your version of Perl. You could also try downloading the package from http://ppm4.activestate.com/MSWin32-x86/5.8/825/R/RO/ROBERTMAY/Win32-VisualStyles/Win32-VisualStyles-0.02.ppmx and installing it yourself using the command line PPM.

Kevin.
Kevin:

Thanks again for your response.

That was the first thing I tried, was to enter PPM and look for it.  But I could not find it under search win32, search visual, or search style.  I was listed lots of packages with win32 visual or style in their name, but I could not find Win32-VisualStyles.  Again I apologize for missing something.  Is it under another name, or just not there?

John Whitney


  
 -------Original Message-------
 From: Kevin Marshall kejohm88@...
 To: john john@...
 Cc: perl-win32-gui-users@...
 Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue
 Sent: 26 Sep '10 11:32
 
 John,
 
 Win32::VisualStyles has XS code that calls the underlying Windows
 functions. You will either need to compile the module yourself, or you
 should be able to install the module using the Perl Package Manager.
 
 Kevin.
 > Appreciate the response.
 >
 > In regard to Question 2, I tried to use your example program to see if problem is solved.  I got VisualStyles.pm file from CPAN and placed it in my c:/perl/site/lib/win32 folder.
 >
 > Then tried to run your example.  I get...
 >
 > Can't locate loadable object for module Win32::VisualStyles in @INC (@INC contains: . C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/lib/DynaLoader.pm line 118
 > 	 DynaLoader::croak('Can\'t locate loadable object for module Win32::VisualStyles ...') called at C:/Perl/lib/DynaLoader.pm line 196
 > 	 DynaLoader::bootstrap('Win32::VisualStyles', 0.02) called at C:/Perl/lib/XSLoader.pm line 111
 > 	 XSLoader::bootstrap_inherit('Win32::VisualStyles', 0.02) called at tmp.pl line 39
 >
 > This is out of my league to understand what I'm missing.  I have perl versions...
 >
 >     Perl v5.8.8 built for MSWin32-x86-multi-thread
 >     Binary build 817 [257965] by ActiveState Mar 20 2006 17:54:25
 >     WIN32::GUI version 1.06
 >
 > Am I missing something?
 >
 > John
 >
 >    
 >>   -------Original Message-------
 >>   From: Kevin Marshallkejohm88@...
 >>   To: John Whitneyjohn@...
 >>   Cc: perl-win32-gui-users@...
 >>   Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue
 >>   Sent: 25 Sep '10 11:43
 >>
 >>   John,
 >>
 >>   Question 1:
 >>
 >>   After looking through the Windows SDK docs, as far as I can tell, labels
 >>   don't allow you to set the line spacing of the text. The best I can
 >>   think of is to either choose a font with a large line spacing, or you
 >>   could create an owner drawn control and draw the text yourself.
 >>
 >>   Question 2:
 >>
 >>   After doing a bit of digging, it seems that if you have themes enabled,
 >>   the method that Win32::GUI uses to change the background and foreground
 >>   colours doesn't work. Depending on the version of Perl that you use, the
 >>   themes may be enabled or not. For example, I use ActiveState Perl 5.12.0
 >>   which has themes enabled by default. Robert May released a module called
 >>   Win32::VisualStyles (it's on CPAN) which you can use to control the
 >>   styles applied to your window. Simply disable themes before creating the
 >>   checkbox and the foreground and background colors will be applied. Here
 >>   is an example:
 >>
 >>   #!perl
 >>   use strict;
 >>   use warnings;
 >>   use feature qw(:5.12);
 >>
 >>   use Win32::GUI qw();
 >>   use Win32::GUI::Constants qw(CW_USEDEFAULT);
 >>   use Win32::VisualStyles qw(:all);
 >>
 >>   # Enable themes only for window, disable for controls
 >>   SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
 >>
 >>   my $win = Win32::GUI::Window->new(
 >>        -name =>  'win',
 >>        -size =>  [ 320, 240 ],
 >>        -left =>  CW_USEDEFAULT,
 >>   );
 >>   $win->AddCheckbox(
 >>        -pos        =>  [ 5, 5 ],
 >>        -text       =>  'Checkbox',
 >>        -foreground =>  0x0000ff,
 >>        -background =>  0x00ff00,
 >>   );
 >>   $win->Show();
 >>
 >>   Win32::GUI::Dialog();
 >>
 >>   __END__
 >>
 >>   As an alternative, you could draw the text in the control yourself using
 >>   an owner drawn checkbox.
 >>
 >>   Hope this helps,
 >>
 >>   Kevin.
 >>   >  Question 1)
 >>   >
 >>   >  Anyone know how to get multiple lines in a Win32::GUI::Label to spread out
 >>   >  vertially, so there would be an extra 5 pixels between each line?  Yes, I
 >>   >  could create multiple labels, one for each line, and spread them out an
 >>   >  extra 5 pixels.  But a simple -linespacing =>   5 would be nice.  Anything
 >>   >  like this in the Win32::GUI world?  Below is the label I have.
 >>   >
 >>   >  my $window_main_text_label = new Win32::GUI::Label
 >>   >  (
 >>   >     $window_main ,
 >>   >     -text       =>   "Line 1 \n Line 2 \n Line 3 \n Line 4 " ,
 >>   >     -name       =>   'window_settings_option_text_label' ,
 >>   >     -font       =>   $font ,
 >>   >     -pos        =>   [ 195 , 297 ] ,
 >>   >     -size       =>   [ 280 , 100 ]
 >>   >  ) ;
 >>   >
 >>   >
 >>   >  Question 2)
 >>   >
 >>   >  With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and
 >>   >  change the -foreground =>   0x000000 value just fine to 0x000000 and 0xff0000
 >>   >  on my Win98SE PC.  But on my XP PC the $window_main_cb ->   Change
 >>   >  ( -foreground =>   0xff0000 ) and the initial setting of the -foreground =>
 >>   >  0xff0000 has no effect.  Just always black.  I can change -background colors
 >>   >  on both Win98SE and WinXP platforms fine, but not -foreground.  Any
 >>   >  thoughts?  My solution is to have the radio button or checkbox without any
 >>   >  text, and add a text label near it that I can change the -foreground
 >>   >  and -background, but this is a kludge I would like to avoid.
 >>   >
 >>   >  John Whitney
 >>   >  Utah, USA
 >>   >  john at johnwhitney period com
 >>   >
 >>   >
 >>   >  ------------------------------------------------------------------------------
 >>   >  Start uncovering the many advantages of virtual appliances
 >>   >  and start using them to simplify application deployment and
 >>   >  accelerate your shift to cloud computing.
 >>   >  http://p.sf.net/sfu/novell-sfdev2dev
 >>   >  _______________________________________________
 >>   >  Perl-Win32-GUI-Users mailing list
 >>   >  Perl-Win32-GUI-Users@...
 >>   >  https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
 >>   >  http://perl-win32-gui.sourceforge.net/
 >>   >
 >>   >
 >>   >
 >>
 >>
 >>      
 >
 >    
 
 
    

  


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/