Re: [perl-win32-gui-users] how to get the enter key to work with two textfields in win32-gui perl
David, You should really only have one button created with the -ok option in a window. Even if you have many, the Enter key press would only be sent to the first button created with the option. Usually the option is used in conjunction with the -cancel option and is used to close the DialogBox when either the Enter or ESC key is pressed. To get the functionality that you are looking for, I suggest using a KeyDown event for the textfields and test for the Enter key. Here is an example modified from your code sample. Note that the DialogBox has been changed to a Window, since the DialogBox would intercept any Enter key presses before the textfields would get a chance to respond to the event: #!perl use strict; use warnings; use Win32::GUI qw(); use Win32::GUI::Constants qw(VK_RETURN); my $W1 = Win32::GUI::Window-new( -name = W1, -title = First Window, -pos= [ 100, 100 ], -size = [ 300, 200 ], ); $W1-AddButton( -name = ButtonW1, -text = FirstName, -pos= [ 87, 100 ], ); $W1-AddButton( -name = ButtonW2, -text = LastName, -pos= [ 87, 120 ], ); $W1-AddTextfield( -name = tf1, -pos= [20,40], -size = [250,20], -prompt = 1:, ); $W1-AddTextfield( -name = tf2, -pos= [20,60], -size = [250,20], -prompt = 2:, ); $W1-Show(); print This is a test\n; Win32::GUI::Dialog(); exit(0); sub W1_Terminate { return -1; } # Keydown event for textfield 1 sub tf1_KeyDown { my($flags,$key) = @_; if($key == VK_RETURN){ ButtonW1_Click(); } return 1; } # Keydown event for textfield 2 sub tf2_KeyDown { my($flags,$key) = @_; if($key == VK_RETURN){ ButtonW2_Click(); } return 1; } sub ButtonW1_Click { print Button 1 Clicked\n; my $text = $W1-tf1-Text(); print $text\n; } sub ButtonW2_Click { print Button 2 Clicked\n; my $text = $W1-tf2-Text(); print $text\n; } __END__ Hope this helps, Kevin. I'm interested in using two textfields in a DialogBox. Each textfield needs to except input from the enter key. I have learned that when you create your first button with -ok = 1, this becomes the button that will click regardless of the textbox you are in. I'm including some code I'm playing around with: When you run this and enter 1 for TextBox 1 and 2 for TextBox 2, Then click on FirstName Button - The result is Button 1 Clicked and a 1 on the next line. This is Expected. Then click on LastName Button - The result is Button 2 Clicked and a 2 on the next line. This is Expected. When you go into TextBox1 and click enter the result is Button 1 Clicked and a 1 on the next line. This is Expected. When you go into TextBox2 and click enter the result is This is NOT Expected. How do I get the result Button 2 Clicked and a 2 on the next line, when I go into textbox2 and click ? It seems the -ok = 1 only works for the first button created. Any suggestions. Thanks. Dave use Win32::GUI; my $W1 = Win32::GUI::DialogBox-new( -name = W1, -title = First Window, -pos = [ 100, 100 ], -size = [ 300, 200 ], ); $W1-AddButton( -name = ButtonW1, -text = FirstName, -pos = [ 87, 100 ], -ok = 1, ); $W1-AddButton( -name = ButtonW2, -text = LastName, -pos = [ 87, 120 ], -ok = 1, ); # $W1-ButtonW1-Disable(); $W1-AddTextfield( -name = tf1, -left = 20, -top = 40, -width = 250, -height = 20, -prompt = 1:, ); $W1-AddTextfield( -name = tf2, -left = 20, -top = 60, -width= 250, -height = 20, -prompt = 2:, ); $W1-Show(); print This is a test\n; Win32::GUI::Dialog(); exit(0); sub W1_Terminate { return -1; } sub ButtonW1_Click { print Button 1 Clicked\n; my $text = $W1-tf1-Text(); print $text\n; } sub ButtonW2_Click { print Button 2 Clicked\n; my $text = $W1-tf2-Text(); print $text\n; } -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Custom window shapes
Rob, You could try the Win32::GUI::Skin module on Sourceforge here http://sourceforge.net/projects/win32-gui-skin/. Kevin. Hi, I'd like to create/skin my windows with custom shapes and/or images (e.g. a PNG with transparency). I see that the SetWindowRgn() function is available in Win32::GUI 1.06, but this is not the best approach according to Microsoft (see this URL: http://msdn.microsoft.com/en-us/library/ms997507.aspx). Instead they recommend using the UpdateLayeredWindow() function, which doesn't seem to be available in Win32::GUI by default. Before I to use UpdateLayeredWindow() with help from Win32::API, does anyone have any experience, recommendations, or code samples? Thanks, Rob Johansen -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue
John, Win32::VisualStyles has XS code that calls the underlying Windows functions. You will either need to compile the module yourself, or you should be able to install the module using the Perl Package Manager. Kevin. Appreciate the response. In regard to Question 2, I tried to use your example program to see if problem is solved. I got VisualStyles.pm file from CPAN and placed it in my c:/perl/site/lib/win32 folder. Then tried to run your example. I get... Can't locate loadable object for module Win32::VisualStyles in @INC (@INC contains: . C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/lib/DynaLoader.pm line 118 DynaLoader::croak('Can\'t locate loadable object for module Win32::VisualStyles ...') called at C:/Perl/lib/DynaLoader.pm line 196 DynaLoader::bootstrap('Win32::VisualStyles', 0.02) called at C:/Perl/lib/XSLoader.pm line 111 XSLoader::bootstrap_inherit('Win32::VisualStyles', 0.02) called at tmp.pl line 39 This is out of my league to understand what I'm missing. I have perl versions... Perl v5.8.8 built for MSWin32-x86-multi-thread Binary build 817 [257965] by ActiveState Mar 20 2006 17:54:25 WIN32::GUI version 1.06 Am I missing something? John ---Original Message--- From: Kevin Marshallkejoh...@hotmail.com To: John Whitneyj...@johnwhitney.com Cc: perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue Sent: 25 Sep '10 11:43 John, Question 1: After looking through the Windows SDK docs, as far as I can tell, labels don't allow you to set the line spacing of the text. The best I can think of is to either choose a font with a large line spacing, or you could create an owner drawn control and draw the text yourself. Question 2: After doing a bit of digging, it seems that if you have themes enabled, the method that Win32::GUI uses to change the background and foreground colours doesn't work. Depending on the version of Perl that you use, the themes may be enabled or not. For example, I use ActiveState Perl 5.12.0 which has themes enabled by default. Robert May released a module called Win32::VisualStyles (it's on CPAN) which you can use to control the styles applied to your window. Simply disable themes before creating the checkbox and the foreground and background colors will be applied. Here is an example: #!perl use strict; use warnings; use feature qw(:5.12); use Win32::GUI qw(); use Win32::GUI::Constants qw(CW_USEDEFAULT); use Win32::VisualStyles qw(:all); # Enable themes only for window, disable for controls SetThemeAppProperties(STAP_ALLOW_NONCLIENT); my $win = Win32::GUI::Window-new( -name = 'win', -size = [ 320, 240 ], -left = CW_USEDEFAULT, ); $win-AddCheckbox( -pos= [ 5, 5 ], -text = 'Checkbox', -foreground = 0xff, -background = 0x00ff00, ); $win-Show(); Win32::GUI::Dialog(); __END__ As an alternative, you could draw the text in the control yourself using an owner drawn checkbox. Hope this helps, Kevin. Question 1) Anyone know how to get multiple lines in a Win32::GUI::Label to spread out vertially, so there would be an extra 5 pixels between each line? Yes, I could create multiple labels, one for each line, and spread them out an extra 5 pixels. But a simple -linespacing = 5 would be nice. Anything like this in the Win32::GUI world? Below is the label I have. my $window_main_text_label = new Win32::GUI::Label ( $window_main , -text = Line 1 \n Line 2 \n Line 3 \n Line 4 , -name = 'window_settings_option_text_label' , -font = $font , -pos= [ 195 , 297 ] , -size = [ 280 , 100 ] ) ; Question 2) With Win32::GUI::RadioButton, and with Win32::GUI::CheckBox I can set and change the -foreground = 0x00 value just fine to 0x00 and 0xff on my Win98SE PC. But on my XP PC the $window_main_cb - Change ( -foreground = 0xff ) and the initial setting of the -foreground = 0xff has no effect. Just always black. I can change -background colors on both Win98SE and WinXP platforms fine, but not -foreground. Any thoughts? My solution is to have the radio button or checkbox without any text, and add a text label near it that I can change the -foreground and -background, but this is a kludge I would like to avoid. John Whitney Utah, USA john at johnwhitney period com -- Start uncovering the many advantages of virtual appliances and start using them to simplify application
Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue
John, It is odd that PPM could not find the module. I tried it on my computer and managed to find it OK. Note that the package would be called Win32-VisualStyles (:: replaced with -). The repository that I use is http://ppm4.activestate.com/MSWin32-x86/5.12/1200/packages.xml, though it would be slightly different for you as you are using a different version of Perl. Try going to the web page http://ppm4.activestate.com/ and browsing for the appropriate repository for your version of Perl. You could also try downloading the package from http://ppm4.activestate.com/MSWin32-x86/5.8/825/R/RO/ROBERTMAY/Win32-VisualStyles/Win32-VisualStyles-0.02.ppmx and installing it yourself using the command line PPM. Kevin. Kevin: Thanks again for your response. That was the first thing I tried, was to enter PPM and look for it. But I could not find it under search win32, search visual, or search style. I was listed lots of packages with win32 visual or style in their name, but I could not find Win32-VisualStyles. Again I apologize for missing something. Is it under another name, or just not there? John Whitney ---Original Message--- From: Kevin Marshallkejoh...@hotmail.com To: johnj...@johnwhitney.com Cc: perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue Sent: 26 Sep '10 11:32 John, Win32::VisualStyles has XS code that calls the underlying Windows functions. You will either need to compile the module yourself, or you should be able to install the module using the Perl Package Manager. Kevin. Appreciate the response. In regard to Question 2, I tried to use your example program to see if problem is solved. I got VisualStyles.pm file from CPAN and placed it in my c:/perl/site/lib/win32 folder. Then tried to run your example. I get... Can't locate loadable object for module Win32::VisualStyles in @INC (@INC contains: . C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/lib/DynaLoader.pm line 118 DynaLoader::croak('Can\'t locate loadable object for module Win32::VisualStyles ...') called at C:/Perl/lib/DynaLoader.pm line 196 DynaLoader::bootstrap('Win32::VisualStyles', 0.02) called at C:/Perl/lib/XSLoader.pm line 111 XSLoader::bootstrap_inherit('Win32::VisualStyles', 0.02) called at tmp.pl line 39 This is out of my league to understand what I'm missing. I have perl versions... Perl v5.8.8 built for MSWin32-x86-multi-thread Binary build 817 [257965] by ActiveState Mar 20 2006 17:54:25 WIN32::GUI version 1.06 Am I missing something? John ---Original Message--- From: Kevin Marshallkejoh...@hotmail.com To: John Whitneyj...@johnwhitney.com Cc: perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Vertical line spacing and a Win98/WinXP issue Sent: 25 Sep '10 11:43 John, Question 1: After looking through the Windows SDK docs, as far as I can tell, labels don't allow you to set the line spacing of the text. The best I can think of is to either choose a font with a large line spacing, or you could create an owner drawn control and draw the text yourself. Question 2: After doing a bit of digging, it seems that if you have themes enabled, the method that Win32::GUI uses to change the background and foreground colours doesn't work. Depending on the version of Perl that you use, the themes may be enabled or not. For example, I use ActiveState Perl 5.12.0 which has themes enabled by default. Robert May released a module called Win32::VisualStyles (it's on CPAN) which you can use to control the styles applied to your window. Simply disable themes before creating the checkbox and the foreground and background colors will be applied. Here is an example: #!perl use strict; use warnings; use feature qw(:5.12); use Win32::GUI qw(); use Win32::GUI::Constants qw(CW_USEDEFAULT); use Win32::VisualStyles qw(:all); # Enable themes only for window, disable for controls SetThemeAppProperties(STAP_ALLOW_NONCLIENT); my $win = Win32::GUI::Window-new( -name = 'win', -size = [ 320, 240 ], -left = CW_USEDEFAULT, ); $win-AddCheckbox( -pos= [ 5, 5 ], -text = 'Checkbox', -foreground = 0xff, -background = 0x00ff00, ); $win-Show(); Win32::GUI::Dialog(); __END__ As an alternative, you could draw the text in the control yourself using an owner drawn checkbox. Hope this helps, Kevin. Question 1) Anyone know how to get multiple lines in a Win32::GUI::Label to
Re: [perl-win32-gui-users] how to automate the GUI which is created with SunAwtcanvas
Shilpa, You could try using the Win32::GuiTest or Win32::GUIRobot modules. They can be found on CPAN. Kevin. Hi all, I m trying to automate an GUI which is created using Java if i see the window in Winspy it shows class as vncviewer.ViewportFrame for top window and no child windows there are 2 subwindows seen as SunAwtScrollPane and SunAwtCanvas but i can see so many buttons and selections in the main window . How will i access then is it possible to automate this window using the Perl Win32 GUI library. If not what is the way i can automate this Thanks in advance, Shilpa -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] New folder option on Browse for folder
Rob, Unfortunately, the 'Create New' button is not available for the BrowseForFolder() function. Perhaps it is something that you could mention to the developers. Kevin. Hi Everyone, I am using Win32::GUI::BrowseForFolder . I cannot work out how to add the create new option as seen on other browse for folder windows. Is this feature available? Thanks Rob -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls
Reini, The thing is that Custom Draw is supported by a different set of controls to Owner Draw, so I suppose a combination of both could be used. Kevin. 2010/8/28 Kevin Marshallkejoh...@hotmail.com: After much experimentation, I have finally succeeded in creating an owner-drawn control in Win32::GUI. I decided to create this post detailing how to create an owner-drawn control in case someone else has the need to use one. I posted a fullfletched patch for the simplier CustomDraw, which I'm using for years to do the same. I primarily use it to color list items. Added http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00624.html and removed, promised for 1.04, but it didn't happen. http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00628.html -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls
Octavian, According to the Windows docs, the common controls are automatically accessible, which are what Win32::GUI uses, whereas custom controls require additional setup. Kevin. Hi Kevin, I was asking this because all the standard controls which can be created with Win32::GUI are accessible without doing anything special. Octavian - Original Message - From: Kevin Marshallkejoh...@hotmail.com To: Octavian Rasnitaorasn...@gmail.com Cc:perl-win32-gui-users@lists.sourceforge.net Sent: Saturday, August 28, 2010 1:56 PM Subject: Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls Hi Octavian, Thanks for your comments. It's good to know that you find it useful. I have been looking into Windows Accessibility to see how it works, and it seems that under normal circumstances (i.e. creating GUIs using C++, rather than Perl), the custom controls must provide an interface to the Accessibility API, which accessibility programs can use to interact with the control. Unfortunately, it looks like it is probably beyond the scope of the Win32::GUI module. Perhaps it is something that could be looked into for a separate module. Other people may have thoughts on the topic. Thanks again, Kevin. Hi Kevin, Congratulations for the program! I have tested it with a screen reader and it works. I added the -dialogui = 1 option to the $winMain object to be able to use the keyboard for changing the focus. The only problem, which is an important one, is that if I arrow up or down in the list box, the screen reader announces just things like item 1 of 8, item 2 of 8 and so on, without telling the label of the current item as it should. Do you (or somebody else) have any idea how to add accessibility features (MSAA) to this custom control in order to be as useful as a standard control? Basicly it should also report the labels of the list box items and not just print them. Thank you. Octavian - Original Message - From: Kevin Marshallkejoh...@hotmail.com To:perl-win32-gui-users@lists.sourceforge.net Sent: Saturday, August 28, 2010 8:07 AM Subject: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls Hi everyone, After much experimentation, I have finally succeeded in creating an owner-drawn control in Win32::GUI. I decided to create this post detailing how to create an owner-drawn control in case someone else has the need to use one. For those of you who don't know, an owner-drawn control allows the user more control over the appearance of the control. This usually involves responding to messages sent whenever the control needs to be drawn and drawing the control in anyway that you wish. In order to get my sample to work you will need to install the PeekPoke module from CPAN. This module allows reading and writing of data to and from arbitrary memory locations. This is needed to set the height of the items of the listbox. More on this below. This example was created using ActiveState Perl v5.12.0 running on Windows XP. For this example, I will demonstrate how to create an owner-drawn listbox. The listbox will have items with a larger height, will display two lines of text with different formats, and an image. All of the files related to this example at the bottom of this post. Anyway, on with the example. I decided to store the information about each listbox item in an external XML file and use XML::Simple to parse it. This makes it rather simple to change the information for the listbox items. I also created 8 simple 40x40 bitmaps that will be displayed in each listbox item. Now for a description of the code. The first step is to create a window for our listbox and load our XML data from the file using XML::Simple::XMLin(). This is all fairly simple, so I won't bother explaining. Next step is to create a hook for the WM_MEASUREITEM message. This message is sent when the listbox is created so the user can specify the width and height of the listbox items. The $lParam variable contains the address of the structure that is passed to the message, which needs to be filled out. Here we use the poke() function to write the desired height into the structure, which in our case is 50. 16 is the offset of the itemHeight member of the structure which needs to contain the height that we want when the message returns. Next a hook is created for the WM_DRAWITEM message. This message is sent whenever an item in the listbox requires drawing. First step is to unpack the structure that is passed to the message. If the itemID contains -1, then the listbox is empty, so we simply return from the sub if this occurs. Otherwise, it contains the zero-based index of the item being drawn. The itemAction member contains the action required for the drawing. Here we respond if the entire item needs drawing. To begin with we draw the bitmap for the item. First we create a compatible DC
Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls
Hi Octavian, Thanks for your comments. It's good to know that you find it useful. I have been looking into Windows Accessibility to see how it works, and it seems that under normal circumstances (i.e. creating GUIs using C++, rather than Perl), the custom controls must provide an interface to the Accessibility API, which accessibility programs can use to interact with the control. Unfortunately, it looks like it is probably beyond the scope of the Win32::GUI module. Perhaps it is something that could be looked into for a separate module. Other people may have thoughts on the topic. Thanks again, Kevin. Hi Kevin, Congratulations for the program! I have tested it with a screen reader and it works. I added the -dialogui = 1 option to the $winMain object to be able to use the keyboard for changing the focus. The only problem, which is an important one, is that if I arrow up or down in the list box, the screen reader announces just things like item 1 of 8, item 2 of 8 and so on, without telling the label of the current item as it should. Do you (or somebody else) have any idea how to add accessibility features (MSAA) to this custom control in order to be as useful as a standard control? Basicly it should also report the labels of the list box items and not just print them. Thank you. Octavian - Original Message - From: Kevin Marshallkejoh...@hotmail.com To:perl-win32-gui-users@lists.sourceforge.net Sent: Saturday, August 28, 2010 8:07 AM Subject: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls Hi everyone, After much experimentation, I have finally succeeded in creating an owner-drawn control in Win32::GUI. I decided to create this post detailing how to create an owner-drawn control in case someone else has the need to use one. For those of you who don't know, an owner-drawn control allows the user more control over the appearance of the control. This usually involves responding to messages sent whenever the control needs to be drawn and drawing the control in anyway that you wish. In order to get my sample to work you will need to install the PeekPoke module from CPAN. This module allows reading and writing of data to and from arbitrary memory locations. This is needed to set the height of the items of the listbox. More on this below. This example was created using ActiveState Perl v5.12.0 running on Windows XP. For this example, I will demonstrate how to create an owner-drawn listbox. The listbox will have items with a larger height, will display two lines of text with different formats, and an image. All of the files related to this example at the bottom of this post. Anyway, on with the example. I decided to store the information about each listbox item in an external XML file and use XML::Simple to parse it. This makes it rather simple to change the information for the listbox items. I also created 8 simple 40x40 bitmaps that will be displayed in each listbox item. Now for a description of the code. The first step is to create a window for our listbox and load our XML data from the file using XML::Simple::XMLin(). This is all fairly simple, so I won't bother explaining. Next step is to create a hook for the WM_MEASUREITEM message. This message is sent when the listbox is created so the user can specify the width and height of the listbox items. The $lParam variable contains the address of the structure that is passed to the message, which needs to be filled out. Here we use the poke() function to write the desired height into the structure, which in our case is 50. 16 is the offset of the itemHeight member of the structure which needs to contain the height that we want when the message returns. Next a hook is created for the WM_DRAWITEM message. This message is sent whenever an item in the listbox requires drawing. First step is to unpack the structure that is passed to the message. If the itemID contains -1, then the listbox is empty, so we simply return from the sub if this occurs. Otherwise, it contains the zero-based index of the item being drawn. The itemAction member contains the action required for the drawing. Here we respond if the entire item needs drawing. To begin with we draw the bitmap for the item. First we create a compatible DC from the DC that is passed to the message, then select the bitmap for the current item into it. Then we BitBlt() the contents of the compatible DC into the item DC. Next we need to draw the text that will be displayed in the item. We create a large font that will be used for the item's heading, and select the font into the item DC, remembering the old font. Then we draw the text into the item DC using DrawText(). Next we select the old font, and draw the other text that will be displayed in the item. That completes the drawing for the item, so we return from our sub. Next step is to create our listbox. The only difference here from
[perl-win32-gui-users] Win32::GUI Owner Drawn Controls
Hi everyone, After much experimentation, I have finally succeeded in creating an owner-drawn control in Win32::GUI. I decided to create this post detailing how to create an owner-drawn control in case someone else has the need to use one. For those of you who don't know, an owner-drawn control allows the user more control over the appearance of the control. This usually involves responding to messages sent whenever the control needs to be drawn and drawing the control in anyway that you wish. In order to get my sample to work you will need to install the PeekPoke module from CPAN. This module allows reading and writing of data to and from arbitrary memory locations. This is needed to set the height of the items of the listbox. More on this below. This example was created using ActiveState Perl v5.12.0 running on Windows XP. For this example, I will demonstrate how to create an owner-drawn listbox. The listbox will have items with a larger height, will display two lines of text with different formats, and an image. All of the files related to this example at the bottom of this post. Anyway, on with the example. I decided to store the information about each listbox item in an external XML file and use XML::Simple to parse it. This makes it rather simple to change the information for the listbox items. I also created 8 simple 40x40 bitmaps that will be displayed in each listbox item. Now for a description of the code. The first step is to create a window for our listbox and load our XML data from the file using XML::Simple::XMLin(). This is all fairly simple, so I won't bother explaining. Next step is to create a hook for the WM_MEASUREITEM message. This message is sent when the listbox is created so the user can specify the width and height of the listbox items. The $lParam variable contains the address of the structure that is passed to the message, which needs to be filled out. Here we use the poke() function to write the desired height into the structure, which in our case is 50. 16 is the offset of the itemHeight member of the structure which needs to contain the height that we want when the message returns. Next a hook is created for the WM_DRAWITEM message. This message is sent whenever an item in the listbox requires drawing. First step is to unpack the structure that is passed to the message. If the itemID contains -1, then the listbox is empty, so we simply return from the sub if this occurs. Otherwise, it contains the zero-based index of the item being drawn. The itemAction member contains the action required for the drawing. Here we respond if the entire item needs drawing. To begin with we draw the bitmap for the item. First we create a compatible DC from the DC that is passed to the message, then select the bitmap for the current item into it. Then we BitBlt() the contents of the compatible DC into the item DC. Next we need to draw the text that will be displayed in the item. We create a large font that will be used for the item's heading, and select the font into the item DC, remembering the old font. Then we draw the text into the item DC using DrawText(). Next we select the old font, and draw the other text that will be displayed in the item. That completes the drawing for the item, so we return from our sub. Next step is to create our listbox. The only difference here from creating an ordinary listbox is to specify the LBS_OWNERDRAWFIXED style. This specifies that the listbox will be owner-drawn, and all the items have the same height. An alternative would be to use the LBS_OWNERDRAWVARIABLE style instead, which specifies that each item will have a different height. In this case, the WM_MEASUREITEM would be sent for each item when the control is created, not just once like our case. Next we loop through each item returned from the XML file, create a Win32::GUI::Bitmap from the file name specified in the file, and add the relevant data to an array which will be used when drawing the listbox items. We also add an item to the listbox using the text as a place holder, although it won't get drawn, so it doesn't matter what is inserted here. Then we simply show the window and enter the dialog phase. The listbox acts like any other listbox, it just has larger items and different content. This is demonstrated here when an item is selected: the heading and text of the selected item are printed. That's it for creating an owner-drawn listbox. Various other controls can also be owner-draw, such as buttons, labels, and combo boxes. I have yet to try it with other controls, but it shouldn't be much different from a listbox. More information about owner-draw controls can be found in the Windows SDK Documentation. I hope that someone finds this example useful. If you come up with something interesting, I wouldn't mind a reply post detailing what you have done. Kevin. Here are the files: This is the main code: #!perl
Re: [perl-win32-gui-users] how to retrieve the value of syslistview32 item from the GUI
Hi, Do you mean you are trying to read values from a listview control in a Window that you have created or a listview in a Window for another application. If you mean one you created, then this is how you do it: foreach my $index ($listvew-SelectedItems()){ my %info = $listview-GetItem($index); Data::Dump::dump(\%info); } __END__ On the other hand, if you are trying to get info about a listview item in a window that you haven't created, this is a little more involved (and probably not recommended). There is a previous post on this mailing list where someone wanted to access a toolbar in another application. Perhaps have a read of that post if this is what you are looking for. Kevin. hello all, I m trying to read the GUI and get the values. there is a tab in GUI for which the Winspy shows the name as syslistview32 how will i read the values of this item . kindly help -shilpa -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
[perl-win32-gui-users] A Perl module for DirectX
Hey, If anyone is interested, I have created a Perl module for DirectX. It is still in the early stages of development, but I have released it on SourceForge here, if anyone would be interested in having a play with it and providing some feedback. So far, I have created an interface to Direct3D, DirectSound, and DirectInput. I have also managed to integrate it with Win32::GUI, which makes creating windows for a DirectX application quite simple. I haven't quite set up the project page yet, so if you wish to provide some feedback or have any questions, either send me an email, or reply to my post about my module on PerlMonks here. You'll need to build the module from source and requires the DirectX SDK. The documentation is lacking at this point, so it's probably best to just read the documentation that comes with the SDK, since the Perl interface is still quite similar to the underlying API. I hope that you find it useful. Thanks, Kevin. _ Need a new place to live? Find it on Domain.com.au http://clk.atdmt.com/NMN/go/157631292/direct/01/-- ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] child window for opengl
Peter, Your problem could be caused by the code that you added to the render sub. It would probably add some overhead to resize the viewport every frame. Try moving the code to just before the dialog loop. Also, you could try using the Win32::GUI::OpenGLFrame module created by Robert May. This module basically shortcuts all the code necessary for using OpenGL with Win32::GUI, and uses an XS interface to the required functions, instead of loading them with Win32::API. This may provide a speed increase. The module can be found on CPAN. Hope this helps, Kevin. Date: Sat, 6 Mar 2010 23:08:19 -0800 From: my_name_tallu...@yahoo.com To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] child window for opengl Hi in 14 Jul 2009 http://www.mail-archive.com/perl-win32-gui-users@lists.sourceforge.net/msg05703.html i have posted an opengl example to run from within win32gui , the example depends on kevin Marshall code posted here http://www.mail-archive.com/perl-win32-gui-users@lists.sourceforge.net/msg05673.html . the example show a popup child window in wich the opengl scene rendered. now i have tried the same example but the opengl scene will be rendered to a child window inside the main window; it is working but with one problem; the launching of the program lasts about 5 seconds before the main window appears. why is this behaviour?, since in the popup child window example the main window appears in one second only. the only adjustments i have made is : 1- adding the following lines to the render sub since the sticky child window can't be resized so the -onResize = sub {...} is not operative: glViewport(0,0,320,240); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, 320 / 240, 0.1, 500.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); 2-adding to the child properties: -popstyle= WS_CAPTION | WS_SIZEBOX, -pushstyle = WS_CHILD, -pushexstyle = WS_EX_CLIENTEDGE, and the else of the program is the same as the first example. for convenience here is the modified program, so you can check the 5 seconds delay before the main window appears: http://rapidshare.com/files/360063815/win32gui_opengl2.pl its picture like this: http://img192.imageshack.us/img192/3226/win32guiopengl.jpg regards peter _ Get the latest jobs delivered. Sign up for SEEK Jobmail. http://clk.atdmt.com/NMN/go/157639755/direct/01/-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Borderless Main Window
Ken, Instead of using -pushstyle, you need to use -popstyle. As for the constants needed, you will need to use WS_CAPTION to remove the title bar and WS_THICKFRAME to remove the window's sizing border. Here is an example: $splash = Win32::GUI::Window-new( -name = 'splash', -size = [200,200], -popstyle = WS_CAPTION | WS_THICKFRAME, ); __END__ There are a number of other window constants that can be used when creating a splash window. If you have the Windows SDK, you can check the documentation for a full list. Hope this helps, Kevin. Date: Fri, 5 Mar 2010 14:44:24 -0500 From: kl...@psu.edu To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Borderless Main Window Hello, Let me preface my question by saying that I haven’t used Win32::GUI very much, so I might be missing something obvious. I want to create a borderless window (splash screen) and have done so using the –style option when creating the new window. Unfortunately, this option is deprecated, and I get a message informing me of that fact whenever I run the application. Looking at the documentation, it appeared that I could use the –pushstyle of –addstyle option when creating the window. However, the window has a border when either of these options is used. Can anyone point out the error of my ways? Actual code is below. Thanks, Ken Slater use strict; use warnings; use File::Basename; use Getopt::Long; use Win32::API; use Win32::GUI(); use Win32::GUI::Constants; use Win32::OLE('in'); my ( $runDir ); BEGIN { $runDir = Win32::GetFullPathName(dirname($0)); } my ($help, %options, %overridingOptions); $options{iniFile} = $runDir/stayOnTop.ini; my ($execname) = fileparse( $0, '' ); sub usage { print STDERR USAGE; $execname ... USAGE return 0; } # end sub usage GetOptions( ini=s = \$options{iniFile}, bg=s= \$overridingOptions{backgroundFile}, t=i = \$overridingOptions{timeout}, h! = \$help, help! = \$help); if ( $help ) { usage; exit 0; } pullSettings(); use constant wbemFlagReturnImmediately = 0x10; use constant wbemFlagForwardOnly = 0x20; # # Get height and width of display # my $computer = .; my $objWMIService = Win32::OLE-GetObject (winmgmts:$computer\\root\\CIMV2) or die WMI connection failed.\n; my $colItems = $objWMIService-ExecQuery (SELECT * FROM Win32_VideoController,WQL, wbemFlagReturnImmediately | wbemFlagForwardOnly); my ( $screenWidth, $screenHeight ); foreach my $objItem (in $colItems) { $screenWidth = $objItem-{CurrentHorizontalResolution}; $screenHeight = $objItem-{CurrentVerticalResolution}; } # # Create GUI Window # my $WS_POPUP = Win32::GUI::Constants::constant('WS_POPUP'); my $mw = Win32::GUI::Window-new( -title = 'NOBORDER (I hope)', -bg = 'black', -pos = [0,0], -size = [$screenWidth,$screenHeight], # The -stype option was added to make borderless # windows. Get a warning that this option is deprecated. -style = $WS_POPUP, # # Neither addstyle or pushstyle seem to get rid of the border #-addstyle = $WS_POPUP, #-pushstyle = $WS_POPUP, ); # # Force this window to stay on top of other windows. # my $HWND_TOPMOST = Win32::GUI::Constants::constant('HWND_TOPMOST'); my $SWP_NOSIZE = Win32::GUI::Constants::constant('SWP_NOSIZE'); my $SWP_NOMOVE = Win32::GUI::Constants::constant('SWP_NOMOVE'); $mw-SetWindowPos($HWND_TOPMOST,0,0,$screenWidth,$screenHeight, $SWP_NOSIZE|$SWP_NOMOVE); # # Set the timer to exit this application after the specified # number of milliseconds. # $options{timeout} = 5000 unless defined($options{timeout}); my $t1 = $mw-AddTimer('T1', $options{timeout}); # # Set up the image to be displayed on the screen # my $bitmap = Win32::GUI::Bitmap-new($options{backgroundFile}, 0,$screenWidth,$screenHeight); #create a label in which the bitmap will be placed my $bitmapLabel = $mw-AddLabel( -name = Bitmap, -left = 0, -top = 0, -width= $screenWidth, -height = $screenHeight, -bitmap = $bitmap, ); # # Display the window
Re: [perl-win32-gui-users] Executing a subroutine when selecting a radio button
Bradley, It should be -onclick instead of -click. Also, instead of using the Change() method, use ReadOnly(1) to enable readonly and ReadOnly(0) to disable. Hope this helps, Kevin. Date: Wed, 24 Feb 2010 13:28:09 -0500 From: bradley.l...@bioreliance.com To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Executing a subroutine when selecting a radio button Hi, I am trying to set up an action using radio buttons that when it is selected it changes the readonly state of the text field (see below code). This code runs but the subroutine does not work when the radio button is selected. I expect that the –click option is not doing what I want it to do. Does anyone have any suggestions on how to get the functionality that I am looking for? Cheers! #!perl -w use strict; #use warnings; use Win32::GUI(); my $w = 250; my $h = 100; my $main = Win32::GUI::Window-new( -name = 'Main', -text = 'Example Window', -width = $w, -height = $h, -resizable = 0 ); $main-AddRadioButton ( -name= 'radio_1', -pos = [10, 10], -size= [12,12], -checked = '1', -click = sub{$main-user_text-Change(-readonly = 1);}, ); $main-AddLabel( -text = Disable Textfield, -pos = [25,10], ); $main-AddRadioButton ( -name= 'radio_2', -pos = [10, 30], -size= [12,12], -click = sub{$main-user_text-Change(-readonly = 0);}, ); $main-AddLabel( -text = Enable Textfield, -pos = [25,30], ); $main-AddTextfield( -name = 'user_text', -pos = [110,28], -size = [60,20], -align = 'left', -readonly = 1, ); $main-Show(); Win32::GUI::Dialog(); _ Looking for a place to rent, share or buy? Find your next place with ninemsn Property http://clk.atdmt.com/NMN/go/157631292/direct/01/-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Windows shutdown
Seb, If you have ActiveState Perl, you could try running the script using the wperl.exe program instead. This runs the script without displaying a console. This means that any output won't be seen, but I tried it with the sample code that Jeremy provided and it worked OK for me. If the error message still pops up, try returning 1 from the EndSession() sub instead of 0. According to the Windows SDK docs, returning 0 will abort the shutdown, although I don't know if this matters for Win32::GUI. Hope this helps, Kevin. Date: Thu, 24 Dec 2009 00:43:54 +0100 From: s...@h-k.fr To: jez_wh...@hotmail.com CC: perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Windows shutdown Hi Jeremy, | Something like below - I didn't have time to test it fully, but | something is printed when I shutdown. | | use strict; use Win32::GUI qw (WM_QUERYENDSESSION); my $main = | Win32::GUI::Window-new(-name = 'Main', -text = 'Perl', -width = 200, | -height = 200);$main-AddLabel(-name = Label, -text = Hello, | world, -left = 20, -top = 20, -notify = | 1);$main-Hook(WM_QUERYENDSESSION,\ | EndSession);$main-Show();Win32::GUI::Dialog(); sub EndSession { print | WM_QUERYENDSESSION fired\n; return 0;} It doesn't work for me, so I'll detail my steps. I put this code in a .pl file, reformatted it, then double clicked on the icon of the program. This opened a black terminal and a small window with Hello, world. Then I clicked on the Start Menu, chose Stop. Windows (XP) then shows an error message saying that Windows cannot terminate this program; it offers to either terminate the program now or cancel. Does Windows shut down when you follow the same steps? Is there something you're doing differently? I tried adding the WM_CLOSE signal, but the result is the same. Same thing when I change EndSession's definition for an exit(0). So close and yet... Thanks alot for your time and help. Hope you can guide me through the last step! Seb. | Date: Wed, 23 Dec 2009 23:41:11 +0100 | From: s...@h-k.fr | To: jez_wh...@hotmail.com | CC: perl-win32-gui-users@lists.sourceforge.net | Subject: Re: [perl-win32-gui-users] Windows shutdown | | | Hi Jeremy, | | | | One thing that did strike me when reading your mail was when you said | | application does not in itself require a GUI. When you hooked | | WM_QUERYENDSESSION + WM_ENDSESSION, are you sure your application is | | sitting on the event pump (Win32::GUI::Dialog) when windows shuts down? | | If it's not, then you wont get the messages before it's too late... | | I'm pretty sure my code isn't at all what it's supposed to look like :-) | If it's not too much trouble, could you send a working example with these | variables and Win32::GUI::Dialog ? The simplest things can be hell to put | together in the right order when it's done for the first time... | | | Thanks! | Seb. | | | | | Date: Wed, 23 Dec 2009 13:19:41 +0100 | | From: s...@h-k.fr | | To: perl-win32-gui-users@lists.sourceforge.net | | Subject: [perl-win32-gui-users] Windows shutdown | | | | | | Hi folks, | | | | | | Here is the question: I'm looking for a minimal example of a (perl) script | | that dies (gracefully or not) when Windows tries to shutdown. | | | | Story: I have developed an application that monitors via RS232 the health | | of TV screens attached to PCs. The information gathered is relayed to a | | central server. This application must run continuously, but still die | | when an automatic shutdown is triggered on the PC. The application works | | but doesn't die when asked to (via Start-Stop). | | | | I have a fair knowledge of Perl and Unix, but I am totally new to Windows | | programming: don't hesitate to state an obvious solution :-) Please note | | that the application does not in itself require a GUI. I tried a GUI | | following the discussion here: | | http://objectmix.com/perl/20692-win32-how-quit-perl-script-during-log-off-automatically.html | | A solution that would use Win32::API would also work for me, I just | | thought it might be simpler with Win32::GUI. | | I have tried to use GetMessage and PeekMessage, but I'm clearly not using | | them the right way (again, I know zilsch about Windows programming). | | | | I've read the archives on mail-archive.com and found discussions dating | | back to 2001 and 2004; they do not provide a working example alas. I also | | tried to understand the man pages on CPAN and the samples in the tarball, | | but couldn't find a hint there either. | | | | Any hope, err, help, would be much appreciated! | | | | | | Seb. | | | | | | -- | | This SF.Net email is sponsored by the Verizon Developer Community | | Take
Re: [perl-win32-gui-users] How to edit ListView subitem ?
Miller, After digging through the Windows SDK documentation, I'm fairly certain that Windows doesn't allow subitem labels to be edited. You can get around this, though, by handling the label change yourself. Here is a sample I put together from your code that allows subitems to be edited. It does this by responding to the MouseDblClick event (instead of the DblClick event), which displays a text box that the user can type in. There is probably a better way to do this, but this works OK. #!perl use strict; use warnings; use Win32::GUI qw(); use Win32::GUI::Constants qw(/^WS_/ /^VK_/); my $MW = Win32::GUI::Window-new( -name = 'MW', -size = [350,550], -pos = [250,125], -text = Listview Example, -pushstyle = WS_MINIMIZEBOX | WS_SYSMENU, ); my $LV_0 = $MW-AddListView( -name= LV_0, -size= [300,500], -pos= [6,6], -fullrowselect = 1, # Select every colnum's row at the same time -hottrack = 0, # Auto select item , don't click item -gridlines = 1, # Draw the border for list table -checkboxes = 0, # Show the check box on the every row start -singlesel = 1, -oneclickactivate = 1, # Change the cursor to onecclick type while on the select item -editlabel = 1, # Can be edit -visible = 1, -nocolumnheader = 0, # Hide the column header ); my($Item,$SubItem); my $Edit = Win32::GUI::Textfield-new( -parent = $LV_0, -name = 'Edit', -visible = 0, -popexstyle = WS_EX_CLIENTEDGE, -onLostFocus = sub { #Label isn't changed if user clicks off textfield my $self = shift; $self-Hide(); return 1; }, -onKeyDown = sub { my($self,$flags,$vkey) = @_; #Label is changed on RETURN key if($vkey == VK_RETURN){ my $item = $LV_0-Item($Item); if($SubItem){ my $sub = $item-SubItem($SubItem); $sub-Text($self-Text()); } else { $item-Text($self-Text()); } $self-Hide(); } #Label isn't changed on ESCAPE key elsif($vkey == VK_ESCAPE){ $self-Hide(); } return 1; }, ); $LV_0-InsertColumn( -index = 1, -width = 150, -text = Column_0, ); $LV_0-InsertColumn( -index = 2, -width = 150, -text = Column_1, ); for(0..100){ $LV_0-InsertItem ( -text = [ ( sprintf index %03d, $_ ), ( sprintf subindex %03d, $_ ) ] ); } $MW - Show(); Win32::GUI::Dialog(); exit(0); sub MW_Terminate{ -1; } sub LV_0_MouseDblClick { my($x,$y,$flags) = @_; my($item, $subitem, $flag) = $LV_0-SubItemHitTest($x,$y); return 1 unless defined $item; my @rect; if($subitem){ @rect = $LV_0-GetSubItemRect($item,$subitem); } else { @rect = $LV_0-GetItemRect($item); } $Edit-Show(); $Edit-Left($rect[0]); $Edit-Top($rect[1]); $Edit-Width($rect[2]-$rect[0]); $Edit-Height($rect[3]-$rect[1]); $Edit-Text($LV_0-GetItemText($item,$subitem)); $Edit-SelectAll(); $Edit-SetFocus(); $Item = $item; $SubItem = $subitem; return 1; } __END__ Hope this helps, Kevin. To: perl-win32-gui-users@lists.sourceforge.net From: miller_c...@sercomm.com Date: Thu, 19 Nov 2009 16:52:23 +0800 Subject: [perl-win32-gui-users] How to edit ListView subitem ? Dear All : Does any one know how to let the ListView subitem can be edit ? Below is my sample code : #!perl use Win32::GUI ; $MW = Win32::GUI::Window - new( -name = 'MW', -size = [350,550], -pos = [250,125], -text = Listview Example, -font = $font_T_8 , -style = WS_MINIMIZEBOX | WS_SYSMENU, ); $LV_0 = $MW - AddListView( -name = LV_0, -size = [300,500], -pos = [6,6], -fullrowselect = 1,# Select every colnum's row at the same time -hottrack = 0,# Auto select item , don't click item -gridlines= 1,# Draw the border for list table -checkboxes = 0,# Show the check box on the every row start -singlesel = 1, -oneclickactivate = 1,# Change the cursor to onecclick type while on the select item -editlabel= 1,# Can be edit -visible = 1,
Re: [perl-win32-gui-users] Win32 Gui Web site
Hey everyone, I wouldn't mind contributing to the website with tutorials, code samples, documentation, etc. whenever I have some spare time. Kevin. Date: Wed, 21 Oct 2009 10:59:49 -0600 From: stevebo...@shaw.ca To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Win32 Gui Web site Hi All, I have been talking with Rob May about taking on the administration a web site for the Win32::Gui project. The current wiki no longer allows editing because of problems with spam, and the lack of time to get everything fixed. I have been digging around and familiarizing myself with the offerings at sourceforge to see what might make a good base for the community. Sourceforge offers two interesting possibilities: 1. MediWiki Originally written for Wikipedia this is an excellent wiki product. 2. phpWebsite PhpWebsite is a content management system that allows the development of a full-featured web site, including (in the latest release) a wiki, blogging, and many other community-building features. Personally I lean toward phpWebsite. I'd like to hear from people what they would like to see on a win32::Gui website/wiki, how many would be willing to contribute content, assist with site managment and maintenance, and so on. Please reply to the list with your thoughts, comments and suggestions. Regards, Steve Steve Bondy http://stevebondy.ca _ Get Hotmail on your iPhone Find out how here http://windowslive.ninemsn.com.au/article.aspx?id=845706-- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] How to capture keyboard key presses
John, It is possible to capture keyboard input by using the -onKeyDown or -onKeyUp events. Here is an example: my $winMain = Win32::GUI::Window-new( -name = 'winMain', -text = 'Keyboard Capture', -size = [320,240], -onKeyDown = sub { my($self, $flags, $key) = @_; #do processing here return 1; }, ); __END__ The $key param contains the virtual key code, and the $flags param contains flags for the event, such as repeat count. See the Microsoft SDK docs for more information. One problem is that the window will only report key press events when it has focus. This means that if any of the controls in the window have focus, the keypress events won't trigger. An alternative is to use one of the GetAsyncKeyState / GetKeyboardState / GetKeyState methods instead to poll the keyboard when you need input, such as every timer event. Hope this helps, Kevin. From: j...@johnwhitney.com To: perl-win32-gui-users@lists.sourceforge.net Date: Sun, 11 Oct 2009 23:25:52 -0700 Subject: [perl-win32-gui-users] How to capture keyboard key presses Hello, I have a timer application that uses Win32::GUI, version 1.06, and all works quite nicely. I would like add a capability so that my $window_main can capture keyboard events when certain keys are pressed, for example space bar (\x20), esc (\x1b) if possible, enter (\x0d), or one of the keyboard function keys (F1 - F12). Users want to be able to start and stop my timer using the space bar for example. Is this possible? My $window_main has no input text fields, just images and Hyperlinks. John j...@johnwhitney.com 801 815 9265 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ _ Use Messenger in your Hotmail inbox Find out how here http://windowslive.ninemsn.com.au/article.aspx?id=823454-- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Comboboxes
Hey, First, the reason your combobox isn't displaying properly is because of the height of the control. For a combobox, the height also sets the size of the dropdown list, with the textfield part of the combobox getting set to a standard height (about 20 or so pixels). Also note that unless the -nointegraleheight option is given, the height of the dropdown list won't be exactly the amount you specify, as Windows will adjust the height to fit the contents, usually about 20 pixels per item. Depending on the number of items, you may also need to set the -vscroll option to display a vertical scrollbar. As far as I know, you can't specify that a combobox opens its list upwards, Windows takes care of that, and I think would only open it upwards if there was no room beneath the control to display the list. If you want an input box that restricts input, you could try the UpDown control, although this is limited to ranges of numerical data. The UpDown control is used to increment or decrement the value in its 'buddy' control. Here is an example of creating a UpDown control: $win-AddTextfield( -name = Text, -size = [80,20], -value = 0, ); $win-AddUpDown( -name = UpDown, ); $win-UpDown-Range(0,20); #sets the range for the UpDown control __END__ The UpDown control automatically selects the previous control in the z-order to be its buddy control, in this case the Textfield. Use the SetBuddy() function to change the buddy control if needed. Check the docs for more info. Hope this has helped, Kevin. From: ki...@netspace.net.au To: perl-win32-gui-users@lists.sourceforge.net Date: Sat, 1 Aug 2009 21:05:52 +1000 Subject: [perl-win32-gui-users] Comboboxes Hello again, I have a combobox sitting at the area at the bottom of the screen (in my app). I've added 4 items to it, and I can scroll through them fine when using the keyboard. However, if I use the mouse, the 'dropdown' part is about 1 pixel high, and I can't see the items. Here is my creation code: -AddCombobox(-name=test,-pos=[780,$win-ScaleHeight()-42],-size=[30,20], -dropdownlist=1); The $win window is the main window, but it's generally drawn maximised, so it seems I'll always have this problem. First off, is there any way to force the drop down list to open upwards? (Something tells me I'm hoping for the impossible with that one.) If that isn't possible, is there any way to have an input box that restricts users to certain inputs? I was ideally hoping for one of those little things with the up/down arrows (like with the DateTime GUI object) but nothing I've seen so far indicates this is possible. Can anyone offer some guidance? Thank you in advance. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ _ Looking for a place to rent, share or buy this winter? Find your next place with Ninemsn property http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline_t=774152450_r=Domain_tagline_m=EXT-- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
[perl-win32-gui-users] Win32::GUI Documentation
Hey everyone, After digging through the Win32::GUI source and Win32 API Documentation, I have created some updated Win32::GUI documentation. Let's face it, the docs are lacking in some areas, so I decided to add to some of the information that is provided. If anyone would like a copy of the updated docs, send me an email directly (off the mailing lists). If anyone has any questions, comments, or suggestions about the docs, please post them on the mailing lists. These docs are a work in progress, so if anyone has any ideas for any extra content that could be included, such as more tutorials, I would be happy to look into it. Kevin. _ Get the latest news, goss and sport Make ninemsn your homepage! http://windowslive.ninemsn.com.au/article.aspx?id=813730-- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Win32::GUI Documentation
Guys, I got a suggestion from Peter to set up a dedicated website for the Win32::GUI Documentation, which would include things such as more examples and tutorials, illustrations, etc. I wouldn't mind some feedback on what people think about this idea. Kevin. From: kejoh...@hotmail.com To: perl-win32-gui-users@lists.sourceforge.net Date: Sun, 12 Jul 2009 17:38:06 +1030 Subject: [perl-win32-gui-users] Win32::GUI Documentation Hey everyone, After digging through the Win32::GUI source and Win32 API Documentation, I have created some updated Win32::GUI documentation. Let's face it, the docs are lacking in some areas, so I decided to add to some of the information that is provided. If anyone would like a copy of the updated docs, send me an email directly (off the mailing lists). If anyone has any questions, comments, or suggestions about the docs, please post them on the mailing lists. These docs are a work in progress, so if anyone has any ideas for any extra content that could be included, such as more tutorials, I would be happy to look into it. Kevin. Make ninemsn your homepage! Get the latest news, goss and sport _ View photos of singles in your area Click Here http://dating.ninemsn.com.au/search/search.aspx?exec=gotp=qgc=2tr=1lage=18uage=55cl=14sl=0dist=50po=1do=2trackingid=1046138r2s=1_t=773166090_r=WLM_EndText-- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] Win32::GUI Documentation
Glenn, Yes, you're right, the documentation for the module is contained within the source code and is extracted during the build process. For a module this large, it probably made sense in the beginning to use this method to create the docs, but as the module has grown, I imagine it has become more difficult to manage. Perhaps moving the documentation into their own files is something for the developers to look at for the next release. Most of the changes I made to the docs involved replacing the TBD sections with the required information, as well as supplying more information about input parameters and return values for most of the functions. Kevin. Date: Sun, 12 Jul 2009 18:23:30 -0700 From: p...@nevcal.com To: kejoh...@hotmail.com CC: rur...@x-ray.at; perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Win32::GUI Documentation On approximately 7/12/2009 5:41 PM, came the following characters from the keyboard of Kevin Marshall: Reini, I understand where you are coming from, a diff would make replacement of the original files easier. I was, however, considering a complete rewrite of the documentation, including the structure, which would make patching the existing files interesting. An alternative would be to copy my docs over the docs generated in the build process, before doing make install. Another way would be to edit the makefile to prevent the docs being generated, then move my docs into their place, then do make install. For those people who use the PPMs they have less options. The best they can do is copy my docs over the originals after installing the PPM. It was suggested I set up a dedicated website for the documentation. This would certainly overcome any of these problems. Well, a dedicated website for the documentation only works-around these problems. I think presently the source for the documentation is in the source code files for the modules. If that is preserved, it is more likely that the documentation will get updated when the code gets updated. Even if you do a complete rewrite of the documentation, if it is not integrated with the module source in some way, it will likely not get maintained over time. That said, I agree that the documentation could use some help; last I looked at it, there were lots of TBD areas. _ View photos of singles in your area Click Here http://dating.ninemsn.com.au/search/search.aspx?exec=gotp=qgc=2tr=1lage=18uage=55cl=14sl=0dist=50po=1do=2trackingid=1046138r2s=1_t=773166090_r=WLM_EndText-- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
Re: [perl-win32-gui-users] How to catch keyboard event like LeftAlt+F5?
Waldmar, One solution I have would be to install a hook for one or more of the various keyboard messages that are available. These messages give you access to flags that give extended information, which could be used to determine if the ALT key is down. My suggestion would be to use the WM_SYSKEYDOWN message. Here is a very basic example: use strict; use warnings; use Data::Dump qw(dump); use Win32::GUI qw(); use Win32::GUI::Constants qw(/^WM_/); #gets all WM_ message constants my $win = Win32::GUI::Window-new( -name = 'main', -size = [320,240],); $win-Hook( WM_SYSKEYDOWN, sub{ dump \...@_; #shows all parameters; my($this,$wParam,$lParam,$type,$msgcode) = @_; return unless $type == 0; #make sure message isn't WM_COMMAND or WM_NOTIFY return unless $msgcode == WM_SYSKEYDOWN; #make sure message is WM_SYSKEYDOWN #process event return 0; } ); $win-Show(); Win32::GUI::Dialog(); __END__ This may be what you were looking for. Check out the Windows SDK documentation for more info about the various messages that could be used. Hope this will help. Kevin. From: w...@sao.pl To: perl-win32-gui-users@lists.sourceforge.net Date: Sat, 30 May 2009 19:02:02 +0200 Subject: [perl-win32-gui-users] How to catch keyboard event like LeftAlt+F5? Hello! I have the following problem: I can manage AltGr+F5 (RightAlt+F5) and all keyboard events with OEM and NEM. However I don't know how to catch the LeftAlt+F5 and similar. Can anyone help me? regards Waldemar -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://p.sf.net/sfu/creativitycat-com ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ _ Looking for a place to rent, share or buy this winter? Find your next place with Ninemsn property http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline_t=774152450_r=Domain_tagline_m=EXT-- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/
[perl-win32-gui-users] Win32::GUI + OpenGL
functions don't have a *_p variant, so the next best thing is to use the *_c variant, which accept OpenGL::Array objects. The use of OpenGL::Array is not documented in the module, but docs can be found on the website for the module (just search the web for POGL). I haven't included an example of this here, since it requires more knowledge of OpenGL, but experienced OpenGL programmers should have no problems using them. As an alternative to creating windows using Win32::GUI, windows can be created using the GLUT(OpenGL Utility Toolkit) functions supplied with OpenGL. These can create windows that a platform-independent, as well as a lot of other stuff. A lot of the examples supplied for the OpenGL module use the GLUT, making them more portable, but OpenGL needs to be compiled with support for GLUT, requiring the GLUT libraries. Since I can't seem to get XS-implemented modules to compile properly on my machine (I use PPM instead), I just stick with Win32::GUI. Its all about personal preference. Well, that's it for my Win32::GUI+OpenGL example. I hope someone finds it useful. I'm no expert at OpenGL or the Win32 API, so there is probably a better way of doing this. So far this model has worked for basic implementations but don't expect to be able to make anything to big, such as games, but you never know. I'd love to hear any questions or comments about this example, as well as any examples of anything anyone else has done. As a side note, I'm new to posting messages on the mailing lists. I was wondering whether I can send pictures attached (I was hoping to show a screen shot of my program). Also, how do I post a reply to an existing thread. Any help would be much appreciated. Sorry about any typos in advance. Contact me if you find any errors with this post (such as with the sample program). Thanks. Kevin Marshall (kejohm88 AT hotmail DOT com) _ View photos of singles in your area Click Here http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fsearch%2Fsearch%2Easpx%3Fexec%3Dgo%26tp%3Dq%26gc%3D2%26tr%3D1%26lage%3D18%26uage%3D55%26cl%3D14%26sl%3D0%26dist%3D50%26po%3D1%26do%3D2%26trackingid%3D1046138%26r2s%3D1_t=773166090_r=Hotmail_Endtext_m=EXT-- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/