Re: TK: button with multiple font sizes

2013-03-12 Thread Jack
On 12/03/2013 7:56 PM, Daniel Burgaud wrote:
> Hi
>
> I need a button with a big label and below it, description of the button.
>
> I dont know how to make a TK button with multiple font size.
> If not button, any TK object, clickable, and multiple font size capable.
use Tk;
use strict;

my $mw = tkinit;
my $bigfont = $mw->fontCreate('bigfont',
-family=>'arial',
-weight=>'bold',
-size=>48);
$mw->Button(-text=>'Big Text', -font=>'bigfont')->pack;
$mw->Label(-text=>'Click on the button above')->pack;
MainLoop;

HTH
Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Help with Win32::GUI

2012-09-07 Thread Jack
On 07/09/2012 12:48 PM, Barry Brevik wrote:
> I am lost with this simple app, and I hope I am posting to the correct
> list; the Sourceforge list appears to dead.
>
> Anyway, the problem is with the event model (I guess). I have 2 fields
> and all I want is when the user presses ENTER or TAB in the first field,
> I want to capture the text, and have the focus move to the next field. I
> have Change set for the fields, which is alright, but I fail to see how
> I can capture the RETURN or TAB key. Annoyingly, the LostFocus event
> fires every time a key is pressed, which makes no sense to me.
>
> Below is my simplified code which displays the action. I'm sorry that it
> is about 90 lines in length. Can anyone help?

It seems that the dialogui will overwrite the Enter key binding. Also it 
depends on whether the Textfield is multiline or not.

So. you can roll your own key checking into these boxes. The revised 
code is below.

I have bound Enter in the username to go to the password box. I have 
bound Enter in the password box to show the username and password in a 
label...

##
use strict;
use warnings;
use Win32;
use Win32::GUI();
use Win32::GUI::Constants qw(VK_RETURN VK_TAB);

my $main = Win32::GUI::Window -> new
(
   -name   => 'Main',
   -title  => 'Test v0.1',
   -width  => 430,
   -height => 200
);

my $monoinput = Win32::GUI::Font -> new(-name => 'Consolas', -size =>
10, -bold => 0, -italic => 0);
my $monolabel = Win32::GUI::Font -> new(-name => 'Consolas', -size =>
10, -bold => 1, -italic => 0);

my $userlabel = $main -> AddLabel
(
   -font => $monolabel,
   -pos  => [10, 22],
   -text => 'username:',
   -foreground => 0xff
);

# Create a text input field.
my $userfield = $main -> AddTextfield
(
   -eventmodel   => "byname",
   -name => "username",
   -align=> "left",
   -pos  => [96, 20],
   -size => [100, 24],
   -width=> 100,
   -height   => 20,
   -password => 0,
   -passwordChar => chr(249),
   -background   => 0xff,
   -font => $monoinput,
   -text => '',
);

my $passlabel = $main -> AddLabel
(
   -font => $monolabel,
   -pos  => [10, 64],
   -text => 'password:',
   -foreground => 0xff
);

# Create a text input field.
my $passfield = $main -> AddTextfield
(
   -eventmodel   => "byname",
   -name => "password",
   -align=> "left",
   -tabstop  => 1,
   -pos  => [96, 60],
   -size => [100, 24],
   -password => 1,
   -passwordChar => chr(249),
   -background   => 0xff,
   -font => $monoinput,
   -text => '',
  # -dialogui => 1  # Enable keyboard navigation like DialogBox
);
my $resultLabel = $main -> AddLabel
(
   -font => $monolabel,
   -pos  => [10, 100],
   -text => ' ',
   -wrap => 0,
   -width => 400,
   -foreground => 0x00,
   -background => 0xff
);

$userfield -> MaxLength(16);
$passfield -> MaxLength(16);

$userfield -> SetFocus();
$main -> Show();
Win32::GUI::Dialog();

exit(0);

#--
sub password_KeyDown {
 my($flags,$key) = @_;
 if($key == VK_RETURN){
 my $string = "Username: ". $userfield->Text(). " Password: ". 
$passfield->Text();
 $resultLabel->Change(-text=>$string);
 }
 elsif ($key == VK_TAB) {
 $userfield ->SelectAll();
 $userfield ->SetFocus();
 }
 return 1;
}
#--
sub username_KeyDown {
 my($flags,$key) = @_;
 if($key == VK_RETURN or $key == VK_TAB){
 $passfield ->SelectAll();
 $passfield ->SetFocus();
 }
 return 1;
}
#--
sub Main_Terminate {-1;}



Jack D.
>
> Thank you,
>
> Barry Brevik
> ---
> use strict;
> use warnings;
> use Win32;
> use Win32::GUI();
>
> my $main = Win32::GUI::Window -> new
> (
>-name   => 'Main',
>-title  => 'Test v0.1',
>-width  => 400,
>-height => 200
> );
>
> my $monoinput = Win32::GUI::Font -> new(-name => 'Consolas', -size =>
> 10, -bold => 0, -italic => 0);
> my $monolabel = Win32::GUI::Font -> new(-name => 'Consolas', -size =>
> 10, -bold => 1, -italic => 0);
>
> my $userlabel = $main -> AddLabel
> (
>-font => $monolabel,

RE: Need help with TK: scrollable adjustable columns of text

2010-08-21 Thread Jack

 
___

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Daniel Burgaud
Sent: August-18-10 9:19 PM
To: Perl-Win32-Users
Subject: Need help with TK: scrollable adjustable columns of text


hi

I am trying to write a TK application that will display a scrolled text 
with adjustable columns similar to the PPM's display.

currently, what I have researched is using pannedwindow.
however this is good for simple labels wherein one side isnt
sync to the other.

What i need is scrolledtext + adjustable columns.

Dan



Try Tk-MListBox

Screenshot on Unix:
http://cpansearch.perl.org/src/RCS/Tk-MListbox-1.11/docs/MListbox/tutorial.h
tml

On CPAN:
http://search.cpan.org/dist/Tk-MListbox/

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: CPAN Problem in Debian

2010-03-11 Thread Jack
This is a Win-32 group.
 
That said --- I would assume that you have to re-install all your modules
from scratch.
 
/usr/bin/perl -MCPAN -e shell (where perl leads to your 5.10 binary - not
your 5.8.8)
 
Better yet - find a good debian repository that houses dot-deb packages of
all the perl modules. Use apt-get to install.
 
 

  _  

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
jens.altr...@stadt-nw.de
Sent: March-11-10 6:13 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: AW: CPAN Problem in Debian



Ok first problem solved… but it seems to connect tot he perl 5.8.8
installation, and checking the  modules in there, and I have seen no chance
how to clear that or reinstall all modules I have… any help appreciated

 

Von: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] Im Auftrag von
jens.altr...@stadt-nw.de
Gesendet: Donnerstag, 11. März 2010 11:14
An: perl-win32-users@listserv.ActiveState.com
Betreff: CPAN Problem in Debian

 

Hi,

 

After Updating my Perl to 5.10.0-19lenny2 I can’t access CPAN anymore,
getting the following error:

 

perl: error while loading shared libraries: libssp.so.0: cannot open shared
object file: No such file or directory

 

Anyone can help me?

 

Regards,

 

Jens

 


###
Wichtiger Hinweis
Für die rechtsverbindliche elektronische Kommunikation mit der
Stadtverwaltung Neustadt an der Weinstraße steht Ihnen ausschließlich
folgende E-Mail-Adresse zur Verfügung:
stv-neustadt-weinstra...@poststelle.rlp.de
Bitte beachten Sie unsere Hinweise unter
http://www.neustadt.eu/impressum#email


###
Wichtiger Hinweis
Für die rechtsverbindliche elektronische Kommunikation mit der
Stadtverwaltung Neustadt an der Weinstraße steht Ihnen ausschließlich
folgende E-Mail-Adresse zur Verfügung:
stv-neustadt-weinstra...@poststelle.rlp.de
Bitte beachten Sie unsere Hinweise unter
http://www.neustadt.eu/impressum#email 

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.733 / Virus Database: 271.1.1/2735 - Release Date: 03/10/10
12:33:00


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: I haven't seen any traffic on this list for two weeks

2009-12-31 Thread Jack
Maybe everybody bought a Mac for Xmas 

Jack

-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
jeffg
Sent: December-31-09 5:00 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Re: I haven't seen any traffic on this list for two weeks

On 09-12-31 03:34 PM, Ken Fox wrote:
> Has the list had a problem? I have not seen anything since 12/18/2009

That is the last message I see as well; I am not aware of any systems 
issues, so I suspect it has just been pretty quiet.

cheers, Jeff
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Strange Perl/Tk action

2009-10-25 Thread Jack
Ok. I get it now. First off - sorry for the top post. It's just the way my
mail works.

I don't see the canvas resize on Vista, however I do see it flicker. I don't
doubt that it resizes though, I just cannot reproduce it. I guess the main
question I have is "why are you rebuilding the entire menu just to disable
an entry?". Instead you should just use the entryconfigure method and target
the entry you wish to disable.

Here is one way of doing that (fully working code - just cut, paste and
run):

###
use Tk;
use strict;

my $mw=tkinit;
$mw->Canvas->pack;
create_all_menus_only_once();
MainLoop;

sub create_all_menus_only_once {
  my $menub = $mw->Menu(-type => "menubar");
  $mw->configure (-menu => $menub);
  my $submenu = create_menu1($menub);
  $menub->cascade(
   -label => "Edit",
   -underline => 0,
   -tearoff =>0,
   -menu=>$submenu);
}

sub create_menu1 {
  my $mainmenu = shift;
  my $menu1 = $mainmenu->Menu(-tearoff=>0);
  #First entry
  $menu1->command(-label => 'A Switch to B',
-command=>[\&switch,$menu1,'A']);
  #Second entry
  $menu1->command(-label => 'B Switch to A',
-command=>[\&switch,$menu1,'B'], -state=>'disabled');
  return ($menu1);
}

sub switch {
  my ($m,$val) = @_;

  if ($val eq 'A') {
$m->entryconfigure(0,-state=>'disabled');
$m->entryconfigure(1,-state=>'normal');
  }
  elsif ($val eq 'B') {
$m->entryconfigure(0,-state=>'normal');
$m->entryconfigure(1,-state=>'disabled');
  }
}
__END__
###

There are "so" many ways to create and manipulate menus - that I could not
cover all the scenarios. In this method, I created the submenu before
creating the "Edit" cascade. This will allow you to use the menu reference
to adjust the entries as you see fit.

There is "no flicker" with this code - so I will guess that it will solve
your resizing issue.

HTH

Jack

-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Geoff Horsnell
Sent: October-24-09 5:38 PM
To: 'Jack'; perl-win32-users@listserv.activestate.com
Subject: RE: Strange Perl/Tk action

Unfortunately, it would be rather a lot of code. I will try to describe the
action with example segments.

...

sub create_all_menus {
  $mode = "A";
  $menub = $tl->Menu(-type => "menubar");
  $tl->configure (-menu => $menub);
  $widget1 = menub->cascade(-label => "Edit, -underline => 0, -tearoff =>
0);
  $widget->pack(-side => "top", -anchor => "nw");
  &create_menu1 ($widget1);
...
}

sub create_menu1 {
  my $widget = shift;
  
  $state = "disabled";
  if ($mode eq "A") {
$widget->command(-label => "B", -underline => 0, -command =>
\&switchToB);
$widget->command(-label => "A", -underline => 0, -command =>
\&switchToA, -state => $state);
  } else {
$widget->command(-label => "B", -underline => 0, -command =>
\&switchToB, -state => $state);
$widget->command(-label => "A", -underline => 0, -command =>
\&switchToA);
  }
}
...
sub switchToA {
  $mode = "A";
  &create_all_menus (...);  # repaint all menu buttons
}
Sub switchToB {
  $mode = "B";
  &create_all_menus (...);  # repaint all menu buttons
}

After calling the "create_all_menus" from the main program, option "A" is
greyed out and option "B" is active. When "B" is selected for the first
time, option "B" is then greyed out and option "A" is active. At the same
time, the height of the "canvas" window containing these menu buttons is
reduced by about 0.2 cm. Subsequent selection of the "A" or "B" menu option
(whichever is currently active) has no further effect on the size of the
window.

I hope this makes better sense.

TIA

Geoff

-Original Message-
From: Jack [mailto:goodca...@hotmail.com] 
Sent: Saturday, October 24, 2009 10:51 PM
To: 'Geoff Horsnell'; perl-win32-users@listserv.activestate.com
Subject: RE: Strange Perl/Tk action


It's hard to follow your description. Can you upload some sample code that
shows the problem?

"Shrinkage is always bad" ;)

Jack


From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Geoff Horsnell
Sent: October-24-09 10:05 AM
To: perl-win32-users@listserv.activestate.com
Subject: Strange Perl/Tk action



I have created a GUI using the Tk "

RE: Strange Perl/Tk action

2009-10-24 Thread Jack
It's hard to follow your description. Can you upload some sample code that
shows the problem?

"Shrinkage is always bad" ;)

Jack


From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Geoff Horsnell
Sent: October-24-09 10:05 AM
To: perl-win32-users@listserv.activestate.com
Subject: Strange Perl/Tk action



I have created a GUI using the Tk "canvas" widget that contains a menu list
with two mutually exclusive menu items - say "A" and "B". When "A" is
selected, "B" should be disabled (greyed out) and vice versa. Therefore,
when the currently active option is selected, the menu list needs to be
repainted switching the active and disabled items. However, the first time
that this happens, the height of the canvas window shrinks - by about the
height of the menu tab. The height of the window remains unchanged for all
subsequent menu actions. I have printed out the variable containing the
nominated height of the window before and after making the selection and it
does not change. I can compensate for this action by making the original
window height slightly larger in the first place. However, I would rather
that the shrinkage did not happen at all. Has anyone seen this happen for
themselves and does anyone know how to prevent the window from shrinking in
the first place? 

Any suggestions would be most welcome.

 

Many thanks 

 

Geoff

 




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: TK question

2009-09-20 Thread Jack
Sorry for the top post..
 
Your problem is well-known but I don't recall any workarounds being found -
until now that is ;)
 
The problem stems from the fact that the windows getopenfile dialog is
closed on a Double-Button*Press* (that is a windows problem AFAIC) however
most other Tk widgets respond on a Button*Release* event. So - If you double
click - then hold the button down on the second click. You won't see any
event until you release the mouse. I guess you could tell your users to hold
the mouse button down, move it off the main window and then release - right?
 
Just kidding.
 
There are only two workarounds I can think of. Make main window "not" be
there by withdrawing it before you launch the getOpenFile and then
deiconify/raise it again upon the file being chosen - or - a neat trick -
could be to cover up the window with a fake transparent widget to ensure
that it is the one that consumes the event.
 
#!/usr/bin/perl -w
 
use Tk;
use strict;
my $var = undef;
my $file;
## Ensure the canvas lies beneath the "double-click"
## event of your getOpenFile dialog to see the event
## as a printed warning.
 
my $mw = tkinit;
my $canvas = $mw->Canvas(-background=>'red')->pack(-expand=>1,
-fill=>'both');
 
$canvas->Tk::bind(''=>sub{warn "Buttonrelease invoked";});
$mw->Button(-text=>'Launch',-command=>\&getfile)->pack;
$mw->Radiobutton(-text=>'Withdraw/Restore',-variable=>\$var,-value=>'withdra
w')->pack;
$mw->Radiobutton(-text=>'Transparent
Frame',-variable=>\$var,-value=>'frame')->pack;
$mw->Radiobutton(-text=>'Normal',-variable=>\$var,-value=>'normal')->pack;
MainLoop;
 
sub getfile {
 
  if ($var eq 'withdraw') {
$mw->after(100,sub{$mw->withdraw});
$file = $mw->getOpenFile();
 $mw->deiconify;
 $mw->raise;
 print "File is: $file\n";
  }
  elsif ($var eq 'frame') {
  my $frame = $mw->Frame(-bg=>undef);
   $frame->place(-in=>$mw,-x=>0, -y=>0, -relwidth=>1.0, -relheight=>1.0);
   $frame->update;# Ensure frame is placed before calling getOpenFile..
   $file = $mw->getOpenFile();
   $frame->update;# Flush all events so the buttonrelease is consumed.
  $frame->placeForget;
   print "File is: $file\n";
  }
  else {
 $file = $mw->getOpenFile();
   print "File is: $file\n";
  }
 
}
__END__
 
I'm not necessarily sure you would want to do this in production - but it
seems to work.
 
Jack D.



From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Spencer Chase
Sent: September-18-09 5:05 PM
To: Perl-Win32-Users
Subject: TK question


Greetings Perl-Win32-Users,

I have been trying everything I can think of and nothing works. I have a TK
application that uses getopenfile. The problem is that you can select a file
in the browser window by either clicking the file and then clicking "open"
or you can double click the file and not have to click "open." This is fine
but if the browser window happens to be over another widget, the second
click seems to select something in that widget. In my case, that widget is s
scrolled listbox. I do not want to change the selection accidentally. I have
tried everything I can think of to lock the listbox but nothing works. A
button to lock the listbox would be fine but I can't figure out how to do
it. Disabling a double click in the getopenfile browser would also be fine
but can't find a way to do that either. Open to any and all suggestions.

--
Best regards,
Spencer Chasemailto:spen...@spencerserolls.com
67550 Bell Springs Rd.
Garberville, CA 95542  Postal service only.
Laytonville, CA 95454  UPS only.
spen...@spencerserolls.com
http://www.spencerserolls.com
http://www.spencerserolls.com/MidiValve.htm
(707) 984-8356

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Determining Vista Editions

2009-08-20 Thread Jack

 
___

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Michael Cohen
Sent: August-19-09 5:40 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Determining Vista Editions



>>To whomever knows the answer: 

>>I have been using the Win32::GetOSVersion() function for many years in
order to pull the Windows OS level.  However, I now have a new need to
determine whether or not the OS is Windows Vista Home Basic (or for that
matter, other various editions).

[snip]

>>Is there a better way to get this information instead of using the
GetProductInfo() command from the "kernel32" DLL? 


Better?? Likely not. I could not make the GetProductInfo API work either.
Instead perhaps you can just read the registry.

#!/usr/bin/perl -w 
use strict;
use Win32::TieRegistry;
$Registry->Delimiter("/");
my $edition = $Registry->{"LMachine/Software/Microsoft/"}->
  {"Windows NT/CurrentVersion//EditionID"}
  or  die "Can't find Edition ID: $^E\n";
print $edition;
__END__


Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Need help removing blinking cursor on a TK Scrolled

2009-08-15 Thread Jack
The cursor you are talking about is the "insert" cursor, which indeed is not
need in a ROText. The other cursor you define in your options controls the
look of the mouse. Use the standard Tk option of insertwidth to "hide" the
insert cursor.
 
... -insertwidth => 0
 
Jack

  _  

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Daniel Burgaud
Sent: July-31-09 5:32 PM
To: Perl-Win32-Users
Subject: Need help removing blinking cursor on a TK Scrolled


Hi

I have a Scrolled ROText:

$scrolled   = $mw->Scrolled( 'ROText', 
-relief => 'flat', 
-borderwidth => 1, 
-scrollbars => 'e', 
-cursor => 'top_left_arrow', 
-width =>200, 
-height => 30,
)->pack( -side => 'top',  -expand => 1, -fill =>
'both', );


My problem is that there is this annoying thin blinking cursor that is
ruining the display.
ie, there is already a "top_left_arrow" cursor controlled by the mouse and
another
blinking cursor which the users of the software would think as a "point of
input" for 
key-presses. And when they do, they get frustrated why its not inserting
text.

Is there a way to hide this blinking cursor?

Off hand, the only way for me to hide it is to change this Scrolled'
background to black
to match the color of this blinking cursor.. but black background is not
suitable for this
application.

thanks.

Dan

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: problem with Tk Frame not filling the whole frame.

2009-07-31 Thread Jack
Again - sorry for the top post..

I'm not completely sure of what you want, but I think you want some sort of
"bar" down the left side. You have to turn the expand option to off for that
to "not" allocate anymore space in the x direction on a resize. Otherwise
the packer will split it 50/50 with the righthand frame.

This will do what I describe - which is yet to be decided what you really
want:

#
use Tk;
use strict;

my $mw=tkinit;
my $mainFrame = $mw->Frame()->pack(-expand=>1, -fill => 'both');
my $frameLeft = $mainFrame->Frame( -bg=>'red',-borderwidth => 1, -width =>
50, )->pack( -side => 'left',  -expand => 0, -fill => 'y');
my $frameRight = $mainFrame->Frame( -bg=>'yellow', -borderwidth => 1,
)->pack( -side => 'left', -expand => 1, -fill => 'both');

MainLoop;
#

Suggestion..it would be easier to help if you provided fully working
programs that show the problem as opposed to code snippets (which had some
typos).

Jack

 



From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Daniel Burgaud
Sent: July-31-09 4:52 AM
To: Perl-Win32-Users
Subject: problem with Tk Frame not filling the whole frame.


Hi,

I have a Frame and within this Frame, I have 2 more Frames:

$mainFrame = $mw->Frame()->pack(-expand=>1, fill = 'both');

$frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack(
-side => 'left',  -expand => 1, -fill => 'y');
$frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side =>
'right', -expand => 1, -fill => 'both');


How come the sub frames isnt filling the whole mainFrame?
Why? What option/method must I use to force these two sub frames to fill the
mainFrame?

I also tried it within a Notebook (instead of main Frame) with same effect:

$mainFrame = $TK{'notebook'}->add('item',-label => ' Main Frame ');
$frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack(
-side => 'left',  -expand => 1, -fill => 'y');
$frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side =>
'right', -expand => 1, -fill => 'both');

Need Help. Thanks!

Dan


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: What TK Method for hiding a widget?

2009-07-30 Thread Jack
Sorry for the toppost.

Depending on how you packed your widget you have to use the 'forget' method
appropriate to the packer.

eg/

$frame->pack;
$frame->packForget;

To show the frame again you will have to repack it possibly by using a few
extra options such as -in or -after.

If you used grid then ->gridForget etc.

Jack



From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Daniel Burgaud
Sent: July-30-09 4:29 PM
To: Perl-Win32-Users
Subject: What TK Method for hiding a widget?


Hi,

I am looking for that Tk method that will hide widgets rendering it
invisible.

specifically, I'd like to hide a Frame whenever a DialogBox pops up asking
for authentication.

I do not want to destroy this Frame though doing so would require me to redo
everything within this Frame.

Thanks

Dan


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Q: How to resize TK window panels

2009-03-14 Thread Jack


-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
listmail
Sent: March-14-09 9:34 AM
To: Daniel Burgaud
Cc: Perl-Win32-Users
Subject: Re: Q: How to resize TK window panels

Daniel Burgaud wrote:
> Hi,
>
> I have the following Perl Script. It displays two Scrolled Text Left 
> and Right.
> My problem is, how to resize the widths of the panels.
> Is there a switch that will automatically adjust the width or I 
> manually dragging
> the edges?
>


A cleaner solution is to use a Panedwindow instead of an Adjuster.
Panedwindows began in the 804 series. If you need backwards compatibility
the by all means go with the Adjuster. Also - I'm not sure why you have the
while loop at the bottom of your code. Tk::MainLoop is what you want to use.

Here is a simple example:
###
use Tk;
use strict;

my $mw=tkinit;
$mw->minsize(630,500);
my $pw = $mw->Panedwindow(
  -showhandle=>1,
  -sashpad=>6)->pack(-fill=>'both', -expand=>1);
my $t1 = $pw->Scrolled('Text',-scrollbars=>'ose');
my $t2 = $pw->Scrolled('Text',-scrollbars=>'ose');
$pw->add($_) foreach ($t1,$t2);

MainLoop;
###
__END__

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: A Perl::Tk question

2009-02-23 Thread Jack
Sorry for the top post - it's just how my reader works.

There are two options here. The first is to pass the number as an argument
to your subroutine. The second is to get the widget reference itself. It all
depends on what information you *really* need and why you need it.

i.e. It makes no sense to have 3 buttons doing the same thing unless you are
passing different information.

Examples - 
##
#Method #1:
##
use Tk;
use strict;

my $mw=tkinit;
foreach (1..3) {
 $mw->Button(-text=>"Button $_", -command=>[\&display,$_])->pack;
}
MainLoop;

sub display
{
  my ($num) = @_;
  print $num,"\n";
}
##
#Method #2:
##
use Tk;
use strict;

my $mw=tkinit;
foreach (1..3) {
 $mw->Button(-text=>"Button $_", -command=>\&display)->pack;
}
MainLoop;

sub display
{
print "\$Tk::event = ", $Tk::event,"\n";
print "\$Tk::widget = ", $Tk::widget,"\n";
print "A way to get widget through the event", $Tk::event->W,"\n";
}
##

There is a third option where if you bind to say Button-Release, then the
widget reference will be implicitly passed in the argument list.

But method 1 or 2 should work for your needs.

Jack

-Original Message-
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
alex.ign...@atcoitek.com
Sent: February-23-09 1:59 PM
To: perl-win32-users@listserv.activestate.com
Subject: A Perl::Tk question


Hi there, I need to know the name of the object that called me from
inside my callback routine.
For instance I have 3 buttons, they all call the same subroutine, if
button number 3 was pressed, I want to be able to determine that at run
time. Even if it's just by reading the button text.  How do I do this? (
small example snippet )

my $button1 = $mw->Button(-text => 'button#1',-command => \&display) 
my $button2 = $mw->Button(-text => 'button#2',-command => \&display)
my $button3 = $mw->Button(-text => 'button#3',-command => \&display)



sub display {
print "I was called by button ???\n"; 
}

This is probably some simple thing that I am not finding at the moment.
I've tried googling this all over the place and can't seem to make any
headway.

Thanks in advance
Alex


The information transmitted is intended only for the addressee and may
contain confidential, proprietary and/or privileged material. Any
unauthorized review, distribution or other use of or the taking of any
action in reliance upon this information is prohibited. If you receive this
in error, please contact the sender and delete or destroy this message and
any copies.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.11.3/1966 - Release Date: 02/22/09
17:21:00

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Q on TK popups

2008-12-08 Thread Jack
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
Sent: December-08-08 12:33 AM
To: Perl-Win32-Users
Subject: Q on TK popups


Hi,

I have a Scrolled Text wherein, each line is binded to a popup

$frames{'name-r'}->tag( 'bind', "A$i", ''  => sub {
&displayRecord($i) } );

I have been trying to use messageBox, Dialog and Balloon.

* The problem with messageBox is that I could not configure the font of the
message.

* The problem with Dialog is that it wraps the word to a new line even if
the dialog window
is wide enough to contain twice the length of the message thus ruining the
display.

* The problem with Balloon however is that, it is difficult to control when
it should show up.
Currently, the Balloon is defined to show for the whole $frames{'name-r'}
which therefore,
would show even if the cursor isnt on top of the desired line (ie, it is
displaying info for Line1
when cursor is already at Line3 or the scrolled text).

My questions are:
1. Is there a way to configure font for messageBox? or
2. Is there a way to prevent Dialog from truncating the message into a new
line? or
3. Is it possible to attach a Balloon to a particular line within the
scrolled text? 
ie, it will popup only when mouseover a particular line and will unpop when
un-mouseover
instead of having the balloon attached to the whole scrolled text widget.

4. Or is there a different function that can solve the above?

#
As a general rule I rarely ever use messageBox. It is actually a 'method'
that creates a Dialog every time you use it. It will be the cause of
increased memory if you call it often enough.

Dialog is a subwidget of Dialogbox. As such you can use the Subwidget method
to get the "Advertised" label and change the wraplength. If you change it to
a zero then the Dialog will only wrap the text at a newline which I'm
assuming you can control. If you don't have control over the newline
character - then you can increase the wraplength using the same method. It
defaults to 3 inches ('3i')

Here is an example:

use Tk;
use Tk::Dialog;
use strict;

my $mw=tkinit;
my $d=$mw->Dialog(-title=>'Test Dialog',
  -text => "A very long string"x10,
  -bitmap=>'info');
my $label = $d->Subwidget('message');
$label->configure(-wraplength=>0);
$d->Show;
MainLoop;
__END__

As for using a Balloon - I'm sure you could use the -postcommand or
-motioncommand options to decide whether or not to display a balloon
depending on the line number your mouse is over.

Jack
#

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Q on TK Scrolled: how do scroll?

2008-12-07 Thread Jack
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
Sent: December-07-08 3:46 AM
To: Jack
Cc: Perl-Win32-Users
Subject: Re: Q on TK Scrolled: how do scroll?


Hi Jack,


The scrollbed field is defined as:

$frames{'name-r'}  = $frames{'name'}->Scrolled  ('ROText', -height => 8,
-scrollbars => 'e',  )->pack( -side => 'right', -expand => 1, -fill => 'x',

It can scroll up/down and contains text.

I want to do a "search" and therefore the script should display the part 
where the search string is located within this scrolled field.

I dont know how to write that part of the script because I dont know how to.
I hope you understood my question.

So basically, I want the script to automatically scroll to the location
where
this text is located.

I have tried playing with:
$frames{'name-r'}->set(0.5, 0.6)
$frames{'name-r'}->see(0.5)
with no success - I totally dont have a clue what these two did too.

Hoping for help.

Dan.

#

Ok then. Now I get it.

You are on the right track. The 'see' method is the one you want to use.

If you are doing a 'search', then that method will return the first index
that matches your search pattern. Just pass that to the 'see' method to
autoscroll to that location.

Here is a working example:


use Tk;
use strict;

my $pattern='00';
my $lastindex='1.0';
my $mw=tkinit;
my $t=$mw->Scrolled('Text',
  -scrollbars=>'ose')
  ->pack(-expand=>1, -fill=>'both');
for (1..1000) {
  $t->insert('end',"$_\n");
}
my $id = $t->repeat(1000,[\&searchit,$pattern]);
MainLoop;


sub searchit {
  my ($p) = @_; warn $lastindex;
  my $index = $t->search($p,"$lastindex". '+ 1 lines','end');
  unless ($index) {
 $id->cancel;
 return;
  }
  $t->see($index) if $index;
  $lastindex=$index;
}
##

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Q on TK Scrolled: how do scroll?

2008-12-06 Thread Jack

___

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
Sent: December-06-08 7:16 PM
To: Perl-Win32-Users
Subject: Q on TK Scrolled: how do scroll?


>I have a TK scrollbar defined as follows:

>$frames{'name-r'}  = $frames{'name'}->Scrolled  ('ROText', -height => 8,
-scrollbars => 'e',  )->pack( -side => 'right', -expand => 1, -fill => 'x',
);

>My problem is:

>How do I command it to show the middle, the bottom, the top of the
scrollbar?

###
I can likely help - but I really don't understand your question.
What do you mean by "show the middle, bottom and top"?

Perhaps you can post a small sample program that demonstrates your problem.

Jack


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: question on TK

2008-10-15 Thread Jack


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
Sent: October-14-08 11:15 PM
To: Perl-Win32-Users
Subject: question on TK


>Hello,

>I am using TK and have multiple "MainWindow->new()" windows.
>
>My 1st problem is:
>How do I "disable" or "make invisible" (or any other means to prevent user
>from doing anything on these "disabled" windows?
>
>2nd problem is:
>How do I close a window without closing the whole application?

#

Unless there is a reason to use multiple MainWindows (very rare) then don't
do that; use multiple toplevel windows instead. This will solve your 2nd
problem automatically.

As for your 1st problem - it all depends on what you mean by disable. You
can hide a toplevel window by using the withdraw method. You can stop a
toplevel from being closed by using the protocol method. Both are documented
in Tk::Wm. You can disable "every" widget within the toplevel by walking
through each child widget and setting the state. etc. There are many
variations depending on what you wish to do.

Here is a small program to show you some of the different Toplevel/Wm
options.

use Tk;
use strict;

my @state = qw/normal iconic withdrawn zoomed/;
my $type=1;
my $noDelete=0;
my $state='normal';
my @allTops;

my $mw=tkinit;
my $lf1 = $mw->Labelframe(-text=>'Toplevel Options')->pack;
my $lf2 = $mw->Labelframe(-text=>'State')->pack;
$lf1->Checkbutton(-text=>'Transient?',-variable=>\$type)->pack;
$lf1->Checkbutton(-text=>'No Delete?',-variable=>\$noDelete)->pack;

foreach my $s (@state) {
   $lf2->Radiobutton(-text=>"$s",-variable=>\$state, -value=>"$s")->pack;
}
$mw->Button(
  -text=>'New Toplevel',
  -command=>\&doTop,
  )->pack();

$mw->Button(
  -text=>'Restore all Withdrawn Windows',
  -command=>\&restore,
  )->pack();

MainLoop;

sub doTop {
my $top = $mw->Toplevel;
$top->transient($mw) if ($type);
$top->state($state);
if ($noDelete) {
  $top->protocol('WM_DELETE_WINDOW',sub{});
}
$top->Button(-text=>'Withdraw Me for 3 seconds',
  -command=>sub{
  $top->withdraw;
  $top->after(3000,sub{
 $top->deiconify;
 $top->raise;
 });
  })->pack;
  push (@allTops, $top);
}

sub restore {
   foreach my $t (@allTops) {
  if (Exists($t) and ($t->state eq 'withdrawn') ) {
  $t->deiconify;
  $t->raise;
  }
   }
}
__END__
#

Jack




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: [OT] patch.exe on Vista is unusable.

2008-09-24 Thread Jack
- Original Message -
From: "Sisyphus" <[EMAIL PROTECTED]>
To: "perl-win32-users" 
Sent: Thursday, September 25, 2008 1:41 PM
Subject: [OT] patch.exe on Vista is unusable.


> Does anyone have a working patch.exe on Vista ?

There's actually nothing wrong with the patch.exe files.

The problem is that Vista won't let me run any executable whose name =~ 
m/patch/i without first getting my Administrator password. Vista doesn't 
care what the file actually does - it just decides that any executable whose

name =~ m/patch/i needs admin privileges to run, and that it can't be run 
from the command line. (This of course means that I can rename patch.exe to,

say, othername.exe, and I can then run it fine - but I have to run it as 
'othername', not 'patch'.)

Despite the fact that this is a great and wondrous innovation on the part of

Microsoft (I bet Linux wish they'd thought of it first), I would like to 
remove this behaviour. Anyone know how to do that ?

Cheers,
Rob

##
You should be able to run it from the command line once you have a command
window up that has already passed the password test. i.e. Right click on the
command icon (mine is in the start menu) and choose "Run as Administrator".
I'm not sure if this is what you are looking for?

Jack 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: joystick gamepad input for perl?

2008-08-29 Thread Jack

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Spencer Chase
Sent: August-29-08 4:39 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: joystick gamepad input for perl?

>Greetings Perl-win32-users,

>any ideas on a (hopefully) simple way to obtain data from a USB
>joystick/gamepad on a win 32 machine?


I'm not a gamer but this looks interesting:

http://aspn.activestate.com/ASPN/CodeDoc/Win32-MultiMedia/Joystick/Joystick.
html

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to make the passwd invisible while I'm typing the passwd atMS-DOS prompt on Windows?

2008-01-28 Thread Jack



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
Yang
Sent: January-28-08 10:28 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: How to make the passwd invisible while I'm typing the passwd
atMS-DOS prompt on Windows?

>Hi,
 
>The script bellow prompt user to enter login password. But, when I enter
the passwd at prompt, it shows me the passwd I >typed. How to make the
passwd invisible while I'm typing the passwd?
 
>  print "\nPlease Enter login passwd: ";
>  chomp($passwd = );


  perldoc -q password

Jack D




No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.19.14/1247 - Release Date: 28/01/2008
10:59 AM
 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Turn off the Progess bar

2007-10-18 Thread Jack D
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Don VanSyckel
> Sent: Saturday, June 09, 2007 7:13 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Turn off the Progess bar
> 
> I have a small program that copies some file and uses the 
> Progress Bar on the bottom of the TK window to display 
> progress.  When the copy is done I'd like to remove the 
> Progress Bar and pop up a second windows saying copy done 
> with an 'OK' to close it.
> 
> I'm having problems figuring this out.  Any suggestions?

You can either destroy your progressbar after you are finished with it, or
if you intend to use it again, then just do a packForget on it.

$pbar->destroy; #permanent

Or 

$pbar->packForget; #object still exists for re-use (via 'pack'ing it again)

Then to pop up a box saying done, you can either use a Dialog or messageBox.

Here is a fully working sample:

use Tk;
use Tk::Dialog;
use Tk::ProgressBar;
use strict;
my $percent=0;

my $mw=new MainWindow;
my $text=$mw->Scrolled('Text',-scrollbars=>'se')->pack;
my $button =$mw->Button(
  -text=>'Something that takes some time',
  -command=>\&doSomething)->pack;
my $pb=$mw->ProgressBar(
  -variable=>\$percent,
  -width=>20,
  -length=>200)->pack;
my $dialog = $mw->Dialog(
  -popover=>$mw,
  -bitmap=>'info',
  -text=>'Task completed !',
  -buttons=>['Ok']);
MainLoop;

sub doSomething
{
   for(1..10){
  $percent = $_ * 10;
  $text->insert('end',"$percent percent done\n");
  $mw->update;
  $mw->after(500);
  }
   $text->insert('end', "Progressbar will delete in 5 seconds\n");
   $text->update;
   $mw->after(5000,\&destroyPB);
}

sub destroyPB {
  $pb->destroy;
  $dialog->Show;
  $button->configure(-state=>'disabled');
}
__END__
--
Jack




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: control M's

2007-06-25 Thread Jack D
The problem likely occurs when you "upload" (assuming you meant ftp when you
said that. Ensure you ftp the file in "ASCII" mode when going from windows
to unix or vice versa. This will automatically remove any CR's.

http://en.wikipedia.org/wiki/Newline#Common_problems

Jack




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Chris Rodriguez
Sent: Monday, June 25, 2007 2:41 PM
To: [EMAIL PROTECTED]
Subject: control M's


Hi everyone,
I wrote a cgi script in PERL which won't execute.  I'm told it's
because I have control M's at the end of each line, and that this happens
when editing programs in Windows (which I do, with Notepad).  I found a free
program on the web
(http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which claims to
remove them.  I ran it and uploaded the new program, but it still doesn't
work.  It may be that there's another problem with the script, then again,
maybe the control M's are still there.  I'd like to rule out the latter.
Can anyone advise me on dealing with this?  How can I remove them?  How can
I tell if they're there or not?  How can I type up a script so that they
never appear in the first place, etc.?

Thank you,
Chris




Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now
<http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamek
ey=monopolyherenow>  (it's updated for today's economy) at Yahoo! Games.


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::Tie::Ini for Perl 5.8?

2007-05-14 Thread Jack D

 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sisyphus
> Sent: Monday, May 14, 2007 5:40 PM
> To: Dax Games; perl-win32-users@listserv.ActiveState.com
> Subject: Re: Win32::Tie::Ini for Perl 5.8?
> 
> 
> - Original Message -
> From: "Dax Games" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, May 15, 2007 1:35 AM
> Subject: Win32::Tie::Ini for Perl 5.8?
> 
> 
> > Where can I get Win32::Tie::Ini for Perl 5.8?
> >
> > Does not show up in PDK7 PPM and only found source on CPAN.
> >
> 
> Looking at the various ppd files (from the link provided by 
> Steven) it 
> seeems that some of the ppm's (eg Win32::AdminMisc) have been 
> updated to 
> include a build for 5.8, whereas others (eg Win32::Tie::Ini) have not.
> 
> I couldn't find the source on CPAN. Where is it ? With the 
> source, someone 
> might be able to build it for you.

Ask Jean Louis Morel nicely at:

[EMAIL PROTECTED]

He is usually very receptive to building and adding Win32 modules to his
repository at:

http://www.bribes.org/perl

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: localtime failing on DST change

2007-03-15 Thread Jack D
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris O
> Sent: Tuesday, March 13, 2007 10:27 AM
> To: [EMAIL PROTECTED]
> Subject: RE: localtime failing on DST change
> 
> On Tue, 13 Mar 2007, Bill Luebkert wrote:
> > My 'localtime' function output doesn't reflect DST since the Sunday 
> > changeover.
> 
> Chris  Wrote:
> 
> Works fine for me on windows... but I'm having the same issue 
> on Fedora. :-(
> 

Sorry this is a bit O/T for a win32 group - but we had the same problem
today at work on Debian.

http://www.perlmonks.org/?node_id=251074

..contains the answer that worked for us. 

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: audio questions

2007-02-19 Thread Jack D

 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> 
> # This should work for you...
> use Tk;
> use Win32::MultiMedia::Mci;
> 
> my $mci;
> my $mw=tkinit;
> my $start = $mw->Button(-text=>'Start',-command=>\&start)->pack;
> my $stop = $mw->Button(-text=>'Stop',-command=>\&stop)->pack;
> MainLoop;
> 
> sub start
> {
> my $midi = "/path/to/midi/file.mid";
> $mci = Win32::MultiMedia::Mci->open($midi);
> $mci->seek(to=>'start');
> $mci->play;
> }
> 
> sub stop
> {
> $mci->stop;
> }
> 
> __END__
> 

Actually - this sucks because the $mci object should not be overwritten on
each button press. But with minor changes you can do what you need (i.e. you
get the idea)

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: audio questions

2007-02-19 Thread Jack D

 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Spencer Chase
> Sent: Monday, February 19, 2007 12:36 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: audio questions
> 
> Greetings perl-win32-users,
> 
> The recent discussion of audio on the PC has me thinking 
> again about something I have been trying to do for years. I 
> want to play MIDI files from a perl TK script. I have checked 
> out all of the modules available on CPAN and nothing does 
> what I want. There are issues with selecting devices and a 
> whole host of other problems. I have looked briefly into 
> using WIN32::API but trying to understand the terrible 
> documentation on Multimedia that Microsoft provides is more 
> than I can manage. I am hoping to find a module that allows 
> me easy access to the multimedia functions necessary to play 
> MIDI files. If anyone has any leads or code to share please 
> let me know. Again, I have tried everything on CPAN and some 
> modules come close but not close enough.
>

# This should work for you...
use Tk;
use Win32::MultiMedia::Mci;

my $mci;
my $mw=tkinit;
my $start = $mw->Button(-text=>'Start',-command=>\&start)->pack;
my $stop = $mw->Button(-text=>'Stop',-command=>\&stop)->pack;
MainLoop;

sub start
{
my $midi = "/path/to/midi/file.mid";
$mci = Win32::MultiMedia::Mci->open($midi);
$mci->seek(to=>'start');
$mci->play;
}

sub stop
{
$mci->stop;
}

__END__

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl TK Graying out disabled menu items

2007-01-10 Thread Jack D

 


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
D Trosper
Sent: Wednesday, January 10, 2007 9:20 PM
To: Jack D
Cc: 'Bill Luebkert'; perl-win32-users@listserv.ActiveState.com;
[EMAIL PROTECTED]
Subject: RE: Perl TK Graying out disabled menu items


>Tried that, 

>The menu item was disabled but not grayed out. 

>Also the menubar seems to begin at 1 instead of 0 for its items; so
disabling 1 actually gets the 'File' menu. 

I think unless you explicitly state -tearoff=>0 - the first index is
reserved for the tearoff line. I know that doesn't make sense for a menubar
- but that is my guess anyways.

My mistake! You said you wanted the **Edit** menu disabled. Easy - just
increase the index to 2. It is documented that the "pattern" search for
indices needed work, so I would just keep track of your index numbers and
use them instead. Here is the full code again which grays out the "Edit"
menu. It works as advertised on WinXP Home/AS Build 819 ...


use strict;
use Tk;
my %menus;

my $mw = new MainWindow;
$mw->geometry("+200+200");
$mw->minsize(400,300);

my $menubar = $mw->Menu;
$mw->configure(-menu => $menubar);

foreach (qw/File Edit Help/) {
  $menus{$_} = $menubar->cascade(-label=>"~$_",-tearoff=>0);
}

$menus{'File'}->command(-label => "~New file");
$menus{'File'}->command(-label => "~Save file");
$menus{'File'}->command(-label => "E~xit", -command=>sub {$mw->destroy});


$menus{'Edit'}->command(-label=> "~Preferences");
$menus{'Edit'}->command(-label=> "File ~Editor");

$menus{'Help'}->command(-label=>"User ~Guide");
$menus{'Help'}->command(-label=>"~About");

$menubar->entryconfigure(2,-state=>'disabled');

MainLoop;



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl TK Graying out disabled menu items

2007-01-10 Thread Jack D
Add this line to the code I previously sent:
 
$menubar->entryconfigure(1,-state=>'disabled');
 
That should do it.
 
Jack


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
D Trosper
Sent: Wednesday, January 10, 2007 6:14 PM
To: Bill Luebkert
Cc: perl-win32-users@Listserv.ActiveState.com
Subject: Re: Perl TK Graying out disabled menu items



That grays out the last item in the Edit drop down menu. 
It doesn't gray out Edit itself. 

Still searching, 
Gary T 




Bill Luebkert <[EMAIL PROTECTED]> 


01/10/2007 05:08 PM 


To
Gary D Trosper <[EMAIL PROTECTED]> 

cc
perl-win32-users@Listserv.ActiveState.com 

Subject
Re: Perl TK Graying out disabled menu items






Gary D Trosper wrote:
> 
> Thanks Jack that works!
> 
> However, he said in frustration,   I'm trying to gray out 'Edit'  on the 
> main menubar.
> 
> Using the "tried and true" cut and paste method I slipped this line into 
> the end of your code (Your code works)
> 
> $menubar->entryconfigure('Edit', -state=>'disabled');

my $m = $menus{'Edit'}->cget(-menu);
$m->entryconfigure('last', -state => 'disabled');

> and I get "Bad name after Edit on line 31"
> 
> Still struggling but pointed in the right direction,




___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl TK Graying out disabled menu items

2007-01-10 Thread Jack D

 
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
D Trosper
Sent: Wednesday, January 10, 2007 7:59 AM
To: perl-win32-users@Listserv.ActiveState.com
Subject: Perl TK Graying out disabled menu items


Hi All, 

I'm running ActiveState perl version 5.8.0 built for
MSWin32-86-multi-thread. 

I would like to create a simple menubar with some -command items
disabled until programatical conditions are met.   
(No problem been there done that.  Except that the button still
takes focus and presses even though nothing happens) 

And I would like a visual cue ( letters grayed out) that the menu
button/command is disabled.  ( This is my PROBLEM ) 

I've tried using -disabledforeground => 'gray75'  and get an error
that -disableforeground is not a valid option. 

I've tried using both 

my $menuCmd = $menubar->command(  yada-yada ); 

and 

my $menuCmd = $menubar->Menubutton( yada-yada); 

Same error so I used DataDumper to look at the return from
$menuCmd->configure  sure enough no -disabledforeground . 
 ( I could have sworn both Learning and Mastering Perl/Tk listed
-disabledforeground as an inherited option) 

So doing what any perlish person would do... I tried another way.  I
just tried to set the -foreground => 'gray75'   

No complaints this time just nothing happened. No color change in
the lettering. Nothing. 

After hours of digging through documentation, experimentation,
googling, and nose picking I have yet to come up with an answer. 

Then I saw the BUGS section on the ActiveState documentation on menu

"At present it isn't possible to use the option database to specify
values for the options to individual entries." 

Does this mean I can't get there from here or is there some other
arcane formulae that I am missing? 

Help me Mister Wizard!


The following code "grays out" the exit button - and it is disabled too. I'm
using the most recent version of Activestate perl.




use strict;
use Tk;
my %menus;

my $mw = new MainWindow;
$mw->geometry("+200+200");
$mw->minsize(400,300);

my $menubar = $mw->Menu;
$mw->configure(-menu => $menubar);

foreach (qw/File Edit Help/) {
  $menus{$_} = $menubar->cascade(-label=>"~$_",-tearoff=>0);
}

$menus{'File'}->command(-label => "~New file");
$menus{'File'}->command(-label => "~Save file");
$menus{'File'}->command(-label => "E~xit", -command=>sub {$mw->destroy});


$menus{'Edit'}->command(-label=> "~Preferences");
$menus{'Edit'}->command(-label=> "File ~Editor");

$menus{'Help'}->command(-label=>"User ~Guide");
$menus{'Help'}->command(-label=>"~About");

my $m = $menus{'File'}->cget(-menu);
$m->entryconfigure('last', -state=>'disabled');

MainLoop;




On a different note can anybody tell me what the -tiled and
-disabledtile options do or are for?  Can't find them documented anywhere

I have never used either of them - but I recall that they didn't work on
Windows.



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth is out of the office on company business returning 9/22

2006-09-19 Thread Jack Roth

I will be out of the office starting  09/19/2006 and will not return until
09/22/2006.

Please contact Danny Null, Le Nguyen, or Don Sperling for assistance.



The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth is out of the office returning 7/10

2006-07-26 Thread Jack Roth

I will be out of the office starting  07/26/2006 and will not return until
08/07/2006.

Please contact Danny Null or Le Nguyen for assistance.



The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: [perl-win32] RE: Win32::Printer - Multiple Line Output

2006-06-12 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Robert May
> Sent: June 8, 2006 6:54 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Re: [perl-win32] RE: Win32::Printer - Multiple Line Output
> 
> Try using 'Draw Mode' (DM) rather than 'String Mode' (SM) - 
> that means using the
>$height = $dc->Write($text, $x, $y, $width, $height, 
> [$format, [$tab_stop]]); form of the Write() call.
> 
> Rob.

Thanks Rob. Edgar's reply was the same - i.e. use the draw mode. This is
just a follow up for others who might be needing this.

He also gave another option which is what I ended up implementing. Put each
element of the array in a loop and increment the location on the page.
Working code follows!

use Win32::Printer;

my @array = keys %ENV;

printAlpha();

sub printAlpha {
  my $dc = new Win32::Printer(
papersize   => A4,
description => 'Test Print',
unit=> 'pt')
or die "Failed to create object";

  if ($dc) {

 my $font = $dc->Font('Times New Roman', 10);
 $dc->Font($font);
 $dc->Color(0, 0, 0);
   my $v = 10;
   foreach my $line (@array) {
   $dc->Write($line, 10, $v);
 $v+=10;
   }
   $dc->Close;
  }
}

__END__

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::Printer - Multiple Line Output

2006-06-08 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris Wagner
> Sent: June 8, 2006 5:08 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Re: Win32::Printer - Multiple Line Output
> 
> Try it without the \r.  PerlIO should supply it as needed.  
> Just use \n.

That was the first one I tried :-).

Timothy suggested in a private e-mail to use a PRN filehandle. I've never
done that before. Any simple examples of just printing plain text data to a
printer?

> 
> At 03:55 PM 6/8/2006 -0600, Jack D. wrote:
> >I'm trying to print multiple lines to Win32::Printer 
> *without* using a 
> >temporary file. Everytime it mushes the data into one line 
> with little 
> >boxes being printed where the carriage returns are. Can 
> anyone help me out here?
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::Printer - Multiple Line Output

2006-06-08 Thread Jack D.

> -Original Message-
> From: Timothy Johnson [mailto:[EMAIL PROTECTED] 
> Sent: June 8, 2006 4:31 PM
> To: Jack D.; perl-win32-users@listserv.ActiveState.com
> Subject: RE: Win32::Printer - Multiple Line Output
> 
> 
> Maybe try /r/f instead of /r/n?
>

I tried "\r\f" ( backslashes:-) ) with the same erroneous one-line result.
Any other ideas? So far I'm down 12 pieces of paper trying to figure this
out. In desperation, I have sent a direct e-mail to the author. I'll post a
follow-up if I get a reply. In the meantime - I'm open to any other
solutions.


> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jack D.
> Sent: Thursday, June 08, 2006 2:55 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Win32::Printer - Multiple Line Output
> 
> I'm trying to print multiple lines to Win32::Printer 
> *without* using a temporary file. Everytime it mushes the 
> data into one line with little boxes being printed where the 
> carriage returns are. Can anyone help me out here?
> 
> ##Sample Code##
> use Win32::Printer;
> 
> my @array = keys %ENV;
> 
> printAlpha();
> 
> sub printAlpha {
>   my $dc = new Win32::Printer(  papersize   => A4,
> description => 'Test Print',
> unit=> 'mm') or 
> die "Failed
> to
> create object";
>   if ($dc) {
>my $textToPrint = join("\r\n",@array);
>    my $font = $dc->Font('Times New Roman', 12);
>$dc->Font($font);
>$dc->Color(0, 0, 0);
>$dc->Write($textToPrint, 10, 10);
>$dc->Close;
>   }
> }
> __END__
> 
> 
> Jack
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::Printer - Multiple Line Output

2006-06-08 Thread Jack D.
I'm trying to print multiple lines to Win32::Printer *without* using a
temporary file. Everytime it mushes the data into one line with little boxes
being printed where the carriage returns are. Can anyone help me out here?

##Sample Code##
use Win32::Printer;

my @array = keys %ENV;

printAlpha();

sub printAlpha {
  my $dc = new Win32::Printer(  papersize   => A4,
description => 'Test Print',
unit=> 'mm') or die "Failed to
create object";
  if ($dc) {
 my $textToPrint = join("\r\n",@array);
 my $font = $dc->Font('Times New Roman', 12);
 $dc->Font($font);
 $dc->Color(0, 0, 0);
 $dc->Write($textToPrint, 10, 10);
   $dc->Close;
  }
}
__END__


Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Program with popup won't exit

2006-05-25 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Lyndon Rickards
> Sent: May 25, 2006 6:23 PM

> I guess the repeat event doesn't go away with the window... 
> observe what happens if instead of calling the Quit sub you do...
> $window->repeat(1000, sub { print "Howdy\n"});

To kill a timer you just use the cancel method on the id returned when you
create the timer.

If you want to do this before exiting then put it under the OnDestroy hook.

use Tk;
use strict;

my $var;
my $mw=tkinit;
$mw->Label(-textvariable=>\$var)->pack;
my $timer=$mw->repeat(100,
 sub{
   $var=sprintf("%03d",int(rand(100)));
 });
$mw->OnDestroy(\&killTimer);
MainLoop;

sub killTimer
{
 warn "Killing timer";
 $timer->cancel;
}

warn "Exiting Program";

__END__

Also I always end my Tk programs using $mw->destroy. This way you can run
the code after the MainLoop if needed. It also avoids namespace problems.
Tk::exit vs. CORE::exit.

Jack
PS. I couldn't find the original message on this thread. Is this still the
"in your face" notice that you wanted to have Lyle? 

> 
> My instinct is to give up and try something different
> 
> #!perl -w
> 
> use strict;
> use Tk;
> use Tk::StayOnTop;
> 
> 
> my $MW = tkinit;
> # You *really* want to fullscreen? se screenwidth and 
> screenheight for these..
> my $width = 300;
> my $height = 150;
> # Creat geometry string to center
> my $geom = $width . 'x' . $height . '+' . (($MW->screenwidth/2) -
> ($width/2)) .
> '+' . (($MW->screenheight/2) - ($height/2)); $MW->geometry($geom);
> 
> # Prevent closing with X button
> $MW->protocol('WM_DELETE_WINDOW', sub {}); $MW->Label(-text 
> => 'Your session is about to terminate', -font => 'bold')
> ->Tk::grid( -column => 0,
> -row => 0,
> -pady => 15);
> 
> my $b = $MW->Button(-text => 'You Have Been Warned!',
>  -command => sub {Tk::exit})->
> Tk::grid(-column => 0,
> -row => 1,
> -pady => 15);
> 
> # The delay here is to allow widget to render before forcing 
> # to front - workaround to avoid 'UpdateWrapper: Failed to 
> create container'
> # crash from some (mostly XP) clients
> $MW->after(500,sub {$MW->stayOnTop});
> 
> # Call sub to ensure window pops back up is minimized..
> maintainWindow(500);
> 
> MainLoop; 
> 
> sub maintainWindow
> {
> my $delay = shift;
> $MW->deiconify;
> $MW->after($delay, sub {maintainWindow($delay)}); } 
> 
>  - Lynn.
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: variable issue when creating muliple Label/Entry on the fly in Tk

2006-05-25 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul
> Sent: May 25, 2006 3:25 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: variable issue when creating muliple Label/Entry on 
> the fly in Tk
> 
> Hi All,
> 
> My sample program work ok except that I don't know how to 
> make multiple unique variable name in the entry box of the 
> &BUILD_NEW subroutine.
> Basically how the program work is the user enter an integer x 
> for the number of section and based that, x number of Label 
> adn Entry box get created.
> Can anybidy help?

Use a hash.
 
> #!/usr/local/bin/perl
> 
> use strict;
> use Tk;
>
[heavy snipping]
##
  my %entry;
##
> my $mw;
> my $main;
###>$midf->Entry( -width => 10, -textvariable => \$sec.$i )
##
  $midf->Entry( -width => 10, -textvariable => \$entry{$i} )
##

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: A system modal dialog box?

2006-05-19 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Lyle Kopnicky
> Sent: May 18, 2006 6:41 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: A system modal dialog box?
> 
> Hi folks,
> 
> I need to create a dialog box in my application that prevents 
> the user from doing anything else on the system until OK is 
> clicked. That is, the user may not interact with any other 
> windows, of any applications, during this time. It would be 
> best if the dialog box was asynchronous, so the application 
> could continue to process timer signals while waiting for the 
> user to click OK.

Is that the only choice you are offering? One "OK" button? Why would you
need to stop all applications from being accessed to just to press a button?
I would rethink what you *really* need here. Perhaps you could describe a
bit more about *why* you need to lock out all applications :-)

> 
> I'm using TK in my application, so I looked at the Tk::Dialog method. 
> With that, you can make the dialog "local" or "global". I 
> tried "global", but it didn't prevent me from interacting 
> with other windows.

I personally hate modal dialogs - there are usually better ways to present
information to your users - or to get data input. Having been on the user
end of modal dialogs for years - most people have become immune to the
constant hassle of having to click on an OK button, only to just to continue
on with user-interaction. At a bare minimum it should offer the user a
choice.

> 
> Is there a Win32 call that can do this? I read about the 
> MessageBox function, which lets you specify SYSTEMMODAL, but 
> it says that doesn't stop the user from interacting with 
> other applications, either.
> 
> Any ideas? Thanks.

Read a bit more about modal dialogs.

Alan Cooper (father of Visual Basic)has written what I consider to be a very
scathing book (About Face) about bad UI design and much of the content
relates to dialog boxes. It is a good read for anyone interested in making
user-friendly GUIs. I have read "About Face" but I see that he has a new one
out. I'll have to get a copy of that too.

http://www.cooper.com/content/insights/cooper_books.asp

Here are some excerpts from his book:
http://www.ercb.com/feature/feature.0005.html

A site from Googling which has similar reaction to dialogs:
http://www.seebs.net/ops/ibm/cranky12.html

--
Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: stop a Windows application from within a Perl script

2006-04-17 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Dan Jablonsky
> Sent: April 17, 2006 8:00 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: stop a Windows application from within a Perl script
> 
> Hi all,
> I have a very simple script that pings the outside world and 
> reboots a router when it gets no answer to the ping anymore; 
> on top of that I need to stop and start again a windows application.
> I know how to start the app and I know how to stop it if it 
> were unix -> to stop the app, just kill the associated process ...
> How does one do this in Windows?

If you start the application using Win32::Process you would just kill it
using the pid (similar to unix) Win32::Process::KillProcess($pid)

J.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth is out of the office in training, returning 2/27

2006-02-20 Thread Jack Roth

I will be out of the office starting  02/20/2005 and will not return until
02/27/2006.




The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Does a Perl module already exist for this?

2006-02-14 Thread Jack D.
>From: [EMAIL PROTECTED]
>On Behalf Of John Townsend
>Sent: February 14, 2006 3:55 PM
>To: perl-win32-users@listserv.ActiveState.com
>Subject: Does a Perl module already exist for this?
>   
>In my Perl scripts I often need to perform two basic math/statistical
operations:
>
>1. given a list of numbers, return their average
>2. given a list of numbers, toss the highest and the lowest, return the
result
>
>I already have Perl functions that perform these tasks, but I suspect
there's
> a Perl module out there that does this for me. Any suggestions?

Perhaps: 

http://search.cpan.org/~brianl/Statistics-Lite-1.03/Lite.pm

..might suit your needs.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth is out of the office, returning 11/21

2005-12-25 Thread Jack Roth

I will be out of the office starting  12/23/2005 and will not return until
01/03/2006.




The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Calling parent's method

2005-12-19 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ? 
> Sent: December 19, 2005 7:48 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Calling parent's method
> 
> Why is that
> 
> $text_undo = $down_packer1->Scrolled(
>   'TextUndo',
>   -scrollbars => 'osoe',
>   -height => 20,
>   -width => 80,
>   -font => "$text_font $text_size",
>   -wrap => 'none',
> )->pack(
>   -fill => 'both',
>   -expand => 1,
>   -side => 'top',
>   -pady => 7,
> );
> 
> ...
> 
> $text_undo->Tk::Text::delete('1.0', 'end'); #I need 
> Tk::Text::delete in order not to disturb UNDO stack
> 
> throws an error:
> Tk::Error: bad option "delete": must be cget, or configure at 
> c:/Perl/site/lib/Tk.pm line 252.
>  Tk callback for .frame.frame
>  
>  (command bound to event)
> 

The problem here, is that you don't have the reference to the actual
TextUndo widget but to the Tk::Frame housing the TextUndo and the scrollbars
(i.e. that is what the "Scrolled" method returns).

To get the reference to the TextUndo widget:

$real_text_undo = $text_undo->Subwidget('scrolled');

Now the following should work:

$real_text_undo->Tk::Text::delete('1.0','end');

Jack

PS..I assume you wish to do this because you want to delete something
programmatically but not affect the users undo functionality? I hope not.
Because you "will" affect the undo functionality. You would be deleting
stuff which will likely be in the undo list and then it won't behave as
expected.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Text::ReplaceSelectionsWith()

2005-12-19 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ? 
> Sent: December 19, 2005 5:39 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Tk::Text::ReplaceSelectionsWith()
> 
> Hi, all.
> 
> Why is that if I make
> 
> $text->selectAll;
> $text->ReplaceSelectionsWith("nah\nbah\nvah");
> 
> I only get:
> bah
> vah
> 
> as a result (ActivePerl 5.8.7.813)?

Hmm? Not sure - but put another \n before nah and it works fine. It likely
has to do with the 'mark' positioning.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Text::FindAndReplaceAll()

2005-12-19 Thread Jack D.

Here is a reply received from Slaven Rezic on the ptk mailing list:

"Jack D." <[EMAIL PROTECTED]> writes:

>  
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf 
> > Of ? 
> > Sent: December 16, 2005 7:34 AM
> > To: perl-win32-users@listserv.ActiveState.com
> > Subject: Tk::Text::FindAndReplaceAll()
> > 
> > I have a Tk::TextUndo widget. It has context menu which also holds 
> > Replace option.
> > I put a single word 'gallo' as a text. Than choose Replace
> > (Direction: any, Mode: regexp, Case: any), put '.*' as a pattern and 
> > whatever as a replacement. Push "ReplaceAll". Works fine.
> > Now I put as a text 'gallo' and from the next line 'ballo'. 
> > Than choose Replace (Direction: any, Mode: regexp, Case: 
> > any), put '.*' as a pattern and non-empty replacement. Push 
> > "ReplaceAll". The result - application is hanged (100% CPU 
> > consumption). Works fine however if replacement is empty.
> > 
> > This wouldn't be the issue if
> > $text_undo->FindAndReplaceAll('-regexp', '-case', qr/.*/, 
> > 'whatever'); didn't behave the same nasty way.
> > 
> > Is it something I missed or is there a bug in Tk (ActivePerl 
> > 5.8.7.813)?
> 
> Seems like a bug in the FindNext subroutine of Tk::Text. Basically 
> using (.) or (.*) doesn't seem to work properly.
> i.e. the program gets stuck in a while loop because the $saved_insert 
> never matches the $compared_index in the source code. I have cc'd the 
> ptk mailing list for their thoughts.
> 

If you add

   ($direction eq '-forward' ? 'end' : '1.0')

as last argument of both search() calls in Tk::Text::FindNext(), then the
search has a stopindex and it seems to work. But it's unclear to me if this
is the correct solution, because it prevents from "wrapping" the search.
Anyway, what's the exact semantics of FindNext?
Maybe it's better to give FindNext() another optional argument for the
stopindex?

Regards,
Slaven
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Text::FindAndReplaceAll()

2005-12-16 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ? 
> Sent: December 16, 2005 7:34 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Tk::Text::FindAndReplaceAll()
> 
> I have a Tk::TextUndo widget. It has context menu which also 
> holds Replace option. 
> I put a single word 'gallo' as a text. Than choose Replace 
> (Direction: any, Mode: regexp, Case: any), put '.*' as a 
> pattern and whatever as a replacement. Push "ReplaceAll". Works fine.
> Now I put as a text 'gallo' and from the next line 'ballo'. 
> Than choose Replace (Direction: any, Mode: regexp, Case: 
> any), put '.*' as a pattern and non-empty replacement. Push 
> "ReplaceAll". The result - application is hanged (100% CPU 
> consumption). Works fine however if replacement is empty.
> 
> This wouldn't be the issue if
> $text_undo->FindAndReplaceAll('-regexp', '-case', qr/.*/, 
> 'whatever'); didn't behave the same nasty way.
> 
> Is it something I missed or is there a bug in Tk (ActivePerl 
> 5.8.7.813)?

Seems like a bug in the FindNext subroutine of Tk::Text. Basically using (.)
or (.*) doesn't seem to work properly.
i.e. the program gets stuck in a while loop because the $saved_insert never
matches the $compared_index in the source code. I have cc'd the ptk mailing
list for their thoughts. 

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Problem (bug?) in Perl/Tk

2005-12-07 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sisyphus
> Sent: December 7, 2005 1:00 AM
> To: perl-win32-users
> Cc: [EMAIL PROTECTED]
> Subject: Fw: Problem (bug?) in Perl/Tk
> 
> 
> - Original Message -
> From: "Geoff Horsnell" <[EMAIL PROTECTED]>
> To: "Sisyphus" <[EMAIL PROTECTED]>
> Sent: Wednesday, December 07, 2005 7:53 AM
> Subject: RE: Problem (bug?) in Perl/Tk
> 
> 
> > Thanks for your comment. I first tried updating the version 
> of Perl to
> 5.8.7
> > to see if that cured the problem. It didn't. So, here is a 
> cut down perl
> > script that demonstrates the problem. I attach the file. 
> Feel free to
> submit
> > it to the user group - I wasn't sure how to link it with my earlier
> text
> >
> 
> Best way is to just reply to the list in the same thread and 
> provide the
> script in the body of the email (not as an attachment).
> No problem  this post does it for you :-)
> 
> If you still don't get help, try the 'ptk' mailing list. (For 
> details, go to
> http://lists.cpan.org and click on the link to ptk. Search 
> their archive
> first, as the problem might already have been covered.)
> 
> Here's the script folks :
> 
> use Tk;
> use Tk::Button;
> use Tk::Canvas;
> use Tk::DialogBox;
> use Tk::Tiler;
> 
> use strict;
> use warnings;
> 
> # TEXT: Run this simple program. It creates a window entitled 
> "Tryit". It
> has one
> # menu item, entitled "Select". If you left click on 
> "Select", a sub-menu
> appears
> # with "Enter". Left click on "Enter" and an Entry sub-window
> appears,entitled
> # "Single Entry", with both an entry line, and two buttons, 
> entitled"Accept"
> # and "Cancel". Selecting the "Cancel" button closes the 
> window. However,
> selecting
> # the "Close" button on the title bar should also close the 
> window. It does
> for
> # the main window ("tryit"), but NOT for the sub-window 
> ("Single Entry").
> 
> # Why is this?
> 
> $::mWin = MainWindow->new;
> $::mcanvas = $::mWin->Canvas(-height=>"5.c", -width=> "5.c");
> $::mcanvas->pack(-expand => 1, -fill => "both");
> $::topl = $::mWin->toplevel;
> $::menub1 = $::topl->Menu(-type => "menubar");
> $::topl->configure(-menu => $::menub1);
> $::menu1 = $::menub1->cascade(-label => "Select", -underline 
> => 0, -tearoff
> => 0);
> $::menu1->pack;
> $::menu1->command(-label => "Enter", -underline => 0, -command =>
> \&setEnter);
> $::menu1->pack;
> &::MainLoop;
> exit;
> 
> sub setEnter {
> my ($dialogb, $t1, $t1a, $t1b, $diagb, $val);
> $dialogb = $::mWin->DialogBox (-title => "Single Entry", -buttons =>
> ["Accept", "Cancel"]);
> $t1 = $dialogb->Tiler (-columns => 2, -rows => 1);
> $t1a = $t1->Message (-justify => "right", -text => "Enter 
> Value", -width =>
> 100);
> $t1b = $t1->Entry (-textvariable => \$val);
> $t1b->get;
> $t1->Manage ($t1a, $t1b);
> $t1->pack;
> $diagb = $dialogb->Show;
> return;
> }
> 
> __END__
> 
Thanks for forwarding this on Rob. I was going to reply to the first post -
but wasn't sure if Geoff was using a dialog or not (..however, I did suspect
so)

Geoff can do one of two things:

1) Patch the Dialogbox.pm. It can be found at:

http://groups.google.ca/group/comp.lang.perl.tk/msg/716684a805e27143

or

2) Bind the WM_DELETE_WINDOW protocol to invoke the cancel button in the
program itself. To do this put the following code directly after the
creation of the dialogbox.

$dialogb->protocol('WM_DELETE_WINDOW'=> sub {
 $dialogb->Subwidget("B_Cancel")->invoke;
 }); 

HTH.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Multiple bindings in Tk

2005-11-27 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ? 
> Sent: November 25, 2005 7:23 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Multiple bindings in Tk
> 
> Hello, perl Users.
> 
> I've been playing with Tk and encountered that I can't (or 
> possibly don't know how to) bind more than one callback to 
> the particular sequence (on the same tag level).

It's as easy as wrapping each callback you want triggered in a subroutine.

$widget->bind(',[\&yourcallback,@args]);

sub yourcallback
{
   my @args = @_;
   anothercallback(@args);
   yetanothercallback(@args);
   etc. etc.
}
sub another callback
{
#etc.
}
sub yetanothercallback
{
#etc.
}
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth is out of the office, returning 11/21

2005-11-17 Thread Jack Roth
I will be out of the office starting  11/17/2005 and will not return until
11/21/2005.






The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: on weird perl/tk behavior in new version of perl

2005-11-14 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: November 14, 2005 12:32 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: on weird perl/tk behavior in new version of perl
> 
> i ALL!
> I HAVE "OLD" version of perl
> =
> perl -v:
> This is perl, v5.8.6 built for MSWin32-x86-multi-thread (with 
> 3 registered patches, see perl -V for more detail) Copyright 
> 1987-2004, Larry Wall Binary build 811 provided by 
> ActiveState Corp. http://www.ActiveState.com ActiveState is a 
> division of Sophos.
> Built Dec 13 2004 09:52:01

It's not *that* old - it's what I'm using :-)

> ==
> and "NEW" version
> perl -v:
> =
> This is perl, v5.8.7 built for MSWin32-x86-multi-thread (with 
> 7 registered patches, see perl -V for more detail) Copyright 
> 1987-2005, Larry Wall Binary build 813 [148120] provided by 
> ActiveState http://www.ActiveState.com ActiveState is a 
> division of Sophos.
> Built Jun  6 2005 13:36:37
> =
> there is my snippet:
> ++
> use strict;
> use warnings;
> use Tk;
> my $top = new MainWindow;
> my $text=$top->Scrolled("Text");
> $text->configure(-height=>'20',-width=>"40",-font=>'Courier_ne
> w_koi8r');
> $text->pack(-side=>'top',-fill=>'none');
> MainLoop;
> +++
> I Have winxp sp2 -  russion version
> OLD perl is OK
> but in NEW perl
> when after switching keyboard
> to russian language
> I try to type some symbols into text widget I see some 
> greek-?/garbage-? symbols appearing not in cursor position 
> but in end of line ! 
> as a consequence
> All my perl/tk modules in NEW
> perl are not working!
> and here is my question :
> why it is so and howto
> remedy it (short of ditching new version of perl ) ?
> thanks in advance.

Here is a link which discusses a similar problem on the Tk mailing list.
Perhaps the work-around will work for you.

http://groups.google.ca/group/comp.lang.perl.tk/msg/9b3ae0716999834b

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


NET::FTP::RECURSIVE question on Win32

2005-09-02 Thread Jack Lail



I'm stuck tyring to do a 
small program that ftp the contents of adirectory. I'm trying to use 
Net::FTP::Recursive on a Win XP machien.It logs in, but doesn't send the 
files because I'm not sure what toput in your &yoursub and CommandDir 
areas.From the man pagesrput ( [ParseSub => 
\&yoursub] [,DirCommand => $cmd] [,FlattenTree=> 1] 
[,RemoveLocalFiles => 1])The recursive put method call. This will 
recursively send the localcurrent working directory and its contents to the 
ftp object'scurrent working directory.This method will take an 
optional set of arguments to tell it whatthe local directory listing command 
will be. By default, this is``ls -al''. If you change the behavior through 
this argument, youprobably also need to provide a ParseSub, as described 
above.my code==#!/usr/bin/perl 
-wuse Net::FTP;use Net::FTP::Recursive;my $home = 
"c:\\test";my $server = "[my host]";my $username = "{my 
username]";my $password = "[my paasword]";chdir($home) || die 
"cannot cd to $home ($!)";$ftp = 
Net::FTP::Recursive->new("$server",Timeout => 30,Debug => 
1)or die "Cannot [EMAIL PROTECTED]";print 
"OK\n";$ftp->login($username, $password)or die "Login Not 
Accepted. 
\n";$ftp->binary();$ftp->cwd('docs/lail');$ftp->rput(ParseSub 
=> \&yoursub,DirCommand => $cmd,FlattenTree=> 
1);$ftp->quit;===If I leave out DirCommand 
part, I get...'ls' is not recognized as an internal or external 
command,operable program or batch file.Undefined subroutine 
&main::yoursub called atC:/Perl/site/lib/Net/FTP/Recursive.pm line 
391.I tried DireCommand = > `dir` ... and got...'Volume' is 
not recognized as an internal or external command,operable program or batch 
file.===I'm not hung up on using 
Net::FTP::Recursive... so if you can pointto something that works to send 
the contents of a the local filedirectory to a remote server, I'd appreciate 
it.The only ohter thing I haven't tackled is that I really only want 
tosend files that end in "*.jpg" ... the folder should only havethose, 
but it would be a nice filter.-- jack 
lail
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Trap window close

2005-08-25 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: August 25, 2005 3:06 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Trap window close
> 
> Hi,
> 
> Have looked at sigint to trap the "window close" event but am 
> a little lost.
> 
> We run some scripts in cmd prompt windows on win2k and I 
> would like to ignore it if someone accidentally clicks the 
> 'x' to close the window. Is that possible? Does someone have 
> a bit of code?
> 

I posted some code such as this a couple of years back. It got reposted on
this list ..

http://aspn.activestate.com/ASPN/Mail/Message/1467974

You will have to obviously edit it for your needs - but it shows that it is
possible to do.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is out of the office.

2005-07-28 Thread Jack Roth
I will be out of the office starting  07/28/2005 and will not return until
08/03/2005.

Please call Don Sperling at 678-319-2668 or 678-428-1108




The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is out of the office.

2005-06-09 Thread Jack Roth
I will be out of the office starting  06/09/2005 and will not return until
06/22/2005.

Please call Don Sperling at 678-319-2668 or 678-428-1108




The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: TK Question

2005-06-03 Thread Jack D




From: Jim Hansen <[EMAIL PROTECTED]>
To: perl-win32-users@listserv.ActiveState.com
Subject: TK Question
Date: Thu, 2 Jun 2005 06:56:51 -0700 (PDT)

I've been able to finally get TK:Statusbar to work,
but still not sure how to get rid of the buttons.  I
would like this to automatically launch the "Start"
subroutine w/o pressing a button to do it.  Anyone
have experience with TK in bypassing the need for
human interaction?  I would Post this to the TK group,
but there doesn't seem to be anyway to subscribe to
it.  Thanks in advance.


use Tk;
use Tk::ProgressBar;
use strict;
use Warnings;
my $percent_done = 0;

my @colors = ( Omitted on purpose )

my $mw = MainWindow->new;
my $text = "Percentage to date: $percent_done";
$mw->title('Progress Bar');
my $message = $mw->Message(-textvariable => \$text,
-width => 130,-border => 2);

my $progress = $mw->ProgressBar(-width => 20,-length
=> 400, -from => 0, -to => 100, -gap=>0,
   -anchor => 'w',-blocks =>
20,-troughcolor=>'white',-colors=>[EMAIL PROTECTED],
   -variable => \$percent_done);

my $exit = $mw->Button(-text => 'Exit',
  -command => [$mw => 'destroy']);
my $get = $mw->Button(-text => 'Press to start!',
  -command => \&start);

$get->pack;
$progress->pack;
$message->pack;
$exit->pack;


# Start the start routine after the MainLoop

$mw->after(50, \&start);



MainLoop;

sub start {
  My Program goes here..

  $mw->update;

}





___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: drag'n'drop onto desktop icon ???

2005-05-30 Thread Jack D.
 

> -Original Message-
> From: Jack D. [mailto:[EMAIL PROTECTED] 
> Sent: May 30, 2005 11:57 PM
> To: 'perl-win32-users mailing list'
> Subject: RE: drag'n'drop onto desktop icon ???
> 
>  
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] 
> On Behalf 
> > Of Glenn Linderman
> > Sent: May 30, 2005 3:08 PM
> > To: Ken Cornetet
> > Cc: perl-win32-users mailing list; Michael D Schleif
> > Subject: Re: drag'n'drop onto desktop icon ???
> 
> [snip]
> 
> > Jack's solution may be best of all, but it gets into magic 
> hex strings 
> > and object IDs, which most people don't understand.  And although I 
> > don't know for sure what he means by "any icon with the .pl 
> > extension", since icons have .ico extensions, I'm guessing 
> that what 
> > he means is that any file with the .pl extension, displayed 
> in Windows 
> > Explorer as an icon in a file listing, can then be dropped to.
> 
> I don't profess to understand it either :-) (if I did - I 
> would definitely be in the wrong profession)
> 
> I'll probably screw up this explanation too - but here goes.
> A desktop icon is linked to either a file/program/folder or a 
> shortcut to a file/program/folder. So if we assume that the 
> .pl extension is linked to perl.exe - and the file/program 
> that the icon *represents* has a .pl extension, then any 
> files dropped onto this icon will have their associated full 
> pathnames available in @ARGV of the associated perl script.
> 
> The class ID I used is the .exe drop handler which is somehow 
> linked magically to shell32.dll. The same handler is used for 
> the following
> classes:
> 
> - batfile, cmdfile, comfile, exefile, piffile, scrfile, shcmdfile
> 
> All my script did was to add it to the perlfile class too. 
> Bills solution effectively does the same thing but through 
> the batfile class.
> 
> Of course Glenn is correct that with this new handler, a perl 
> program within a file/folder listing in windows explorer will 
> also accept a drop. This makes sense as the "desktop" is just 
> a folder itself ..
> 
> J.

Oops - I forgot - one last thing. Indeed it *is* the short names which are
dropped.

Put this script in a file on your desktop and drop stuff to see the
arguments.
###
use Tk;
my $mw=tkinit;
my $t=$mw->Scrolled('Text')->pack;
$t->insert('end',"$_\n") for (@ARGV);
$t->see('end')
MainLoop;
###

J.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: drag'n'drop onto desktop icon ???

2005-05-30 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Glenn Linderman
> Sent: May 30, 2005 3:08 PM
> To: Ken Cornetet
> Cc: perl-win32-users mailing list; Michael D Schleif
> Subject: Re: drag'n'drop onto desktop icon ???

[snip]

> Jack's solution may be best of all, but it gets into magic 
> hex strings and object IDs, which most people don't 
> understand.  And although I don't know for sure what he means 
> by "any icon with the .pl extension", since icons have .ico 
> extensions, I'm guessing that what he means is that any file 
> with the .pl extension, displayed in Windows Explorer as an 
> icon in a file listing, can then be dropped to. 

I don't profess to understand it either :-) (if I did - I would definitely
be in the wrong profession)

I'll probably screw up this explanation too - but here goes.
A desktop icon is linked to either a file/program/folder or a shortcut to a
file/program/folder. So if we assume that the .pl extension is linked to
perl.exe - and the file/program that the icon *represents* has a .pl
extension, then any files dropped onto this icon will have their associated
full pathnames available in @ARGV of the associated perl script.

The class ID I used is the .exe drop handler which is somehow linked
magically to shell32.dll. The same handler is used for the following
classes:

- batfile, cmdfile, comfile, exefile, piffile, scrfile, shcmdfile

All my script did was to add it to the perlfile class too. Bills solution
effectively does the same thing but through the batfile class.

Of course Glenn is correct that with this new handler, a perl program within
a file/folder listing in windows explorer will also accept a drop. This
makes sense as the "desktop" is just a folder itself ..

J.

 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::OLE Can you call ShowOpen Method

2005-05-23 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: May 23, 2005 7:01 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Win32::OLE Can you call ShowOpen Method 
> 
> Hello All,
> 
> I would like to use OLE to access the common dialog control.  
> I can get access to a number of methods however the ShowOpen 
> does not work.  Is it possible to use show open to get a File 
> Open Dialog.  I can do this using Win32::GUI and TK, however 
> it would be neat to do it here. 
> 
> Any help would be great.
> 
> Mark
> 
> Olegui.pl
> 
>  -w;
> 
> use strict;
> 
> use Win32::OLE;
> 
> my $CommDlg = Win32::OLE->new("MSComDlg.CommonDialog")|| die 
> "Could not start Common Dialog\n";
> 
> $CommDlg->ShowPrinter;
> 
> $CommDlg->AboutBox;

It looks like OLE wants a few properties to be defined first. Defining only
MaxFileSize did it for me - but I would also add the filters you want too.

  $CommDlg->{MaxFileSize} = 400;
  $CommDlg->{Filter} = "All(*.*)|\*.\*";
  $CommDlg->ShowOpen;

Another option is Win32::FileOp::OpenDialog 

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: drag'n'drop onto desktop icon ???

2005-05-23 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michael D Schleif
> Sent: May 22, 2005 11:29 PM
> To: perl-win32-users mailing list
> Subject: drag'n'drop onto desktop icon ???
> 
> I have a perl program that successfully processes a set of text files.
> So far, the UI is to pass the incoming text file to the 
> program on the command line.
> 
> Users want an icon on their desktops, and they want to drag 
> the text file onto this icon, in order to process the file.
> 
> I have not been able to figure out how to do this.
> 
> What do you think?
> 
You can add a DropHandler to the registry manually (or just run the perl
program provided below)

###
use Win32::TieRegistry;
$Registry->Delimiter("/");
$perlKey = $Registry->{"HKEY_CLASSES_ROOT/Perl/"};
$perlKey->{"shellex/"} = {
"DropHandler/" => {
"/"=>"{86C86720-42A0-1069-A2E8-08002B30309D}"
}};
###

Once that is done - any icon with the .pl extension should receive the
filenames in @ARGV.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Custom Properties [was RE: Changing file date info]

2005-05-18 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jerry Kassebaum
> Sent: May 18, 2005 9:44 AM
> To: [EMAIL PROTECTED]
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Changing file date info
> 
> Somewhere I read of an interesting method for marking files 
> for backup. The plan is to mark files that have been backed 
> up with a time that is impossible, like 10:61. Who really 
> cares about the seconds on a file name? I plan to make at 
> least two backups of each file on my computer using this 
> method. In other words I back up a bunch of files and change 
> their seconds to :61. Then I back up again changing them to 
> :62. Then in the future I can do a search to see what needs 
> to be backed up.
> 
> How do I manipulate the file times with Perl?

There may be another interesting method to mark files for backup.

See a recent post of mine regarding Summary Information. You have to have
DSOfile installed first.

http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-users/2519316

There can also be Custom properties associated with a file. So perhaps you
could set a property such as "Last Backup" and put in a value of your
choice. Here is an example:
###
use Win32::OLE;
use strict;
my $file = "C:/test.txt";

#ensure file exists

unless (open (FILE,$file)) {
  print "File not found, creating $file\n";
  open(FILE,">$file");
  close FILE;
}

my $dso = Win32::OLE->new('DSOFile.OleDocumentProperties');
$dso->open($file,0,0);

# See if this file has any custom properties set

unless ($dso->CustomProperties->Count) {
  print "There are no custom properties defined for this file\n";
  print "Setting a custom property named \'Last Backup\'\n";
  $dso->CustomProperties->Add('Last Backup', 1);
  $dso->Save();
}

# Finally - get your custom property
my $result = $dso->CustomProperties->Item('Last Backup');
print "Current \'Last Backup\' property value is : ",$result->Value,"\n";
$dso->Save();

# Now say you backup the file and wish to change
# the property to another number.

my $custominfo = $dso->CustomProperties;
print "Changing \'Last Backup\' to 2\n";
$custominfo->{'Last Backup'} = 2;
$dso->Save();

# Finally - get your new value
$result = $dso->CustomProperties->Item('Last Backup');
print "New \'Last Backup\' value is : ",$result->Value,"\n";
###

Jack

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is in training and out of the office.

2005-04-12 Thread Jack Roth
I will be out of the office starting  04/11/2005 and will not return until
04/15/2005.

If you need assistance for Mainframe call Don Sperling or Danny Null. For
Distributed, call Don Sperling or Prabu Doraisingam




The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: No title bar?

2005-03-23 Thread Jack D.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Lyle Kopnicky
> Sent: March 23, 2005 7:22 PM
> To: perl-win32-users
> Subject: No title bar?
> 
> Hi folks,
> 
> Does anyone know how to create a window without a title bar in Tk?
> 
> If not Tk, then maybe Win32::GUI or wxPerl?

In Tk:

$top->overrideredirect(1); 

See docs for Tk::Wm

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Changing summary information using DSOFile DLL [was RE: adding a title to a file on windows]

2005-03-14 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of $Bill Luebkert
> Sent: March 14, 2005 4:04 AM
> To: Jack D.
> Cc: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Re: Changing summary information using DSOFile DLL 
> [was RE: adding a title to a file on windows]
> 
> Jack D. wrote:
> 
> > I did some more research and found out that you *can* use perl to 
> > change the summaryinfo/extended properties:
> 
> That's good except as near as I can tell that only works for 
> structured storage files like those from M$ Apps (like Excel, 
> Word, etc).

Hmm. I got it to work on those plus *.swf, *.txt, *.exe. I'm sure there must
be more. I tried a png but a normal Comments property isn't even accepted.
The main drawback from what I can see is that "something" must already be in
the properties already otherwise it dies with an error such as:

Win32::OLE(0.1403) error 0x80020009: "Exception occurred"
in PROPERTYPUT "Comments" at dso.pl line 8

> 
> > 1) First you need to download and install the DSOFile DLL 
> from Microsoft:
> > 
> > http://tinyurl.com/5fvte
> > 
> > 2) Create a test file. I chose C:/test.txt.
> > 
> > 3) For some reason the script in #4 won't work unless there is at 
> > least
> > *something* saved in the summary information. So go to windows 
> > explorer and right click on the file, choose Properties and 
> click on the summary tab.
> > Change at least one of the listed properties.
> > 
> > 4) Run this script to change the "Comments" for this file.
> > 
> > use Win32::OLE;
> > use strict;
> > 
> > my $dso = Win32::OLE->new('DSOFile.OleDocumentProperties');
> > $dso->open("C:/test.txt",0,0); #open in write/default mode 
> my $suminfo 
> > = $dso->SummaryProperties; print "Current comments: ", 
> > $suminfo->{'Comments'},"\n"; $suminfo->{'Comments'} = "Do 
> you this new 
> > comment ". scalar gmtime; print "New comments: ", 
> > $suminfo->{'Comments'},"\n"; $dso->close(1); #Save before closing
> > 
> > 5) Write this in a loop to change the properties for 
> various files as 
> > you see fit.
> 
> 
> -- 
>   ,-/-  __  _  _ $Bill Luebkert
> Mailto:[EMAIL PROTECTED]
>  (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
>   / ) /--<  o // //  Castle of Medieval Myth & Magic 
> http://www.todbe.com/
> -/-' /___/_<_http://dbecoll.tripod.com/ (My 
> Perl/Lakers stuff)
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Changing summary information using DSOFile DLL [was RE: adding atitle to a file on windows]

2005-03-12 Thread Jack D.
Oops. My mailer somehow unwrapped the lines of the script. You get the idea
though.

BTW - If someone can figure out how to open up the summary information for a
file with *no* summary information - then please post an example.

Jack

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jack D.
> Sent: March 12, 2005 4:17 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Changing summary information using DSOFile DLL [was 
> RE: adding atitle to a file on windows]
> 
>  
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] 
> On Behalf 
> > Of $Bill Luebkert
> > Sent: March 11, 2005 6:44 PM
> > To: Perl-Win32-Users@listserv.ActiveState.com
> > Subject: Re: adding a title to a file on windows
> > 
> > Jack D. wrote:
> > 
> > > http://cpansearch.perl.org/~empi/
> > > 
> > > I tried it but cannot seem to get a proper object? Anyways
> > - all the
> > > API calls are there if you want to try and code it
> > yourself. You might
> > > be better off going through all the dialogs - you likely
> > could do it
> > > in a shorter timespan :-)
> > 
> > That's just for MSI files.
> >
> 
> You're correct Bill -- as always :-)
> 
> I did some more research and found out that you *can* use 
> perl to change the summaryinfo/extended properties:
> 
> 1) First you need to download and install the DSOFile DLL 
> from Microsoft:
> 
> http://tinyurl.com/5fvte
> 
> 2) Create a test file. I chose C:/test.txt.
> 
> 3) For some reason the script in #4 won't work unless there 
> is at least
> *something* saved in the summary information. So go to 
> windows explorer and right click on the file, choose 
> Properties and click on the summary tab.
> Change at least one of the listed properties.
> 
> 4) Run this script to change the "Comments" for this file.
> 
> use Win32::OLE;
> use strict;
> 
> my $dso = Win32::OLE->new('DSOFile.OleDocumentProperties');
> $dso->open("C:/test.txt",0,0); #open in write/default mode my 
> $suminfo = $dso->SummaryProperties; print "Current comments: 
> ", $suminfo->{'Comments'},"\n"; $suminfo->{'Comments'} = "Do 
> you this new comment ". scalar gmtime; print "New comments: 
> ", $suminfo->{'Comments'},"\n"; $dso->close(1); #Save before closing
> 
> 5) Write this in a loop to change the properties for various 
> files as you see fit.
> 
> Jack
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Changing summary information using DSOFile DLL [was RE: adding a title to a file on windows]

2005-03-12 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of $Bill Luebkert
> Sent: March 11, 2005 6:44 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Re: adding a title to a file on windows
> 
> Jack D. wrote:
> 
> > http://cpansearch.perl.org/~empi/
> > 
> > I tried it but cannot seem to get a proper object? Anyways 
> - all the 
> > API calls are there if you want to try and code it 
> yourself. You might 
> > be better off going through all the dialogs - you likely 
> could do it 
> > in a shorter timespan :-)
> 
> That's just for MSI files.
>

You're correct Bill -- as always :-)

I did some more research and found out that you *can* use perl to change the
summaryinfo/extended properties:

1) First you need to download and install the DSOFile DLL from Microsoft:

http://tinyurl.com/5fvte

2) Create a test file. I chose C:/test.txt.

3) For some reason the script in #4 won't work unless there is at least
*something* saved in the summary information. So go to windows explorer and
right click on the file, choose Properties and click on the summary tab.
Change at least one of the listed properties.

4) Run this script to change the "Comments" for this file.

use Win32::OLE;
use strict;

my $dso = Win32::OLE->new('DSOFile.OleDocumentProperties');
$dso->open("C:/test.txt",0,0); #open in write/default mode
my $suminfo = $dso->SummaryProperties;
print "Current comments: ", $suminfo->{'Comments'},"\n";
$suminfo->{'Comments'} = "Do you this new comment ". scalar gmtime;
print "New comments: ", $suminfo->{'Comments'},"\n";
$dso->close(1); #Save before closing

5) Write this in a loop to change the properties for various files as you
see fit.

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: adding a title to a file on windows

2005-03-11 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Earthlink-m_ryan
> Sent: March 10, 2005 1:26 PM
> To: Perl-Win32-Users@listserv.ActiveState.com; Chris Wagner
> Subject: Re: adding a title to a file on windows
> 
> Chris wrote:
> > The file comments are part of the file itself.  Are u talking about 
> > saving off the long name somewhere for future reference?
> 
> I guess I didn't explain very well. I would like to access 
> the windows file browser functionality in order to add a 
> title or comment to the properties of a file for easy 
> reference through the "Windows Explorer" window.
> This is the dialog box one would access by right clicking on 
> the file in "Windows Explorer" and the summary tab in the 
> properties dialog box. Wether or not this a part of the file 
> itself I can't say.
> I just don't want to go through the files one buy one in the 
> Windows Explorer window and change the name and add a 
> description through properties dialog box.(There are a couple 
> hundred files.)

http://cpansearch.perl.org/~empi/

I tried it but cannot seem to get a proper object? Anyways - all the API
calls are there if you want to try and code it yourself. You might be better
off going through all the dialogs - you likely could do it in a shorter
timespan :-)

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl tk binding question

2005-03-11 Thread Jack D.
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Swartwood, Larry H
> Sent: March 11, 2005 10:22 AM
> To: [EMAIL PROTECTED]; perl-win32-users@listserv.ActiveState.com
> Subject: RE: perl tk binding question
> 
> 
> I'm not sure why but when I change your binding to:
> 
>$li->bind('' =>\&li);
> 
> ...it works.

Because the 'active' index is not set until a button release also.

> 
> This site might explain it:
> http://www-users.cs.umn.edu/~amundson/perl/perltk/bind.htm
> 
> I don't have time to read it all right now.
> 
> --Larry S. 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, March 10, 2005 10:09 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: perl tk binding question
> 
> i All!
> In following snippet
> I have 2 parallel arrays @list and @data and I want on 
> selecting entry in listbox to see corresponding data array 
> element in textbox using UP and DOWN arrows is OK but I have 
> to make 2 mouse clicks to make right selection!
> MY question - how to modify this scheme to made it work with 
> only one mouse click ?
> OR may be there other schemes ?
> and here is the snippet:
> ==
> use strict;
> use Tk;
> require Tk::LabFrame;
> my $top = new MainWindow;
> my $bar=$top->LabFrame(-label => 'buttons bar'); $bar->pack; 
> my $exi=$bar->Button(-command=>\&exi,-text=>'exit');
> $exi->pack(-side=>'left');
> my $fr=$top->LabFrame();
> $fr->configure(-height=>'5',-width=>"30");
> $fr->pack(-fill=>'none');
> my $li=$fr->Scrolled("Listbox");
> $li->configure(-height=>'20',-width=>"20");
> $li->pack(-side=>'left',-expand=>'no',-fill=>'none');
> my $text0=$fr->Text();
> $text0->configure(-height=>'10',-width=>"20");
> $text0->pack(-side=>'top',-fill=>'none');
> $li->bind('<1>' =>\&li);
> $li->bind('' =>\&li);
> $li->bind('' =>\&li);
> my @list=qw/one two three/;
> my @data=qw/data_one... data_two... data_three.../; 
> $li->delete(0,'end'); my %revers; my $i=0; foreach 
> (@list){$li->insert("end",$_);$revers{$_}=$i++}
> $li->focus;
> MainLoop;
> sub exi{
>   $top->destroy;
>   }
> 
> sub li{
>   my $sel=$li->get('active');
>   my $t=$data[$revers{$sel}];
>   $text0->delete('0.0','end');
>   $text0->insert ('0.0',$t) ;
> }
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is in training and out of the office.

2005-02-15 Thread Jack Roth
I will be out of the office starting  02/14/2005 and will not return until
02/21/2005.

For Mainframe call Don Sperling or Danny Null. For Distributed, call Don
Sperling or Prabu Doraisingam




The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Sleep()

2005-01-14 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris
> Sent: January 14, 2005 2:28 PM
> To: perl-win32-users
> Subject: Sleep()
> 
> Is there a way make Perl sleep for less than a full second?
> 
> I'm using v5.8 on win2k.

How come no one has mentioned select? Is it platform dependent? It works on
XP Home..

 select(undef, undef, undef, 0.1); #100ms

Jack
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is out of the office.

2004-12-19 Thread Jack Roth
I will be out of the office starting  12/17/2004 and will not return until
12/27/2004.

For Mainframe call Don Sperling or Danny Null. For Distributed, call Don
Sperling or Prabu Doraisingam



The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: TK - Tablematrix Problems

2004-11-23 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Andrew Mueller
> Sent: November 23, 2004 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: TK - Tablematrix Problems
> 
> Hello,
> 
>  
> 
> I just installed the most recent Perl distribution but I am 
> now having problems when I create a spreadsheet using 
> Tk::TableMatrix::Spreadsheet.  

[snip code]

> 
> 
> 1. When I execute the main program I get an initial message 
> "Had to create Tk::XlibVtab unexpectedly at 
> C:/Perl/lib/DynaLoader.pm line 253", which only appears when 
> I load the Tk::TableMatrix::Spreadsheet and Tk::TableMatrix 
> packages (and the program still runs).  If I remove those 
> packages and execute the main program, there are no error 
> messages (and the program still runs).  
> 
>  
> 
> 2. When I execute the command to create the spreadsheet, 
> (assuming the correct packages are loaded, ie. 
> Tk::TableMatrix::Spreadsheet and Tk::TableMatrix) the 
> following Windows Error message pops up: ' The instruction at 
> "Ox77f5b2ab" referenced memory at "Ox05dc0a14".  The memory 
> could not be "read" '
> 
>  
> 
> Also, the following message is outputted from Perl: 
> 
>  
> 
> 4ddc0ac is not a hash at C:/Perl/site/lib/Tk/Widget.pm line 
> 190,  line 164.
> 
> This application has requested the Runtime to terminate it in 
> an unusual way.
> 
> Please contact the application's support team for more information.
> 
>  
> 
>  
> 
> Does anyone have any suggestions on how to alleviate this 
> problem so that I can get the Spreadsheet widget working again??
> 

I *think* you get this if your Tk::TableMatrix was not built against the Tk
you are using. I was in the same situation last month. The problem with
TableMatrix - is you have to recompile it if you upgrade your Tk. The
problem with all the ppm locations which house TableMatrix - is that while
they all state the perl version, none of them (that I know of) offer you the
selection of choosing based on perl *AND* Tk version.

What is your perl version? Tk version? What site did you get the ppd from?

After I compiled from scratch it works fine. I use AS build 809, perl 5.8.3,
Tk804.027.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE:Tk::Table cusom keys scrolll question

2004-11-22 Thread Jack D.
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: November 21, 2004 10:28 PM
> To: [EMAIL PROTECTED]
> Subject: RE:RE:Tk::Table cusom keys scrolll question 
> _
> thanks !
> may be you suggest
> how I can pack my widgets to
> get matrix  of predefined number rows and cols ?
> thank in advance !

What are you actually trying to do? I may have given you some poor advice. 

Usually when someone wants to grid a bunch of Entry widgets - I start
thinking "spreadsheet". If that is indeed your purpose then don't heed my
previous advice. Instead use Tk::TableMatrix !!

#
use Tk::TableMatrix;
use Tk;

my $var = {};

foreach my $row  (0..50){
  foreach my $col (0..20){
$var->{"$row,$col"} = "Row$row Col$col";
  }
}

my $mw=tkinit;
my $tm = $mw->Scrolled('TableMatrix',
  -scrollbars=>'se',
  -bg=>'white',
  -rows=>51,
  -cols=>21,
  -variable=>\$var)->pack(-expand=>1, -fill=>'both');

MainLoop;
__END__
perldoc Tk::TableMatrix
#

If you still wish to just use a bunch of entries for whatever your purpose -
then
here is a simple example of 'grid'ding some entry widgets:

#
use Tk;
use Tk::Pane;
use strict;

my @entry;
my $mw=tkinit;
my $pane = $mw->Scrolled('Pane')->pack(-expand=>1, -fill=>'both');
foreach my $row (0..50) {
  foreach my $col (0..20) {
$entry[$row][$col] = $pane->Entry(
  -text=>"Row $row Col $col")
->grid(-row=>$row, -column=>$col);
  }
}

MainLoop;
__END__
perldoc Tk::grid
#

There are other table-like widgets but TableMatrix is the most powerful and
most efficient. It all depends on your purpose.

Jack






___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Table cusom keys scrolll question

2004-11-20 Thread Jack D.
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: November 19, 2004 3:07 AM
> To: [EMAIL PROTECTED]

> Subject: Tk::Table cusom keys scrolll question Hi All! I am 
> trying to use Tk::Table consisting of Entry widgets ... Does 
> anybody knows how to impement scroll keys ? this phrase from 
> the docs:  focus then cursor and scr

That has to be the longest subject line I've ever seen?

> 
> Tk::Table cusom keys scrolll question
> Hi All!
> I am trying to use
> Tk::Table consisting of Entry widgets ...
> Does anybody knows how to impement scroll keys ?

If you "only" have entry widgets - then I would question your need to use
Tk::Table at all. Why not just grid or pack your widgets and let the packing
hierarchy determine your focus (previous and next) policy. If you have too
many entry widgets and not enough space try a Scrolled('Pane').

> this phrase from the docs:
>  cursor and scroll keys scroll the displayed widgets.> I dont 
> understand above text.

What this means is that keyboard focus policies will (or should) work if you
set -takefocus=>1

> I want , for example, after  key
> go to the next cell/next col in the row or 1-st col in the 
> next row if on the last col/ Snippets are welcome especially !

Typically a  moves you to the next widget  and a  moves you
backwards. Try it out - but again - reconsider your use of Tk::Table - it
seems like extra overhead you don't really need.

Jack 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl-win32-users@listserv.activestate.com

2004-06-11 Thread Jack D.


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of Arnold Wiegert
> Sent: June 11, 2004 3:05 PM
> To: Perl-Win32
> Subject: TK update via CPAN (&Spinbox)
> 
> I just tried to update my Perl/Tk via CPAN.
> 
> I am running ActiveState perl 5.8.3 with Win32 0.22 and Tk 800.024 and
> was trying to use the Spinbox widget. Seems it can't be found.
> 
> The latest doc on CPAN say it is part of Tk 800.027. So I fired up CPAN
> and tried to install the latest version. After a while (spent
> downloading) CPAN said that since there was no Makefile supplied it
> would generate its own. After a bit more time, CPAN claimed it had
> installed the latest version.
> 
> But when I check, I'm still at Tk 800.024. What happened and how can I
> fix whatever needs fixing?
> 
> I really do want to use the Spinbox; Tk 800.027 claims to have it, but
> short of re-installing Tk again, I'm at al loss.

You can upgrade to Tk804.027 by typing the following at the dos prompt:

ppm install http://www.bribes.org/perl/ppm/Tk.ppd -force

BTW - There is a spinbox-like widget on CPAN called Tk::NumEntry - if you
don't want to upgrade then you can try that instead.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Need more help with Tk

2004-06-09 Thread Jack D.


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of Daniel Peterson
> Sent: June 9, 2004 3:03 PM
> To: [EMAIL PROTECTED]; 'lyndon rickards'; perl-win32-
> [EMAIL PROTECTED]
> Subject: RE: Need more help with Tk
> 
> 
> The following works and opens a text window.
> $Dan = $main->Scrolled(Text,-scrollbars=>'se')->pack;
> 
> How do I resize the window?
>$Dan = $main->Text( -width => 30, -height => 3 );
> Gives me the window size I want but no scroll bars
> 

Is this a trick question :-) ?

use Tk;

my $mw=tkinit;
$mw->Scrolled('Text',-scrollbars=>'se',-width=>30, -height=>3)->pack;
MainLoop;

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Tk Popup centering and minsize.

2004-06-01 Thread Jack D.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of Beckett
> Richard-qswi266
> Sent: June 1, 2004 6:28 AM
> To: '[EMAIL PROTECTED]'
> Subject: Tk Popup centering and minsize.
> 
> Hi Guys,
> 
> Does anyone know if there is a way to get popup to work properly, after
> you've issued a minsize command?
> 
> In the example below, if you comment out the line "$popup2 -> minsize
> (qw(162 190));" in the popup2 sub, then the second popup appears in the
> centre of the main window. With that line in, it appears in the "wrong"
> place.

Yes - it uses the requested size only. So, this is a bug in the Popup
method.

> 
> I know that I can do it by getting the geometry of the main window, and
> the popup window, then calculating the correct position, but I want to use
> the popup method, as it's much simpler.
> 
Then you will have to hack the Wm.pm module. You need to add three lines.
i.e. The middle three as shown below. 

I will supply Nick with a proper patch for the next version.


my ($mw,$mh) = ($w->reqwidth,$w->reqheight); 
my ($minwidth,$minheight) = $w->minsize; #JD#
$mw = $minwidth if (defined $minwidth and $minwidth > $mw); #JD#
$mh = $minheight if (defined $minheight and $minheight >$mh); #JD#
my ($rx,$ry,$rw,$rh) = (0,0,0,0);



While playing/testing I saw another weird behaviour. Tk allows you to define
a maxsize which is smaller than your minsize?!

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl Tk

2004-05-26 Thread Jack D.


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of Eric Edwards
> Sent: May 26, 2004 7:49 PM
> To: [EMAIL PROTECTED]
> Subject: re:Perl Tk
> 
> Perl Tk Gurus,
> 
> I am studying Tk using "Mastering Perl TK".  I found the below listed code
> in the book and got it working,
> 
>  Added some stuff to it and it seems to be working OK.  I wanted to add
> "$textundo->Save(?pathname?)
> 
> so that it saves the contents of the widget to a file.  I want this to
> happen when
> 
> I click on the "Save" button.  I have tried several things but can't get
> it to work.
> 
> Any help would be deeply appreciated.
> 
> The file path is "C:/save".

Well, if you want to use the Save method, then at a minimum you need to

use Tk::TextUndo;

I hope you are not expecting to be able to save the Entry widget data using
this method? If you wish to save that you will have to write your own
subroutine to "get" the input and save it separately.


> 
> #!/usr/bin/perl
> 
> use Tk;

 use Tk::TextUndo;

> $mw = MainWindow->new;
> $mw->title("Text: Data Entry");
> $f = $mw->Frame->pack(-side => 'bottom');
> $f->Button(-text => "Exit",
>-command => sub {exit;})->pack(-side => 'left');
> 
> $f->Button(-text => "Save",
>-command => sub { &print_rec;
> })->pack(-side => 'bottom');
> 
> $t = $mw->Scrolled("Text", -width => 40,

   $t = $mw->Scrolled("TextUndo", -width => 40,
> -wrap => 'none')->pack(-expand => 1, -fill =>
> 'both');
> foreach (qw/Name Address City State Zip Phone Occupation
>Company Business_Address Business_Phone/) {
>$w = $t->Label(-text => "$_:", -relief => 'groove', -width =>
> 20);
>$t->windowCreate('end', -window => $w);
>    %info;
>$w = $t->Entry(-width => 20, -textvariable => \$info{$_});
>$t->windowCreate('end', -window => $w);
>$t->insert('end', "\n");
> }
> #$t->configure(-state => 'disabled');  # disallows user typing


> sub print_rec() {
>@key = keys %info;
>foreach $_ (@key) {
>   print "$_:$info{$_}\n";
>}
 $t->Save("C:/save.txt");
> }
> 
> MainLoop;
> 

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Jack Roth/Inv/MetLife/US is out of the office.

2003-11-26 Thread Jack Roth
I will be out of the office starting  11/26/2003 and will not return until
12/01/2003.

For eservices, R&S, and investments portal, please call pete difondi. For
genam, please call Rick Higginbotham. For all other projects, please call
Don Sperling. Thanks.



The information contained in this message may be CONFIDENTIAL and is for the
intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not the
intended addressee, please notify the sender immediately and delete this
message.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: PerlTk application window disappearing on WinXP

2003-10-24 Thread Jack

- Original Message - 
From: "Igor Litmanovich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 23, 2003 10:41 AM
Subject: PerlTk application window disappearing on WinXP


> Hello,
>
> I am having a problem of tk application window disappearing
> on a WinXP machine. This happens when one program calls
> another one:
>
> Application A opens Tk window, then calls application B and
> waits for it to end. Application B opens its window, but
> when it exits the the window of application A and its icon
> on the taskbar disappear, which is against the logic of the
> program. The process of application A remains in the task
> manager and seems to continue to work.
>
> I use Perl 5.6.1 build 635 and Tk 800.024
>
> Any help will be appreciated.

Give us something to work with..maybe some minimal sample code demonstrating the
problem?

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Keysyms [was] Overiding default bindings in PerlTk

2003-10-06 Thread Jack
- Original Message - 
From: "Dax T. Games" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 06, 2003 10:14 AM
Subject: Re[3]: Overiding default bindings in PerlTk


> Figured it out, mostly.
>
> This disables the arrow key bindings so they don't change the active cell but
it also disables using the arrow keys to navigate text strings within a cell.
Is it possible to turn off cell navigation but still be able to navigate within
a cell.
>
[code stripped]

There are many many class bindings in TableMatrix. The ones you use to navigate
"within" a cell are Control-Left and Control-Right (*arrows*). Try it and you
will see.

Now I'll forecast your next question:

"Now the "mybinding" *Left* and *Right* keys will trigger on a Control-Left and
Control-Right. How do I stop that from happening?"

Put a binding on your control key to set a program wide scoped variable to 1 if
pressed and 0 if released - say $ctrldown. Then simply do a:

return if ($ctrldown);

at the top of your subroutine. I realize that this won't stop your sub from
being called, but it shouldn't matter if you return immediately. This is the
easiest workaround.

Hint: The keysym for the Control key is *not* ''
Hint2: Most keyboards have two ctrl keys.
Hint3: To check your keysyms, you can run this simple program.


use Tk;
use strict;

my $keysym;

my $mw=tkinit;
my $l1=$mw->Label(-textvariable=>\$keysym)->pack();
$keysym="Press Any Key";
$mw->focusForce;
$mw->bind('',\&get);
$mw->bind('',
sub {print "You pressed the Enter key !!\n"});
MainLoop;

sub get
{
my $e=$mw->XEvent;
$keysym= "Keysym is"."\n".$e->K;
}

Jack D.
Remove '__' from address if replying by e-mail.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Spreadsheet-like data entry/editing in PerlTk?

2003-09-30 Thread Jack

- Original Message - 
From: "Lynn. Rickards" <[EMAIL PROTECTED]>
To: "'Dax T. Games'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, September 30, 2003 1:38 PM
Subject: RE: Spreadsheet-like data entry/editing in PerlTk?


>
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]
> > Behalf Of Dax
> > T. Games
> > Sent: Tuesday, September 30, 2003 8:12 AM
> > To: [EMAIL PROTECTED]
> > Subject: Spreadsheet-like data entry/editing in PerlTk?
> >
> >
> > Does anyone know of a Tk widget or have some sample code that
> > would allow data entry and editing like with a spreadsheet in PerlTk.
> >
> > Currently I am familiar with the HList widget but as far as I
> > know it only will list what you populate it with you cannot
> > enter data or edit data.
> >
> > Thanks,
> >
> > Dax
>
>
> http://www.cpan.org/modules/by-module/Tk/
>
> Look for Tk-TableMatrix. Also available on ppm from AS.
>
> -Lynn.

Correct you are, Lynn. Tk::TableMatrix is exactly what Dax needs. There are
numerous sample scripts included with the source. So after you "ppm" it -
download the CPAN source code for the demos.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Controls for Perl?

2003-09-19 Thread Jack
- Original Message - 
From: Doug Loud 
To: [EMAIL PROTECTED] 
Sent: Friday, September 19, 2003 2:16 PM
Subject: Controls for Perl?

>Are there any controls available for perl, such as list boxes,
>etc, so that my users could click on an icon and have a perl
>populated list box appear for their choices/selection?  Or do
>I have to do it through a web browser page like I used to?

use Tk;

Jack
PS. I'm assuming that you want a stand-alone perl program
i.e. not web-based.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Memory leaks

2003-06-19 Thread Jack
- Original Message -
From: "Andrew Mueller" <[EMAIL PROTECTED]>
To: "Thomas Drugeon" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, June 18, 2003 2:00 PM
Subject: Re: Memory leaks


> Thanks for your response Thomas.
> Due to my lack of experience with PERL code, I'm not very sure what that code
> snippit you sent means.  I'm going to attach a couple of lines of the code
> that I've been working with if it's not too much trouble, maybe you could
> suggest how it could be improved upon so that when the window is closed, PERL
> will be able to destroy the entire object.  (Perhaps I should add some lines
> to my Ondestroy method. what might they be??)
>
>  ${$canvasobj->{'canvas'}}->bind($movebox, "", sub {
>
>   &StartMove($canvasobj, $box, $moveclickref, $newboxx1ref, $newboxy1ref,
> $newboxx2ref, $newboxy2ref);
>  });
>
> In the code above, I have an object called $movebox that is drawn onto the
> canvas object $canvasobj.  This snippit is where I bind the initial mouse
> click to start the subroutine that controls the moving of the $movebox
> object.  Is there any way to rewrite the bindings within my $movebox package
> so that when I close the toplevel window to the canvas I am able to break the
> circular reference and thus destroy both the $canvasobj and the $movebox
> object??


It is unlikely that you have a patched Tk800.024 for windows, unless you have
compiled it yourself. That being the case, you have likely just run across the
dreaded canvas leak which is a well-known issue (at least to c.l.p.t. visitors).

Here is a snippet from one of my posts more than two years ago.

### Begin quote ###
I was testing Tk800.023 for canvas memory leaks on Linux RH7.1 Perl 5.6.1.
One thing whiched leaked was using an anonymous sub within a bind like so:

$canvas->bind('myTag', '',sub{print "Here\n"});

But the following does NOT leak:

$canvas->bind('myTag', '',[\&printit,"Here"]);
sub printit {
  print "$_[1]\n";
}
### End quote ###

So, my suggestion is to wrap your sub{} in square brackets...to become
$c->bind('tag','',[sub{blah}]);

Jack
PS.. Another note..you seem to be slinging around a lot of references. Make sure
you delete all references stored in your scalars or hashes, otherwise, without
proper scoping, you will end up with leaks. i.e. When you destroy the canvas
window - do you also do a delete $canvasobj->{'canvas'} ?
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::OLE and Excel, Word, Access etc.

2003-01-07 Thread Jack
- Original Message -
From: "Carl Jolley" <[EMAIL PROTECTED]>
To: "Jack" <[EMAIL PROTECTED]>
Cc: "Perl-Win32-Users" <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 3:02 PM
Subject: Re: Win32::OLE and Excel, Word, Access etc.


> On Mon, 6 Jan 2003, Jack wrote:
>
> > I see many questions on this list asking about using Win32::OLE in
interacting
> > with these (and other MS programs). Could someone point me to either a book
or
> > online documentation which reveals all the methods one can use with each
> > program?
> All these proteriees/methods are documented in the respective program's
> typelib.
>
> If you don't know what a typelib is, you need to find out before you
> spend a lot of time trying to write programs using the Win32::OLE module.

I have no idea what a typelib is; so are you saying my time is better spent on
something else?

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Win32::OLE and Excel, Word, Access etc.

2003-01-06 Thread Jack
I see many questions on this list asking about using Win32::OLE in interacting
with these (and other MS programs). Could someone point me to either a book or
online documentation which reveals all the methods one can use with each
program?

For example from a recent post:

$excel -> {DisplayAlerts} = 0;
$book -> SaveAs ("$pwd\\spreadsheet.xls");

Where would one find out what the DisplayAlerts variable is? Where is SaveAs
documented?

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Win32:FileOp::OpenDialog

2002-12-19 Thread Jack
- Original Message - 
From: "James Hooker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 1:37 PM
Subject: Win32:FileOp::OpenDialog 


> 
> > I am using Win32:FileOp::OpenDialog and get footprints over my main Tk
> > window when I drag this dialog over the main Tk window. Does anyone know
> > how to eliminate the painting of these footpints.

Do you get the same result if you use $main->getOpenFile ?

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Justifying text in a Tk label?

2002-11-25 Thread Jack
- Original Message -
From: "Beckett Richard-qswi266" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 25, 2002 8:23 AM
Subject: Justifying text in a Tk label?


> Anyone know how to justify the text within a Tk label?
>
> I tried many combinations, like:
>
> my $label = $frame->Label (-text => "Hostname :", -relief => "raised",
> -borderwidth => "2", -width => "25", -justify => "left")
>
> -> pack (-side => "top", -anchor => "e", -padx => "1", -pady => "1");
>
> But I couldn't make any difference, the text is always centered.

I'm not sure of the look you are trying to achieve? Remember that a Label
accepts -anchor and -justify properties. The -anchor will lock the anchor point
of the text in the widget to the direction specified.
The justify only is useful for 'multiple' lines. Here is an example of the
entire label (including text) stuck to the nw corner of the main window:

#
use Tk;

my $mw=tkinit;
my $label=$mw->Label(
  -text=>
qq/This is a 'nw'
anchored...left
justified label.

Try resizing!/,
  -anchor=>'nw', #anchor text to nw within widget
  -justify=>'left');
$label->pack(-anchor=>'nw'); #anchor widget to nw within main
MainLoop;
##

Jack
--
use Tk;$/=$]<<$]+1;$"=tkinit->Canvas(-wi,$/)->form;map{map{create$"('t',1,1,-te
,chr(hex($]<<1+1)+ord))}split''}q|*0!%#2+,?>$]?$;=1:($;=-1);$_%(1<<1)?($l<$/>>1+1?
$:=1:($:=-1)):($l<$/>>1?$:=1:($:=-1));move$"($_,$;,$:)}find$"q|all|});MainLoop
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Subject Line

2002-11-25 Thread Jack
- Original Message -
From: "Harald Wopenka" <[EMAIL PROTECTED]>
To: "Win32-Users Perl" <[EMAIL PROTECTED]>
Sent: Monday, November 25, 2002 3:15 AM
Subject: Re: Subject Line

[snip]

> And we could start such a useless discussion like "linux is better than
> windows and vice versa" ;)

"Linux 'is' better than windows" :-)

...seriously, case-closed. My email is getting filtered properly, and I really
do appreciate not having such a long and (shall we say) repetitive subject line.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: [Perl-Win32-Users]Subject Line

2002-11-22 Thread Jack
- Original Message -
From: "Stovall, Adrian M." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 3:30 PM
Subject: RE: [Perl-Win32-Users]Subject Line


>Is it really any harder than filtering on "perl-win32-users" in the
>"To:" field?

Yes. The 'To:' field may contain any aliases the user set up; which might not be
'perl-win32-users'.

How about keeping the subject line filter; but shorten it!

such as [PWU] or [Win32]

us 'hotmailers' would thank you !
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: [Perl-Win32-Users]Tk Greyed out?

2002-11-22 Thread Jack
- Original Message -
From: "Beckett Richard-qswi266" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 9:05 AM
Subject: [Perl-Win32-Users]Tk Greyed out?


> Guys,
>
> I have a label and an entry box that I want to be greyed out when a radio
> button is selected. (I can't remove them from the frame, as it buggers up
> the formatting of other itmes.)
>
> What is the command to do this? (Is it possible?)
>
As the others have stated - you must configure the background 'manually'. Here
is a sample program:
#
use Tk;
use strict;
my $var=1;

my $mw=tkinit;
my $entry=$mw->Entry()->pack;
##$entry->configure(-disabledforeground=>'#ee');
my $cb=>$mw->Checkbutton(
 -text=>'On/Off',
 -variable=>\$var,
 -command=>\&changeState)->pack;
MainLoop;

sub changeState{
 ($var)?
   ($entry->configure(
   -state=>'normal',
   -bg=>'white')
   ):
   ($entry->configure(
   -state=>'disabled',
   -bg=>'#d9d9d9')
   );
}


Notice that the 'proper' way to do this is set the -disabledforeground (as
defined in Tk::options. However, I get error messages if I try this, hence I
have commented this line out and gone the configure->(-bg) route.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



[Perl-Win32-Users]Subject Line

2002-11-22 Thread Jack
It seems that [Perl-Win32-Users] is now a standard string in the subject line. I
assume this was implemented because of the recent thread discussion?

I like it - but there were others with very good points on why they don't like
it, so:

Q: Will this continue? i.e. can I change my rules wizard?

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Re[2]: Release of ActivePerl 5.8.0 - released today

2002-11-11 Thread Jack
- Original Message - 
From: "Jan Dubois" <[EMAIL PROTECTED]>
To: "Jack" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 1:26 PM
Subject: Re: Re[2]: Release of ActivePerl 5.8.0 - released today


> I haven't followed the Tk 804 discussion; did Nick
> indicate it would be ready soonish?
>

By the sounds of it - I think it will still be a while yet.

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Re[2]: Release of ActivePerl 5.8.0 - released today

2002-11-11 Thread Jack

- Original Message -
From: "Jan Dubois" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 12:19 PM
Subject: Re: Re[2]: Release of ActivePerl 5.8.0 - released today


> >
> >Do you know whether Tk is a victim of this ?
>
> No, it is not.  Tk is already included in ActivePerl 802, so there is no
> need to install it from the repository.

Before I download and install - can you tell me which version of Tk this is?

I assume 800.024 - or have you built the alpha version of the unicode aware
Tk804.024?

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: TK - destroy window.

2002-11-08 Thread Jack
- Original Message - 
From: "Beckett Richard-qswi266" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 5:24 AM
Subject: TK - destroy window.


> Well, I'm learning loads of stuff, but I have a new problem, now...
> 
> Using TK, I have a button on my main window that executes a subroutine. When
> the routine starts, I open a "working, please wait" window, and I destroy it
> at the end of the routine.
> 
> This is OK, proveded there are no errors. However I'm using Tk::ErrorDialog,
> to trap any errors.

> 
> The problem occurs if there is an error, the "working, please wait" remains
> open.
> 
> How, and where do I detect this, and close the window?
> 

You can define your own Tk::Error subroutine.

sub Tk::Error{
#close your Toplevel window
#report error
}


> Main body:
> use Tk;
> etc...
> use Tk::ErrorDialog; 
> # START BUTTON
> $window->Button(-text=>"START", -background=>"dark green",
> -foreground=>"white",
> -activebackground=>"dark green", -borderwidth=>10,
> -command=> \&start)
> ->pack (-side=>"right", -anchor=>"e");
> 
> Subroutine:
> sub start {
> $running_win = new MainWindow;

It is only on very rare circumstances you need two main windows.
Try:$window->Toplevel; here instead. Reading the 'BUGS' portion
of the Tk::Error docs - having a MainWindow here might be your
problem.

> $running_win->configure(-title=>"$title - Running...");
> $running_win->geometry ("+500+500");
> $running_win->minsize (qw(300 50));
> $running_win->Label(-text=> "\nRunning, please wait.\n\n")->pack ();
> $window->update;
> &get_values;
> &FTP_all;
> $running_win->destroy;
> }

Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: How can I timeout a MsgBox?

2002-05-18 Thread Jack

- Original Message -
From: "Brian W Smith" <[EMAIL PROTECTED]>

> I am trying to find a way to put up a Win32::MsgBox but have it timeout with
> the default response. As there is no "timeout" argument I assume I must use
> some other tool instead. Does anyone have any clues?

Tk can do this quite easily - but I'm not sure if that is what you want? I can
provide sample code if necessary.
Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Win32::API - FlashWindow

2002-05-03 Thread Jack



I am trying the following code on Win95 - I get no 
errors, but the window doesn't flash. According to the API docs, the titlebar 
should flash (alternated between inactive and active colors) whether it is 
iconified or not. Can someone enlighten me as to why this does not work? Does it 
work on 98? 2000? etc.
 
Jack

use Tk;use Win32::API;use 
strict;
 
my $mw=tkinit;
 
#Sometimes the window handle can be 
different.
#Let's make sure it is the same using the 
two
#known Tk methods.
my $ID=oct($mw->id);my $WinID=hex($mw->frame);print "Yep. 
Window handle is: $ID\n" if ($ID == $WinID);$mw->update;
 
my $flash=new 
Win32::API('user32','FlashWindow',['N','N'],'N');
 
$mw->repeat(1000,\&flashit);
 
MainLoop;
 
sub flashit{    if (defined 
$flash){  my 
$ret=$flash->Call($WinID,1); 
 $mw->update;  print "RET:", 
$ret,"\n";    } }
__END__


Re: Tk's messagebox

2002-04-24 Thread Jack

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 4:37 PM
Subject: Tk's messagebox


> It works but It's making a windows that I dont want... I only want
> messagebox..
If I understand you correctly - all you want is the messageBox. i.e. You do
not want to see the mainwindow.

Try this instead..
#
use Tk;
use strict;

my $mw=tkinit;
$mw->withdraw;
my $answer = $mw->messageBox(-icon=>'question', -message=>'Is this what you
want?',
-title=>'How about this..', -type=>'YesNo');
print "You answered $answer\n";
__END__
#No mainloop because you only wanted the message..right?
##

Jack
--
use
Tk;$/=$]<<$]+1;$"=tkinit->Canvas(-wi,$/,-he,$/)->form;map{map{create$"('t',
rand$/,rand$/,-te,chr(hex($]<<1+1)+ord))}split''}'*05%324,!(.!/#4+(%%22';whi
le
($]){update$";map{($I,$l)=coords$"($_);$I<$_*$/>>$]?$;=1:($;=-1);$_%(1<<1)?(
$l
<$/>>1+1?$\=1:($\=-1)):($l<$/>>1?$\=1:($\=-1));move$"($_,$;,$\)}find$"('all'
)}
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Printing to file

2002-04-24 Thread jack martin

Hi All
I'm fairly new to PERL. I am writing a script that has
opens a file that has two sets of values for which I
need to check for duplicate values , print only a
unique value to another file. I'm running into a
problem that is reproducible in the script below also
and seems to do with Filehandle being used
Name = "logfile.txt";
open(LGFILE,"> $Name") or die " Could not open
$Name\n" ;
#seed some data into the file
print LGFILE "vbvbe\n";
while ($line =)

{
print LGFILE "vbvbe\n";
}
close (LGFILE);
 at the end of the run the logfile.txt has the
following

vbvbe
]n" ;
vbvbe
LGFILE "vbvbe\n";
vbvbe
($line =)
vbvbe
rint LGFILE "vbvbe\n";
vbvbe
se (LGFILE);
vbvbe

Any tips on what is happening here?
 

__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: help with pack options

2002-04-12 Thread Jack

- Original Message -
From: "Iacoboni, Vince" <[EMAIL PROTECTED]>
To: "perl-win32-users" <[EMAIL PROTECTED]>
Sent: Friday, April 12, 2002 11:47 AM
Subject: Tk: help with pack options


> I'm a newbie to Tk and just want to right-align my BrowseEntry boxes.  I
> thought that including (-side => 'right') would do it.  Nope.  Read the
> docs.  Tried (-anchor => 'w').  Nope.  Read the docs.  Stumped.
>
> For gravy, I'd like to have the BrowseEntry boxes expand with the window.
> Am i putting the -expand option at the wrong place?
>
> One more question and I'll quit.  I'd love to bind the Enter key to the Ok
> button (as is commented out), but it seemed to press immediately when I
ran
> the app.  What's the right way to do it?
>
First - it is always nice to just put together a snippet of code. Just
enough to show the problem (in this case - just the Tk widget code). The
entire script is not needed to show your packing options.

Some answers - If you are trying to align widgets, ->grid is always a good
solution. Below is some code which does what I think you want. If you aren't
sure about some of the grid commands then look it up in the docs. Tk::grid
gives nice clean looking aligned widgets.

If using grid, the gridColumnconfigure command is the key to getting the
grid geometry manager to fill the frame in the x direction. If using pack
then -expand=>1,-fill=>'x' is the solution (Note: for the frame AND the
entry)

To bind the 'Enter' key - you use the 'Return' keysym ('' is reserved
for the enter event for the mouse pointer - which is likely why your program
triggered it so quickly.

You can arrange them using pack as well - just set $GRIDDING = 0 to see the
(non) difference..

##
use strict;
use Tk;
use Tk::BrowseEntry;

my $GRIDDING=0;

my $top = MainWindow->new;
$top->title("Set Server/Database");
my $f = $top->Frame()->pack(-expand=>1,-fill=>'x');

my $srv_box = $f->BrowseEntry(-label => "Server");
my $db_box = $f->BrowseEntry(-label => "Database");

if ($GRIDDING){
  #grid geometry manager
  $srv_box->grid(-row=>0,-column=>0,-sticky=>'ew');
  $db_box->grid(-row=>1,-column=>0,-sticky=>'ew');
  $f->gridColumnconfigure(0,-weight=>1);
}
else {
  #pack geometry manager
  $srv_box->pack(-expand=>1,-fill=>'x');
  $db_box->pack(-expand=>1,-fill=>'x');
}

my $b = $top->Frame;
my $OK_button = $b->Button(-text => "Ok",
   -command => sub{print "OK pressed\n";},
   -relief => "raised",
   -width => 10,
  )->pack(-side => "left",
  -padx => "5",
  -pady => "5");

my $can = $b->Button(-text => "Cancel",
 -command => sub {print "Cancelled\n"; exit(0);},
 -relief => "raised",
 -width => 10,
)->pack(-side => "left",
-padx => "5",
-pady => "5");
$top->bind('', sub {print "Hit Esc\n"; exit(0);});
$top->bind('',  sub {$OK_button->invoke});

$b->pack(-side => "bottom",
 -padx => "5",
 -pady => "5");

$srv_box->focus;
MainLoop;
#
__END__
Jack
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



  1   2   >