Re: [perl-win32-gui-users] How to display unicode charset in Win32::GUI?
From: gff gffg tarak...@hotmail.com Hi, I'm working on a project and i added the multilanguage support. Perl : (v5.12.2) MSWin32-x86 build 1203 294165,OS : Windows 7 x86,Installed languages in OS : English,Turkish How to display the unicode charset in Win32::GUI Label-Text?Example; added russian language but not display in label text.I'm searching for solutions 4 days.I'm founded this solutions (and other) http://webcache.googleusercontent.com/search?q=cache:5HoSSFnETV4J:www.mail-archive.com/perl-win32-gui-users%40lists.sourceforge.net/msg04941.html+perl+win32+GUI+unicode+labelcd=5hl=trct=clnkgl=trsource=www.google.com.tr http://webcache.googleusercontent.com/search?q=cache:l_gAFrhiqxMJ:www.mail-archive.com/perl-win32-gui-users%40lists.sourceforge.net/msg04944.html+perl+win32+GUI+unicode+labelcd=6hl=trct=clnkgl=trsource=www.google.com.tr Win32::GUI doesn't support Unicode. The solution is to use WxPerl which is much more powerful (and portable on other operating systems than Windows). WxPerl doesn't have a syntax as nice as Win32::GUI, but it is better maintained and what's interesting for you... it fully supports Unicode. Octavian -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-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/
Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls
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 Marshall kejoh...@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 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
Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls
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 Marshall kejoh...@hotmail.com To: Octavian Rasnita orasn...@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 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
Re: [perl-win32-gui-users] Threads
I thought only the main thread can be used to create GUI elements reliably. Isn't that true? Octavian - Original Message - From: Perl Rob [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Thursday, November 06, 2008 6:52 PM Subject: [perl-win32-gui-users] Threads Hi all, Am I susceptible to a crash if I create a Win32::GUI object (such as a label) in one thread, then call methods on that object in another thread? Following is an example of what I mean. Notice that I'm passing the label object as an argument to the entry point function of the new thread. This seems to work, but I don't know if I should be doing it just because it works: use strict; use Win32::GUI(); use threads; my $main = Win32::GUI::Window-new ( -name = 'Main', -text = 'Template Window', -size = [300,300], ); my $label = $main-AddLabel ( -text = 'I like the number 10', -pos = [10,10], ); threads-create('countDown', $label); $main-Center(); $main-Show(); Win32::GUI::Dialog(); sub countDown { my $labelObject = shift; for (my $i=9; $i0; $i--) { $labelObject-Text(I like the number $i); sleep(1); } } Thanks, Rob - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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] Run as a gui or command line
You can call your program with a parameter and if the program sees that it was called with that parameter, it could first execute some code then exit, without reaching to the part where it creates the GUI. Octavian - Original Message - From: dwinkjr [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, November 05, 2008 10:00 PM Subject: [perl-win32-gui-users] Run as a gui or command line I am creating a program that I want to be able to call standalone as well as from another program. When called standalone i want it to open up the gui but when called from another program I want it to no produce a gui. Can anyone guide me in the right direction? -- View this message in context: http://www.nabble.com/Run-as-a-gui-or-command-line-tp20348810p20348810.html Sent from the perl-win32-gui-users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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] Newlines disappearing in richedit(unicode-content)
If I remember well, you need to use \par in the RTF document for specifying a new line. Find and read the RTF specifications. It will help you to do more other things. Octavian - Original Message - From: Raphael Stoeckli [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, November 05, 2008 10:05 PM Subject: [perl-win32-gui-users] Newlines disappearing in richedit(unicode-content) Hi @ all I’m working on an program, that can handle Unicode-text in richedit-fields. The fields sets and gets the text using some modifications of the richedit-field. These mods are also from this mailinglist. The problem is, that Newlines (\r\n) in strings (whether if it’s ASCII or Unicode) seems to be wiped, when I put the string into the modified richedit-field. I wrote a demo/test-program to show this behavior. You can get it here: http://www.rabanti.ch/storage/rtf_utf_test.pl or http://www.rabanti.ch/storage/rtf_utf_test.zip (if there is a problem with the encoding, while downloading) Anyhow I try to describe it abbreviated in this post. For saving Unicode-content into a string, I use these functions: - sub WM_USER() {1024}; sub EM_GETTEXTEX() {+WM_USER+94}; sub GT_DEFAULT() {0}; sub get_unicode # takes the text out of the richedit-field { my $maxlen = 1024; my $buffer = x $maxlen; my $flags = GT_DEFAULT; my $codepage = 1200; my $struct = pack(LLIpp, $maxlen, $flags, $codepage, undef, undef); my $address = pack(P20, $struct); my $wparam = unpack(L, $address); my $numTchar = $WIN - re - SendMessage(EM_GETTEXTEX, $wparam, $buffer); # re is the richedit-field, $WIN the window-object my $octets = substr($buffer, 0, ($numTchar*2)); my $text = decode(UCS-2LE, $octets); return($text); } - This is the richedit-field (simplified): $RE = $WIN - AddRichEdit( -name = 're', -size = [240, 80], -pushstyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_LEFT | ES_MULTILINE, ); - I get the text out of the field like that: $SAVE = get_unicode; When I try to write the string back into the field, I use this function and definition: - our $RTF_PROLOG = '{\rtf1'; sub string2rtf # string-converter for RTF-handling { my @input = @_; $input[0] =~ s/([^\x00-\x7F])/'\uc1\u'.((ord $1 32768)?ord $1 : ord($1)-65536).'?'/eg; return $input[0]; } - I try to set the text like that: $WIN - re - Text($RTF_PROLOG . string2rtf($SAVE) . '}'); The result is that all stored lines (in the string) appear on one single line, without newlines. The operation $input[0] =~ s/([^\x00-\x7F])/'\uc1\u'.((ord $1 32768)?ord $1 : ord($1)-65536).'?'/eg; seems to wipe the newlines. I checked the converted strings. The newlines (\r\n) are still there, nonetheless the richedit-field do not recognize them. If I use $WIN - re - Text($SAVE), the Newlines are appearing, but the unicode is broken. I think it's something about a sent (respectively not sent) system-signal. But I have at this time no plan about these things. I tested it on a Win2K (SP4)- System and a XP (SP3)-System with win32::GUI v1.06 and Activestate Perl v5.8.6.811 Can someone explain me this behavior, and get me a hint, how to correct this? Many thanks in advance!... and much sorry for the bad English. Regards, Raphael - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ 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] Sample Application to load Adobe Acrobat ActiveX control
Hi, Can you please tell me where from I can get Win32::GUI 1.06? I have the Theoryx repository set in ppm, but the latest available version is 1.03 there. I have also tried to compile Win32::GUI using the cpan shell (I have VS6) but as usually, it gave some compiling errors that I don't know how to solve. Thank you. Octavian - Original Message - From: rpnoble [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Saturday, July 05, 2008 8:40 PM Subject: [perl-win32-gui-users] Sample Application to load Adobe Acrobat ActiveX control This is my response to a query on perlmonks. It loads the default Adobe Acrobat ActiveX viewer in a Win32::GUI window via a file open menu. I used the Notepad.pl and GetOpenFileName.pl files for my base app. #!perl -w use strict; use warnings; use Win32::GUI 1.06 qw(CW_USEDEFAULT); use Win32::GUI::AxWindow; # Define the application menu my @menu_defn = ( File = File, OpenPDf = { -name = OpenPDF, -onClick = \OpenPDF}, Exit = { -name = Exit, -onClick = \QuitFile }, ); my $menu = Win32::GUI::Menu-new(@menu_defn); #Define the application window my $mw = Win32::GUI::Window-new( -title = Open PDF File, -size = [400,400], -left = CW_USEDEFAULT, -menu = $menu, -onResize = \resize, -onTerminate = \QuitFile, ); # Add a Acrobat AxtiveX control my $PDFControl = new Win32::GUI::AxWindow ( -parent = $mw, -name = PDFControl, -control = AcroPDF.PDF.1, -pos = [0, 0], -size = [400, 400], ); #Show application window $mw-Show(); #Enter event loop Win32::GUI::Dialog(); #Hide windows on exit $mw-Hide(); undef $mw; exit(0); #Open standard windows file open dialog box sub OpenPDF { my ( @file, $file ); my ( @parms ); push @parms, -filter = [ 'PDF - Adobe Acrobat File', '*.pdf', ], -directory = c:\\, -title = 'Select a PDF file'; @file = Win32::GUI::GetOpenFileName ( @parms ); # print PDF File: $file[ 0 ]\n; # Call Acorbat LoadFile Method $PDFControl-CallMethod(LoadFile, $file[ 0 ]); return 0; } #resize to fit user input sub resize { my ($self) = @_; my ($width, $height) = ($self-GetClientRect())[2..3]; $self-PDFControl-Resize($width+1, $height+1) if exists $self-{PDFControl}; } #Exit the application sub QuitFile { my $self = shift; #Set the Acrobat control to nothing $PDFControl-CallMethod(LoadFile, ); #This line is needed to keep the PERL interperter from crashing $PDFControl-Release(); return -1; } -- View this message in context: http://www.nabble.com/Sample-Application-to-load-Adobe-Acrobat-ActiveX-control-tp18294501p18294501.html Sent from the perl-win32-gui-users mailing list archive at Nabble.com. - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ 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/ - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ 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] Characters in other languages than english?
Hi, I know that Win32::GUI doesn't support UTF-8 characters and maybe it won't support it very soon, but is it possible to use characters in other european languages in a Win32::GUI program? I just want to use the charset ISO-8859-2 instead of ISO-8859-1, or... the Windows1052/1050. Is it possible to do that? I know that I could make a hack and use UTF-8 in a Richedit field, but I need to use special chars in menus, lists... Thank you. Octavian - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.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/
[perl-win32-gui-users] Flash
Hi, Is it possible to display a Flash annimation in a window created with Win32::GUI? If yes, please tell me how. I think that it should be possible to do it using Win32::GUI::AxWindow but I don't know what control name to use in the -control option. BTW, for other type of controls, where can I find the control name I need to use in a Win32::GUI::AxWindow object? Thank you. Octavian
[perl-win32-gui-users] creating a child window
Hi, I have tried to create a child window, but when I close it, the entire application closes. I open it with an option from the menu of the parent window that has a -onClick = \Config, and I returned 0 or 1 from the sub Config {} subroutine, but the application still closes when closing that window. Are there any samples of using child windows? Or can you tell me how to do it? Thank you. Octavian
Re: [perl-win32-gui-users] creating a child window
Where could that path be? I tried to see if there is something in d:\usr\eg and d:\usr\site\lib\Win32\GUI ...but I couldn't find examples for creating a child window. I found only some samples in the demos directory but not for creating child windows. Thank you. From: [EMAIL PROTECTED] Hi, have a look at the examples in your perl-lib-path. j. Original-Nachricht Datum: Wed, 20 Jun 2007 15:34:03 +0300 Von: Octavian Rasnita [EMAIL PROTECTED] An: perl-win32-gui-users@lists.sourceforge.net Betreff: [perl-win32-gui-users] creating a child window Hi, I have tried to create a child window, but when I close it, the entire application closes. I open it with an option from the menu of the parent window that has a -onClick = \Config, and I returned 0 or 1 from the sub Config {} subroutine, but the application still closes when closing that window. Are there any samples of using child windows? Or can you tell me how to do it? Thank you. Octavian - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ 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/ -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
Re: [perl-win32-gui-users] creating a child window
Thank you! That was it. I didn't put a SecondWin_Terminate subroutine, because I thought if I don't use it, it would be just like using it and returning 0 but if the default is -1, then I need to use it explicitly. Thanks. Octavian - Original Message - From: Robert May [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, June 20, 2007 10:05 PM Subject: Re: [perl-win32-gui-users] creating a child window On 20/06/07, Octavian Rasnita [EMAIL PROTECTED] wrote: I have tried to create a child window, but when I close it, the entire application closes. I open it with an option from the menu of the parent window that has a -onClick = \Config, and I returned 0 or 1 from the sub Config {} subroutine, but the application still closes when closing that window. Are there any samples of using child windows? Or can you tell me how to do it? I think you mean an owned window, and not a child window? If so, then there are examples in the demos (for example see the help menu option in the NotifyIcon.pl demo). You want the -onTerminate handler of the owned window to return 1 (by default it returns -1, which exits the Dialog() processing). If I'm mis-understanding you, then perhaps you could post a (small and complete) example so that we can better understand what you are trying to do. Regards, Rob.
Re: [perl-win32-gui-users] Deprecated Constants
Hi, Where can we find details about all those constants? (I hope not on MSDN. :-) Thanks. Octavian - Original Message - From: Robert May [EMAIL PROTECTED] To: Brian Rowlands (Greymouth High School) [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Tuesday, June 05, 2007 11:32 PM Subject: Re: [perl-win32-gui-users] Deprecated Constants On 05/06/07, Brian Rowlands (Greymouth High School) [EMAIL PROTECTED] wrote: I've written my first GUI using The GUI Loft and all works fine except I get the following warnings: 'use Win32::GUI;' is currently exporting constants into the callers scope. This functionality is deprecated. Use 'use Win32::GUI();' or list your required exports explicitly instead. at C:/Perl/site/lib/Win32/GUI/Loft/Design.pm line 31 C:/Perl/site/lib/Win32/GUI/ToolbarWindow.pm line 23 C:/Perl/site/lib/Win32/GUI/BorderlessWindow.pm line 24 C:/Perl/site/lib/Win32/GUI/Loft/Cluster.pm line 21 C:/Perl/site/lib/Win32/GUI/AdHoc.pm line 31 C:/Perl/site/lib/Win32/GUI/Loft/Control/ListView.pm line 22 C:/Perl/site/lib/Win32/GUI/Loft/Control/TabStrip.pm line 23 C:/Perl/site/lib/Win32/GUI/TabStripGroup.pm line 25 C:/Perl/site/lib/Win32/GUI/HyperLink.pm line 6 Q1: Can someone advise as to the best way to overcome this issue please or must I just turn off warnings using: no warnings 'deprecated'; That's the easiest way, but it only masks the problem. We're in a deprecation cycle, and in one of the next releases Win32::GUI will stop exporting the constants by default, and then if any of these modules rely on the constants being exported, they will fail. The best solution is to bug the module authors (and I'm the Win32::GUI::HyperLink author) to fix their modules; or better yet provide them with patches. BTW, SourceForge say to either A) use Win32::GUI(); when not using constants B) explicitly name them if you are using constants Q2: Since constants are being used how do I tell what need to be named? If all the modules have use strict; near the start, then just change the use Win32::GUI; line to use Win32::GUI qw(); and re-run you script - it will fail to compile for each constant, and add it use Win32::GUI qw(YOUR_CONSTANT_HERE); If a module doesn't 'use strict' then it's harder, and you'll have to look through the code for the constants. An (easier) alternative is to change each use Win32::GUI; line into use Win32::GUI qw(:compatibility_win32_gui) which will cause Win32::GUI to keep exporting the 300+ constants into the caller's namespace without warning. But this doesn't really solve the problem either Regards, Rob. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ 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] Rich text field
Hi Sean, Thank you for your help. I hope I will be able to do it. Octavian - Original Message - From: Sean Healy [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Sunday, April 22, 2007 7:08 PM Subject: Re: [perl-win32-gui-users] Rich text field I have already tried it, but I cannot store more than 32 KB of text in a Richedit field (using Win32::GUI::Richedit). Those 32 kb of text takes around 48 kb of rich text, but it cannot store more than that. I have tried using the Load() and Save() methods and I have also tried creating the rich text manually and storing it in the field, but it doesn't allow more than 32 kb of text. Look at the Win32::GUI::RidhEdit methods GetLimittext(), SetLimitText(), and LimiteText(). An unfortunate misspelling on that last one; perhaps that can be fixed in a future version - as of 1.05 it's still LimiteText instead of LimitText Of course, both names may need to be kept for several versions, so as not to break any code that's using the misspelled version. Here's some more info on the text size limit: EM_LIMITTEXT Message The EM_LIMITTEXT message sets the text limit of an edit control. The text limit is the maximum amount of text, in TCHARs, that the user can type into the edit control. You can send this message to either an edit control or a rich edit control. For edit controls and Microsoft Rich Edit 1.0, bytes are used. For Rich Edit 2.0 and later, characters are used. Syntax To send this message, call the SendMessage function as follows. lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) EM_LIMITTEXT, // message ID (WPARAM) wParam, // = (WPARAM) () wParam; (LPARAM) lParam // = 0; not used, must be zero ); Parameters wParam Specifies the maximum number of TCHARs the user can enter. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. This number does not include the terminating null character. Rich edit controls: If this parameter is zero, the text length is set to 64,000 characters. Edit controls on Windows NT/2000/XP: If this parameter is zero, the text length is set to 0x7FFE characters for single-line edit controls or -1 for multiline edit controls. Edit controls on Windows 95/98/Me: If this parameter is zero, the text length is set to 0x7FFE characters for single-line edit controls or 0x for multiline edit controls. lParam This parameter is not used. Return Value This message does not return a value. Remarks The EM_LIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_LIMITTEXT message, the user can edit the entire contents of the edit control. Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters. Edit controls on Windows NT/2000/XP: For single-line edit controls, the text limit is either 0x7FFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either -1 byte or the value of the wParam parameter, whichever is smaller. Edit controls on Windows 95/98/Me: For single-line edit controls, the text limit is either 0x7FFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either 0x bytes or the value of the wParam parameter, whichever is smaller. Rich Edit: Supported in Rich Edit 1.0 and later. Use the message EM_EXLIMITTEXT for text length values greater than 64,000. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. Message InformationHeader Declared in Winuser.h, include Windows.h Minimum operating systems Windows 95, Windows NT 3.1 See Also Edit Controls Overview, EM_EXLIMITTEXT, WM_SETTEXT - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ 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] Rich text field
From: Jason Plum [EMAIL PROTECTED] Hi, Yes, I believe it is quite possible, as unless I am mistaken, I have had 1MB loaded into a rich edit in one of my widely used programs. The easy way to test it would simply be to create it, and load in 200KB of text from some file (or randomly even). Try creating the richtext control and and a textfield. cycle it through say, 256 characters at a time, upping the value in the text field. This would give you a visual of where it dies, if it dies. Jason Hi, I have already tried it, but I cannot store more than 32 KB of text in a Richedit field (using Win32::GUI::Richedit). Those 32 kb of text takes around 48 kb of rich text, but it cannot store more than that. I have tried using the Load() and Save() methods and I have also tried creating the rich text manually and storing it in the field, but it doesn't allow more than 32 kb of text. Thank you. Octavian
[perl-win32-gui-users] Rich text field
Hi, Is it possible to create a big Richtext field using Win32::GUI? For example to hold more than 200 KB. Thank you. Octavian
Re: [perl-win32-gui-users] Launching a detached child process fromWin32 app
I have not tried with Install Shield, but only with Null Soft installer (which is free) and you can do this very simple. You just need to put an exec [program name] in the configuration script, and the installer will launch that program. Of course you can close the installer while the program is still running. However, I'm sure Install Shield also can do this. Octavian - Original Message - From: Zach [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Thursday, December 28, 2006 1:46 PM Subject: [perl-win32-gui-users] Launching a detached child process fromWin32 app I recently wrote an install shield with Win32::GUI. A nice feature I see of some install shields is the option to Launch application after the install is done. It's a nice convinient feature to let the user get down to business without having to click on the app via the start menu or desktop icon. The problem is that I have yet to find a method for executing a program from a Win32 that doesn't wait for the child to die. I have tried various fork methods as well as Proc methods and Win32::Job and threads. All of these methods require that the parent, or calling program wait until the spawn's program dies. I of course just want to launch the install app and let the user exit the install shield. This has to be doable right? Thank you. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ 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] Is there any book or a complete tutorialfor Win32: :GUI ????
And one more thing that might be important for some users... The programs created with Tk are not accessible for the blind computer users at all, while the programs created with Win32::GUI are fully accessible for screen readers. Octavian - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net Sent: Monday, December 04, 2006 10:37 AM Subject: Re: [perl-win32-gui-users] Is there any book or a complete tutorialfor Win32: :GUI Hi, You won't find TK any easier - you'll probably find it harder as its based in unix land. TK is also slower and larger, and it can look different than native win32 apps. Historically it was also unstable - but it has improved a lot over the last few years. Give it a try and see which you prefer. Go to the win32 homepage for the full documentation set - I haven't got the link handy but a google will find it:) Cheers, jez -Original Message- From: Krishh [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net perl-win32-gui-users@lists.sourceforge.net Sent: 03/12/06 09:56 Subject: Re: [perl-win32-gui-users] Is there any book or a complete tutorial for Win32: :GUI Thanks for the reply. yeah, I guess I am good up to that. but to create more interactive applications, I think I might need more experience. If there's no book, then I have to spend more time on this. Are there any online documentations?? Donno whether I should ask this or not, How about Perl/Tk? Would that be simple for a lazy guy like me? From the introduction the Perl/Tk has in CPAN, frankly I dont understand why Win32::GUI is developed? Regards, gopi. jez_white wrote: Hi, I don't think there is a book - although there was talk of one a couple of years ago. Make sure you are using the latest version of Win32::GUI (1.05) as it has improved examples and documentation. If you understand the principles of event driven programming your battle is half won, as Win32::GUI isn't that different from other toolsets. Cheers, Jeremy. -Original Message- From: gopi chaithanya [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net perl-win32-gui-users@lists.sourceforge.net Sent: 01/12/06 05:49 Subject: [perl-win32-gui-users] Is there any book or a complete tutorial for Win32: :GUI I have just started learnig Win32::GUI.It appears like a hard thing to do in Perl(as I was using java to create interactive GUIs).Are there any books or any construtive tutorials for this??The examples given in the Win32::GUI module helps a bit, but not quite, for a newbie like me. Though I understand some, I am not satisfied and not confident enough to start any project.I guess, there should be some complete documentation for this. Could you please guide me??Thanks in advance,Gopi. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ 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/ -- View this message in context: http://www.nabble.com/Re%3A-Is-there-any-book-or-a-complete-tutorial-for-Win32%3A-%3AGUI--tf2736660.html#a7637197 Sent from the perl-win32-gui-users mailing list archive at Nabble.com. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ 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/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ 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] charset
Oh yes, with other words, the only real good solution is using UTF-8, but unfortunately Win32::GUI doesn't support it. From experience I know that very many computer users from Romania don't bother to set their computers to use the romanian language, and use the english defaults, so I need to make a program that works always, no matter the settings of Windows. I think I will make a few tests with WXPerl, then maybe I will pass to C# that surely works. Octavian - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Friday, December 01, 2006 11:20 PM Subject: Re: [perl-win32-gui-users] charset On approximately 11/28/2006 8:04 PM, came the following characters from the keyboard of Octavian Rasnita: I have tried yoursample code. The first time it worked fine and all the special chars were displayed correctly. So this test was with your Regional and language options setting to use Romanian for single-byte character type. And it worked. So this is using some Code Page that supports Romanian. Then I have tried to make some changes in the regional settings to see if it works with the default settings. So I have changed in the Regional and language options/Advanced tab to use the English language when a program doesn't use UTF-8 but a single-byte character type. After doing this, only the first special char was displayed correctly, because it can be also found in the ISO-8859-1 charset. The other chars were replaced with non - correct characters. And this test was with your Regional and language options setting to use English for single-byte character type. And it didn't work. So this is using code page 1252 (I think, or maybe 8859) that supports English and some other European languages, also known as ISOLatin1 So, here's a global Windows question that I don't know if anyone on this list knows the answer to, but you never know... but lack of response probably wouldn't mean that the technique isn't possible. Is there a way in Windows to mark a program as using/needing a particular Regional and language option setting? As far as I can tell, but I am not the expert in this area, no. http://www.microsoft.com/globaldev/handson/dev/muiapp.mspx declares loudly that if you want to support multiple languages in one program, that you should make it Unicode. Figure 2 explains why: that if your program's ANSI localized language doesn't match that of the system, that you can get inappropriate characters displayed. Further, http://www.microsoft.com/globaldev/handson/dev/AppCompatInMUI.mspx says: Any non-Unicode application will be able to run only when the system locale (also called “Language for non-Unicode Programs” on XP) is set to match the application’s language. and It normally makes sense to have your program’s UI language in sync with the system UI, you can call /GetUserDefaultUILanguage/ to know the current user’s UI language and switch your applications’ based on it. So it does appear that it is a limitation of the design of Windows, that even though Windows itself supports Unicode, and can translate all the various code pages to and from Unicode (consistently, when all the characters benig converted are in the code page of interest), that there is no support for the code page to be specified on a per-program basis. On the other hand, it is quite possible that some other page in the Windows documentation will contradict these pages, and give a solution. But I wouldn't hold my breath. It seems that the answer for multi-language support on Windows, is 16-bit Unicode. If you don't play 16-bit Unicode, you are stuck using the globally configured code page (Regional and language options setting) for all programs concurrently running on a particular machine. Of course, you could tell the user to switch back and forth, or potentially figure out how to switch it for the user. But I'm not sure what happens if you switch very dynamically, or even if you can choose appropriate times to switch. The only other solution I can see, short of porting Win32::GUI to use the W API (Unicode), is to do all text display via user code, and while it is possible to make owner-drawn controls, it would be very cumbersome to do that for every type of text in every type of control. And I think you'd lose a lot of the accessibility, if the menu entries were owner-drawn bitmaps that look like text, instead of being the text itself. P.S. My interest in this subject is because I also am laboring to support multiple languages, now including Romanian, in an application. Fortunately, I only need to support display of Romanian characters inside edit boxes (RichEdit can do that), and inside images. The images have a combination of line art, text, and icons... but I do have to support taking text from the edit boxes (and from UTF-8 files), and placing
Re: [perl-win32-gui-users] charset
Ok, thanks for confirming what I thought. Too bad that I will need to start using other libraries which are less accessible. Octavian - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, November 29, 2006 3:09 AM Subject: Re: [perl-win32-gui-users] charset On approximately 11/28/2006 8:04 PM, came the following characters from the keyboard of Octavian Rasnita: So I modified Dan's code as below, and it almost works... I got a blank window, until I initialized the label with a non-empty string value... probably due to length calculations somewhere. Unfortunately, only the first accented character retains it accent... the other 3 do not. The other three all seem to be characters used only in Romanian (among language character sets I am somewhat familiar with). I wouldn't think that UTF-8 to UTF-16LE translation should affect that, so it must be something else... Some hex dumps convince me that the encode is working properly, so that is good. But the text is still not properly displayed, even though it is clearly being set by the 'W' form of the API call. So perhaps the code page for the screen overrides the best efforts of the programmer to display the right stuff? I have tried yoursample code. The first time it worked fine and all the special chars were displayed correctly. Then I have tried to make some changes in the regional settings to see if it works with the default settings. So I have changed in the Regional and language options/Advanced tab to use the English language when a program doesn't use UTF-8 but a single-byte character type. After doing this, only the first special char was displayed correctly, because it can be also found in the ISO-8859-1 charset. The other chars were replaced with non - correct characters. So I think that Win32::GUI somehow translates the UTF-8 string into a single-byte character and if Windows is set to display the non-UTF-8 characters using English, it do so. Teddy Well, that is what happened to me. I don't think Win32::GUI is in the business of translating character codes... what it doesn't know about Unicode would fill the book on Unicode... so it must be Windows itself and I have a sneaking suspicion that it has something to do with code pages. I suspect that until Win32::GUI gets complete Unicode support, that Windows will limit how much Unicode action can take place. When I read some of the documentation for the Unicode support, it sure seemed that for most windows and controls, you have to make them using the W APIs to make them work with Unicode characters... and then you pretty much have to use all W APIs to access them. MS seems to have limited their support for UTF-8, which would have helped immensely by allowing programs that are mostly byte-size-character handlers, to introduce Unicode gradually. The support for code page 65001, which seems to be the UTF-8 code page, is limited to a small subset of the Windows APIs.
Re: [perl-win32-gui-users] charset
From: Glenn Linderman [EMAIL PROTECTED] Yes, maybe, or no. How often and it how many different places do you need to display characters that don't get displayed properly? I need to display those strings in many places, because I need to create interfaces in romanian language. For example, now I need to display them in menus and list boxes, and combo boxes. Would it be possible, or too much overhead, to use RichEdit controls in those places, appropriately sized and tweaked and possibly set read-only and possibly set with a non-standard border, and having a common background color with the enclosing window, so that it looks like a label, or button or whatever? It would be too complicated, because I cannot see, and I don't know what styles I should use to make the Richedit look like a button, but that richedit control cannot replace a combo box, a list view or list box, or a radio button, a checkbox... Or does doing all that ruin the accessibility? I haven't tried it, but I think it doesn't break the accessibility for the controls it can replace, however, it cannot be used for every control type I need. It would be nice at least if it would be possible to create a program using WX, but also include in it some Win32::GUI controls, or something like that... Teddy
Re: [perl-win32-gui-users] charset
Yes I also think that it should work. The big problem is that it already works, but only on my computer. :-) I have tested under Win 2k and Win XP and it works, but other users say that the special chars are not displayed correctly under their computers. Thank you for any help. Teddy But maybe you have a different default code page than they do? I don't know. How can I check that? I have just installed Win XP and I haven't made any Regional and language options settings, and I have installed my program. It worked ok. So with the default options of Win XP it works. Then I have changed the settings to use the Romanian language in Regional and language options, but the program works the same. I guess the other users are using the romanian regional settings also. I am creating a free dictionary for the romanian language, and the other users are on a mailing list that discusses about the romanian dictionaries, so I guess that they all have a romanian regional settings. However, I would like to be able to create a program that works well, no matter the regional settings used by the users. Is it possible without using UTF-8? Teddy
Re: [perl-win32-gui-users] charset
Ok, thanks for the code. I will try it. I know that some special chars from romanian language are displayed correctly because they are used in ISO-8859-1 also. For example, â and î are displayed correctly, but ş, ţ and ă are not. I will try to see if your code helps to show them right. Thanks. Octavian - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Santeri Paavolainen [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net; Octavian Rasnita [EMAIL PROTECTED] Sent: Tuesday, November 28, 2006 10:08 AM Subject: Re: [perl-win32-gui-users] charset On approximately 11/27/2006 11:25 PM, came the following characters from the keyboard of Santeri Paavolainen: Hi, I have used Win32::API and Encode to accomplish this directly via SetWindowTextW function which takes a UTF-16LE string argument: use Win32::API; use Encode; our $SetWindowTextW_fn = undef; sub text { my ($control, $text) = @_; if (not $SetWindowTextW_fn) { $SetWindowTextW_fn = Win32::API-new(user32, SetWindowTextW, NP, N); die unless $SetWindowTextW_fn; } $SetWindowTextW_fn-Call($control-{-handle}, t2w($text)); } # t2w - convert arbitrary string (may be unicode or not) to UTF-16LE # encoding. Windows uses UTF-16LE as its native Unicode encoding (the # W version of functions). sub t2w { my ($text) = @_; return encode(UTF-16LE, $text . \x00); } Since the encode function follows the normal Perl unicode'ness rules it will work correctly if you give it an unicode string (as long as it has been decoded to perl's internal format, of course). For example, text($label, \x{0032}\x{2208}\x{007b}\x{0032}\x{007d}) should work. Ought. Might. :-) *Note*: I have not extensively tested whether this works for all unicode codepoints - it was a hack I needed to get some characters shown correctly and after that was accomplished I have never looked at the code since. Also, this worked with 1.03. I have not tried it with more recent Win32::GUI versions. Hope this helps, Santeri Paavolainen Interesting! And thanks for the encouragement that such a mixture might work... So I modified Dan's code as below, and it almost works... I got a blank window, until I initialized the label with a non-empty string value... probably due to length calculations somewhere. Unfortunately, only the first accented character retains it accent... the other 3 do not. The other three all seem to be characters used only in Romanian (among language character sets I am somewhat familiar with). I wouldn't think that UTF-8 to UTF-16LE translation should affect that, so it must be something else... Some hex dumps convince me that the encode is working properly, so that is good. But the text is still not properly displayed, even though it is clearly being set by the 'W' form of the API call. So perhaps the code page for the screen overrides the best efforts of the programmer to display the right stuff? #! perl -w use strict; use Win32::GUI (); use Win32::API (); use utf8; # enable Perl to parse UTF-8 from this file use Encode; # t2w - convert arbitrary string (may be unicode or not) to UTF-16LE # encoding. Windows uses UTF-16LE as its native Unicode encoding (the # W version of functions). sub t2w { my ($text) = @_; return encode(UTF-16LE, $text . \x00); } our $SetWindowTextW_fn = undef; sub text { my ($control, $text) = @_; if (not $SetWindowTextW_fn) { $SetWindowTextW_fn = Win32::API-new(user32, SetWindowTextW, NP, N); die unless $SetWindowTextW_fn; } $SetWindowTextW_fn-Call($control-{-handle}, t2w($text)); } my $string = 'Râşniţă'; print $string; # this should warn about Wide character in print, # confirming that $string was correctly parsed from UTF-8 into Perl's # internal representation my $main = Win32::GUI::Window-new( -name = 'Main', -size = [400, 300], ); # The Label will inherit $win_main's font my $label = $main-AddLabel( -text = 'this is a temp string', ); text($label, $string); $main-Show; Win32::GUI::Dialog(); Glenn Linderman wrote: On approximately 11/27/2006 10:34 PM, came the following characters from the keyboard of Octavian Rasnita: I can't actually help you here, off the top of my head, but it is an area that I am interested in. Have you noted Dan Dascalescu's post on Date: Sat, 18 Nov 2006 18:44:57 -0800 Hi, Yes, I have also talked on private with Dan. He told me that he tried to initialize some fonts, and to specify the charset for them. He tried very many charsets, but the result was always the same: the program was using the default ISO-8859-1. It is too bad if Win32::GUI can use only a single charset because it is the most accessible GUI library for screen readers, and I will need to try using another
[perl-win32-gui-users] charset
Hi, I know that Win32::GUI doesn't support UTF-8, but can you tell me if it is possible to display characters from other charsets than ISO-8859-1? I want to create the menus, labels, and so on, using ISO-8859-2. More specificly, I need to be able to print the following special chars: staîâSTAÎÂ I have tried to simply write those chars in the perl program, and they appear well on my computer, however, some users tell me that they don't appear correctly on their computers. I have first developed the program under Win 2000, and the users are using Win XP, and I thought that there might be a problem due to the OS difference. Now I have installed Win XP, and I have tried running my program without any special settings for the romanian language, but the characters are displayed correctly under Win XP also. So I really have no idea what could be the problem or what I am doing wrong that it works well only on my computer. Help! Thank you very much. Teddy
Re: [perl-win32-gui-users] charset
I can't actually help you here, off the top of my head, but it is an area that I am interested in. Have you noted Dan Dascalescu's post on Date: Sat, 18 Nov 2006 18:44:57 -0800 Hi, Yes, I have also talked on private with Dan. He told me that he tried to initialize some fonts, and to specify the charset for them. He tried very many charsets, but the result was always the same: the program was using the default ISO-8859-1. It is too bad if Win32::GUI can use only a single charset because it is the most accessible GUI library for screen readers, and I will need to try using another one like WX... Thanks. Teddy
[perl-win32-gui-users] aligning the text in the menus
Hi, I want to specify in a certain menu element that I want to right-align the hotkey that can be used to activate that menu item, like: CopyControl+C Cut Control+X Delete Control+D Is it possible to do it with Win32::GUI in a better way than simply using more spaces? Thanks. Teddy
[perl-win32-gui-users] bug in GetSaveFileName?
Hi, I have seen that the option -extensiondifferent of the GetSaveFileName method doesn't have any effect, no matter if it is set to 0 or 1. The user can choose any extension wants, and it is set instead of setting the default extension. The default extension is added to the file name only if the user doesn't type any extension to the file. Teddy
[perl-win32-gui-users] menus
Hi, Can you tell me if I can find somewhere a sample code that shows how to check/uncheck some menu items, and if it is possible to change the status bar text when the user moves the mouse cursor through the menus? Also, where can I find the list of events that can be handled for a Richedit control? Thank you. Teddy
Re: [perl-win32-gui-users] Combobox
Thank you very much for this code. I will try to test it, although I am not sure that I know how to apply that patch. Teddy - Original Message - From: Kind, Uwe (AGIS) [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Sunday, October 29, 2006 1:35 AM Subject: Re: [perl-win32-gui-users] Combobox Hi Teddy, try the following: #!perl -w use Win32::GUI ( 'WM_COMMAND' ); my $mw = new Win32::GUI::Window ( -name = 'mw', -left = 100, -top = 100, -width= 300, -height = 100, -title= 'CBTest', ); my $cb= $mw - AddCombobox ( -name = 'cb', -left = 10, -top= 20, -width = $mw - ScaleWidth () - 20, -height = 200, -disablenoscroll= 200, -dropdown = 1, -vscroll= 1, ); my $cb_event = sub { my $self = shift (); if ( $_ [ 0 ] == 0x40003E9 ) { my $text = $self - Text (); my $match = $self - FindString ( $text ); if ( $match = 0 ) { $self - Text ( $self - GetString ( $match ) ); $self - SetEditSel ( length ( $text ), -1 ); } } return ( 1 ); }; $cb - Hook ( WM_COMMAND, $cb_event ); $cb - SetFocus (); for ( 65 .. 90 ) { $cb - AddString ( chr ( $_ ) . ' Test' ); } $mw - Show (); Win32::GUI::Dialog (); It won't work from the scratch because of an bug in SetEditSel, so Combobox has to be patched first: XS(XS_Win32__GUI__Combobox_SetEditSel) { dXSARGS; if (items != 3) Perl_croak(aTHX_ Usage: Win32::GUI::Combobox::SetEditSel(handle, start, end)); { HWND handle; WPARAM start = (WPARAM)SvIV(ST(1)); WPARAM end = (WPARAM)SvIV(ST(2)); LPARAM sel = end * 0x1 + start; /* added */ LRESULT RETVAL; dXSTARG; if(SvROK(ST(0))) { SV** out=hv_fetch((HV*)SvRV(ST(0)), -handle, 7, 0); if(out != NULL) handle = INT2PTR(HWND,SvIV(*out)); else handle = NULL; } else handle = INT2PTR(HWND,SvIV(ST(0))); #line 561 Combobox.xs / * RETVAL = SendMessage(handle, CB_SETEDITSEL, start, (LPARAM) end); */ RETVAL = SendMessage(handle, CB_SETEDITSEL, 0, sel); /* changed */ #line 984 Combobox.c XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } Furthermore You should handle Del and Backspace or it won't possible to enter a string like 'A Te' because it's always expanded to 'A Test'. Regards, Uwe - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ 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] events of the RichEdit field
Hi, I want to create a RichEdit field that handles the keyboard and mouse events, and other events (like ENM_LINK). I have imported all the events I want using: use Win32::GUI qw(MB_OK MB_YESNO MB_ICONEXCLAMATION MB_ICONHAND ENM_CHANGE ENM_KEYEVENTS ENM_LINK ENM_MOUSEEVENTS ENM_SELCHANGE); Then right after defining the RichEdit field, I have put: $Control-SetEventMask(ENM_MOUSEEVENTS); I have also tried: $Control-SetEventMask(ENM_CHANGE|ENM_KEYEVENTS|ENM_LINK|ENM_MOUSEEVENTS|ENM _SELCHANGE); I have defined a Control_Click and a Control_DblClick subroutines which should be called by -onClick and -onDblClick, but nothing happends if I click or double-click in the RichEdit field. Should I do something else to activate those events? Thank you. Teddy
[perl-win32-gui-users] UserData
Hi, Is the method UserData() thread safe? Can it be used for associating some data with a certain window in a thread, then read that data from another thread? Thank you. Teddy
[perl-win32-gui-users] setting the charset
Hi, Can you tell me how can I set the wanted charset for a certain web page I want to display in an AxWindow object? I want to set it to UTF-8. I have tried some ways, but they are not OK. I have printed the html page into a temporary file with the .htm extension then I have given the path to that file to -control = in the AxWindow constructor or in the Navigate method of the object. The page is printed using UTF-8 charset on some computers, and another charset on others. I have seen that if I open the temporary file using Internet Explorer and manually choose to view it using UTF-8, then I open again my program, it is shown correctly using UTF-8 in my program also. But the problem is that I don't know how to be sure that the file is printed always using UTF-8. I have also tried to store in the file: meta http-equiv=Content-Type content=text/html; charset=UTF-8 / ... but it seems that this element doesn't have any effect. Thank you very much. Teddy
[perl-win32-gui-users] onGotFocus event for a button
Hi, I want to remember the object that has the focus, so the next time the user switches to the application, the focus is set to the last object that had the focus when the application was put in the background (with alt+tab). I don't know if I have used the right method, but here is what I've done: I have set a -onGotFocus event for each object, and in the method that handles this event I have set a global var $last_focus in which I put the handle of that object. In the Win_Activate method, I have put the program to SetFocus() to the object that has the handle from $last_focus. Well, it works pretty fine, but the issue is that not all the objects have an -onGotFocus event, or this is what it seems to be. Or am I doing something wrong? Here is a test program that shows that the Textfield has that event, but the Button object doesn't have it. I have also noticed that the AxWindow object doesn't have this event either. (I have also put that method to print a MessageBox, for seeing this easier). use strict; use Win32::GUI; my $last_focus; my $Win = Win32::GUI::Window-new( -name = Win, -text = Test, -size = [400, 300], -dialogui = 1, -onActivate = \Win_Activate, ); my $Label = $Win-AddLabel( -name = Label, -text = Name, -pos = [0, 0], -size = [50, 0], ); my $Edit = $Win-AddTextfield( -name = Edit, -pos = [50, 0], -size = [100, 20], -tabstop = 1, -onGotFocus = \Edit_GotFocus, ); my $Button = $Win-AddButton( -name = Button, -text = Ok, -pos = [150, 0], -size = [50, 20], -tabstop = 1, -onGotFocus = \Button_GotFocus, ); $Win-Show(); Win32::GUI::Dialog(); sub Win_Activate { Win32::GUI::SetFocus($last_focus) if $last_focus; } sub Edit_GotFocus { my $self = shift; $last_focus = $self-GetFocus(); } sub Button_GotFocus { my $self = shift; Win32::GUI::MessageBox($self, button, but); $last_focus = $self-GetFocus(); } Teddy
[perl-win32-gui-users] POD for 1.04
Hi, I have installed Win32::GUI 1.04 using ppm, but the POD docs were not installed. How can I get the documentation for this version? Should I copy it from the source, or there is a more elegant way? Thanks. Teddy
[perl-win32-gui-users] 1.04
Congratulations for Win32::GUI 1.04 to all who have developed it. I have just seen some improvements and they are great! (Until now I have tested only some samples of AxWindow) Teddy
[perl-win32-gui-users] default button on a form
Hi, I have a default button on a form that I want to be pressed when I hit enter on a few controls like textfields and list boxes, but I don't want to be press when hitting enter on a few other list boxes. In the case of those controls, I want to be able to process their onClick event and not press the default button. I have tried not using a default button but using the onKeyUp event on those controls, then searched if the key 13 was released on them and execute the code that I want to be executed at onClick() event. The code works, but with big issues. For example, if a dialog window appears and I hit enter to close it, and the focus goes to one of those controls, I need to release the enter key there and the code is executed again, or if the focus is on one of those controls and I choose a menu item using enter... So that's not a good approach. Is there a better one? Thank you. Teddy
[perl-win32-gui-users] onKeyUp
Hi, I have tried the test script below, and if I press enter on the text field, the onKeyUp event is not handled at all. If I press other keys, that event appears, but not if I press enter. onKeyUp is handled, but I also need the onKeyUp event. Is it a bug, or am I doing something wrong? Thank you. Teddy use strict; use Win32::GUI; my $Win = new Win32::GUI::Window( -name = Win, -title = Maestro EngRom, -size = [700, 600], -dialogui = 1, ); my $WordField = $Win-AddTextfield( -name = WordField, -width = 100, -height = 20, -tabstop = 1, -onKeyDown = \WordField_KeyDown, ); $Win-Show(); Win32::GUI::Dialog(); sub WordField_KeyDown { my ($self, $id, $key) = @_; Win32::GUI::MessageBox($Win, $key, test); }
Re: [perl-win32-gui-users] printing UTF-8
Hi Dan, I had a thought that a rich edit control might be able to display UTF-8 strings, but I haven't tried it until now. Please send me an example of doing this, because it will help me very much. Thank you. Mersi. Teddy - Original Message - From: Dan Dascalescu [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Friday, October 13, 2006 2:47 AM Subject: Re: [perl-win32-gui-users] printing UTF-8 I built an application that displays UTF-8 successfully using Win32::GUI::RichEdit. As I'm not sure this is what you really want, please let me know if you'd like more information. Dan Dascalescu On 10/8/06, Octavian Rasnita [EMAIL PROTECTED] wrote: Hi, Is it possible to print UTF-8 strings in a Win32::GUI application? For example, printing a Win32::GUI::MessageBox window... Thank you. Teddy
Re: [perl-win32-gui-users] [win32-gui] Win32::GUI::AxWindow and UTF-8
Hi Rob, Win32::GUI has almost no support for UTF-8/UCS-2. It's near the top of my list for a new Win32::GUI version, but will probably never happen on top of the current codebase. We'll have to see if I ever get time to look at a complete re-factoring or not. If you search the list archives (sorry, I don't remember if it was on the user list of the hackers list) you should find some code that I posted showing how it was possible to display unicode characters in a RichEdit control. I haven't seen it, so it might have been on the hackers list. Where can I find subscription information and the archive of that list? I have found a workaround to display UTF-8 strings using Win32::GUI and Win32::GUI::AxWindow but I think it could be improved. The program saves the string in a temporary .txt file which is UTF-8 encoded, then when constructing the AxWindow object, I have used: -control = path_to_file, so the UTF-8 string is displayed correctly in the html format. Is it possible to display the UTF-8 string directly without saving it into a temp file? I have tried different ways of encoding to UTF-8 -control = MSHTML:... but the string doesn't display correctly, so I'm obviously doing something wrong. Thank you. Teddy
[perl-win32-gui-users] Win32::GUI::AxWindow and UTF-8
Hi, If Win32::GUI doesn't support UTF-8 but some controls in Windows supports it (like the multiline textfield in Notepad), can I include those controls in a Win32::GUI application using Win32::GUI::AxWindow module? If yes, how can I find the class names of those controls? In fact I am interested in the multiline textfield of Notepad. Thank you very much. Teddy
[perl-win32-gui-users] printing UTF-8
Hi, Is it possible to print UTF-8 strings in a Win32::GUI application? For example, printing a Win32::GUI::MessageBox window... Thank you. Teddy
[perl-win32-gui-users] Win32::GUI dialog doesn't close
Hi, I have create a program using Win32::GUI and perlapp. I have made the main window a dialog window for making it usable with a keyboard, so if I press the escape key, the program closes. Well, this is pretty ok, but the problem is that perl interpreter doesn't always close, and after closing the program that way, I can see the program running in the Task Manager (in the processes list). Is there a way of avoiding this? The program doesn't always stay resident. Very many times, it closes when pressing the escape button, but sometimes it doesn't. Thank you. Teddy
Re: [perl-win32-gui-users] [win32-gui] Win32::GUI dialog doesn't close
From: Robert May [EMAIL PROTECTED] Do you have a multi-line edit control (Win32::GUI::Textfield) in the dialog? Does this symptom only occur when the textfield has focus? If so it's a known bug - I can generate a work around, let me know. Hmm, strange! I was almost sure that this issue happends randomly, no matter if that multiline control has the focus or not. (The program do has a multiline readonly textfield) But I have tested for a few times, and I see that this error appears only when that control has the focus. Please tell me how to solve it. Thank you very much. Teddy
Re: [perl-win32-gui-users] Win32::GUI and RPC Server??
From: Robert May [EMAIL PROTECTED] I've not used it in anger for a project, but equally I've not had any problems or had any problems reported. The 'experimental' label, is mainly because I know there are some additional things I want to complete, and the fact that there's no real documentation. Regards, Rob. Do you have any plans for improving the documentation of this module? It would be very helpful. Perl is great for using it in combination with a web server, and if someone uses Win32::GUI, then that person probably wants to get/put data from/to a server. Well, in that case it would be very useful to use threads and very many times sharing the variables is also a requirement. Without this module it is pretty hard to do this... Thanks. Teddy
Re: [perl-win32-gui-users] Win32::GUI::Scintilla
From: Jeremy White [EMAIL PROTECTED] Is there a Win32::GUI::Scintilla that can work with Perl 5.8.8? Yes, version 1.8 - you'll have to build it from the sources (via VC or mingw) - if you can wait a little longer a new build should be round the corner. Ok, thanks. I can try to compile it even though I am not a C programmer. Can you please tell me where can I download the source code from? Teddy
Re: [perl-win32-gui-users] Win32::GUI::Scintilla V1.08
Hi, Will the new version of Win32::GUI::Scintilla be based on the latest version of Scintilla? I have seen that now Scintilla is very accessible for screen readers, but the older version which is used on the actual version of Win32::GUI::Scintilla is not accessible at all. Thank you. Teddy From: Sean Healy [EMAIL PROTECTED] On Mon, 05 Dec 2005 05:30:25 -0700, Jeremy White [EMAIL PROTECTED] wrote: I've just committed some changes to Scintilla, the main ones being that events now fire for perl 5.8.x. This fix also solves a few issues where Scintilla was crashing, again with perl 5.8.x. This module should work with any version of Win32::GUI from V1.00 upwards. snip If there are any issues, please let me know. I'll try and get a PPM on the sourceforge site later in the week. I notice that the most recent PPM (and source for that matter) on the Sourceforge download page is still the one from November. Ordinarily, I'd download the CVS source and build it myself, but I don't own my own copy of Visual Studio. Although the license at work does allow me to install it on my computer at home, I recently reinstalled Windows and I have to wait until I can borrow the CDs from work before I'll be able to build Perl or any extensions. By the way, I want to thank everyone who's been improving this module. I was impressed enough when I first found it a few years ago (version 0.5 something, I think it was), but it just keeps getting better and better. --- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnkkid=107521bid=248729dat=121642 ___ 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] sharing objects
Hi, I am trying to create a program using Win32::GUI that uses more threads. A few threads should connect to a server and download data permanently, and other threads should updated some list views with that data For doing this I need to use threads::shared and share some variables like $Win and other variables like $ListView, but if I try to share them I get errors like: Invalid value for shared scalar at program.pl line 19. Are there any examples of using threads with objects, references that could help me learn how to use threads with Win32::GUI? Thank you. Teddy
[perl-win32-gui-users] CoolBar
Hi, I have downloaded and tried the experimental Win32::GUI::Coolbar module and I have tested the included demo program, but it doesn't work. It gives this error: Can't find 'BTNS_SHOWTEXT' in package 'Win32::GUI::Coolmenu' used at Coolbar.pm line 178. at D:/usr/site/lib/Win32/GUI.pm line 450. Teddy
Re: [perl-win32-gui-users] CoolBar
From: Jeremy White [EMAIL PROTECTED] I have downloaded and tried the experimental Win32::GUI::Coolbar module and I have tested the included demo program, but it doesn't work. It gives this error: Can't find 'BTNS_SHOWTEXT' in package 'Win32::GUI::Coolmenu' used at Coolbar.pm line 178. at D:/usr/site/lib/Win32/GUI.pm line 450. What version of Perl and Win32-GUI are you using? This is perl, v5.8.7 built for MSWin32-x86-multi-thread (with 7 registered patches, see perl -V for more detail) D:\diverse\perl modules\win32\coolbar_0_01perl -MWin32::GUI 9 -e1 Win32::GUI version 9 required--this is only version 1.03. BEGIN failed--compilation aborted. I have also tried with Active Perl 5.8.8 with the same results. Thanks. Teddy
[perl-win32-gui-users] threads error
Hi, I have tried the following start of program: use strict; use threads; use Win32::GUI; use Win32::Internet; use Compress::Zlib; my $thread = threads-new(\download); ###$thread-join(); $thread-detach(); my $exit; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; alarm(0); my $Win = Win32::GUI::Window-new( The program runs fine, the sub download seems to also run with no issues in a separate thread, but when closing the program, it gives that error that a thread was closed while 2 threads were running... If I use $thread-join() instead of $thread-detach(), this error doesn't appear, but the program waits for that thread, and doesn't create the main window at all. How can I do to let that thread running in the same time with the main program, but not give error on program close? Thank you. Teddy Teddy
Re: [perl-win32-gui-users] CoolBar
From: Jeremy White [EMAIL PROTECTED] Odd - works for me - see attached image - what OS you using? I'm using 5.8.7 and Win32::GUI 1.03 (albeit built from CVS - but I can't see that being the difference) Cheers, I use Windows 2000. Here is the version of Win32::GUI::Coolbar: Win32::GUI::Coolbar version 999 required--this is only version 0.01. BEGIN failed--compilation aborted. Teddy
Re: [perl-win32-gui-users] threads error
Ok, I have tried using threads::shared, but with no effect. I am not able to close it. Here is the program: use strict; use threads; use threads::shared; use Win32::GUI; my $exit : shared; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; my $thread = threads-new(\download); my $Win = Win32::GUI::Window-new( -name = Win, -title = test, -size = [400, 400], -dialogui = 1, ); $Win-Show(); Win32::GUI::Dialog(); $thread-join(); sub Win_Terminate {-1} sub download { while(!$exit) { Win32::GUI::MessageBox($Win, test, t, MB_OK); sleep 10; } } Teddy - Original Message - From: Plum, Jason [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, March 22, 2006 5:33 PM Subject: RE: [perl-win32-gui-users] threads error Ah... Your problem is that you are using a indicator (aka semaphore) to stop the child thread. This semaphore is NOT a shared variable as it stands, thus causeing the problem. Solution: Use threads::shared; My $exit : shared; Try that :) Jason P. -ps, sry listfellows, I forgot to stick you in the original replies :x- -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 10:28 AM To: Plum, Jason Subject: Re: [perl-win32-gui-users] threads error Hi, If I do that, it gives an error telling that a detached thread cannot be joined. If I don't use detach() at all, I cannot close the program and I need to use the task manager for doing this. Here is the test program I have made: use strict; use threads; use Win32::GUI; my $exit; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; my $thread = threads-new(\download); #$thread-detach(); my $Win = Win32::GUI::Window-new( -name = Win, -title = test, -size = [400, 400], -dialogui = 1, ); $Win-Show(); Win32::GUI::Dialog(); $thread-join(); sub Win_Terminate {-1} sub download { while(!$exit) { Win32::GUI::MessageBox($Win, test, t, MB_OK); sleep 10; } } Thank you Teddy - Original Message - From: Plum, Jason [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 4:38 PM Subject: RE: [perl-win32-gui-users] threads error Call the thread-join() after Win32::GUI::Dialog has ended. This shoud solve all of your problems. Jason P -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Octavian Rasnita Sent: Wednesday, March 22, 2006 5:30 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] threads error Hi, I have tried the following start of program: use strict; use threads; use Win32::GUI; use Win32::Internet; use Compress::Zlib; my $thread = threads-new(\download); ###$thread-join(); $thread-detach(); my $exit; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; alarm(0); my $Win = Win32::GUI::Window-new( The program runs fine, the sub download seems to also run with no issues in a separate thread, but when closing the program, it gives that error that a thread was closed while 2 threads were running... If I use $thread-join() instead of $thread-detach(), this error doesn't appear, but the program waits for that thread, and doesn't create the main window at all. How can I do to let that thread running in the same time with the main program, but not give error on program close? Thank you. Teddy Teddy --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ 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/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.2.6/287 - Release Date: 3/21/2006 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=kkid0944bid$1720dat1642 ___ 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/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.2.6/287 - Release Date: 3/21/2006
Re: [perl-win32-gui-users] threads error
Hmm, strange, I already tried that. Now I've done it again and I see that it works. However, If I put a sleep(10) in the subroutine which runs in a separate thread, the program is not closed for 10 seconds. Is there a way to force closing the program immediately even if it should wait for a certain operation (like sleep()? Thanks. Teddy - Original Message - From: Plum, Jason [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, March 22, 2006 6:51 PM Subject: RE: [perl-win32-gui-users] threads error Increment the $exit var inside of Win_Terminate: {$exit++; -1} -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 11:32 AM To: Plum, Jason; perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] threads error Ok, I have tried using threads::shared, but with no effect. I am not able to close it. Here is the program: use strict; use threads; use threads::shared; use Win32::GUI; my $exit : shared; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; my $thread = threads-new(\download); my $Win = Win32::GUI::Window-new( -name = Win, -title = test, -size = [400, 400], -dialogui = 1, ); $Win-Show(); Win32::GUI::Dialog(); $thread-join(); sub Win_Terminate {-1} sub download { while(!$exit) { Win32::GUI::MessageBox($Win, test, t, MB_OK); sleep 10; } } Teddy - Original Message - From: Plum, Jason [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, March 22, 2006 5:33 PM Subject: RE: [perl-win32-gui-users] threads error Ah... Your problem is that you are using a indicator (aka semaphore) to stop the child thread. This semaphore is NOT a shared variable as it stands, thus causeing the problem. Solution: Use threads::shared; My $exit : shared; Try that :) Jason P. -ps, sry listfellows, I forgot to stick you in the original replies :x- -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 10:28 AM To: Plum, Jason Subject: Re: [perl-win32-gui-users] threads error Hi, If I do that, it gives an error telling that a detached thread cannot be joined. If I don't use detach() at all, I cannot close the program and I need to use the task manager for doing this. Here is the test program I have made: use strict; use threads; use Win32::GUI; my $exit; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; my $thread = threads-new(\download); #$thread-detach(); my $Win = Win32::GUI::Window-new( -name = Win, -title = test, -size = [400, 400], -dialogui = 1, ); $Win-Show(); Win32::GUI::Dialog(); $thread-join(); sub Win_Terminate {-1} sub download { while(!$exit) { Win32::GUI::MessageBox($Win, test, t, MB_OK); sleep 10; } } Thank you Teddy - Original Message - From: Plum, Jason [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 4:38 PM Subject: RE: [perl-win32-gui-users] threads error Call the thread-join() after Win32::GUI::Dialog has ended. This shoud solve all of your problems. Jason P -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Octavian Rasnita Sent: Wednesday, March 22, 2006 5:30 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] threads error Hi, I have tried the following start of program: use strict; use threads; use Win32::GUI; use Win32::Internet; use Compress::Zlib; my $thread = threads-new(\download); ###$thread-join(); $thread-detach(); my $exit; $SIG{INT} = $SIG{BREAK} = $SIG{HUP} = sub {$exit++}; alarm(0); my $Win = Win32::GUI::Window-new( The program runs fine, the sub download seems to also run with no issues in a separate thread, but when closing the program, it gives that error that a thread was closed while 2 threads were running... If I use $thread-join() instead of $thread-detach(), this error doesn't appear, but the program waits for that thread, and doesn't create the main window at all. How can I do to let that thread running in the same time with the main program, but not give error on program close? Thank you. Teddy Teddy --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ 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/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.2.6/287 - Release Date: 3/21/2006
[perl-win32-gui-users] timers
Hi, Does anyone know why the system hangs with no reaction if I use sleep 10; in a Win_OnTimer subroutine? It sleeps for 10 seconds, and I cannot even close the program in those 10 seconds. Then the program works fine again until the timer runs again that function. I want to use sleep() just to test how the program works if it does something for a few seconds, like downloading something from a web site. If I want to create a program that downloads periodically something and save into afile, then periodically gets the data from that file and displays it, is it absolutely necessary to use fork() or threads? (and if yes, which of them do you recommend?) Thank you. Teddy
Re: [perl-win32-gui-users] Change()
From: Glenn Linderman [EMAIL PROTECTED] didn't help either. I'm out of my depth here; given that this stuff doesn't work in the case you are trying (which I had never tried), but does work in other cases (like I use all over the place, and as above, for Test, I don't have any more ideas. Ok, thank you. I think it is a bug in Win32::GUI because the submenus can be changed that way, but not the top menus. I will create 2 separate menus and I will replace the entire menu using $Win-Change(-menu = $second_menu) because it works that way. Not very nice, but it works. Teddy
Re: [perl-win32-gui-users] global destruction
From: Robert May [EMAIL PROTECTED] Octavian Rasnita wrote: I have tried to set an event handler -onLostFocus, but if the control loses the focus when the application closes (alt+F4), it gives the following error: Can't call method Text on an undefined value at E:\lucru\agenda\agenda.pl line 68 during global destruction. How can I detect if the control loses the focus because I have pressed the tab key, or that if the whole application was closed? I you can post a short and complete example that I can run and see what you're doing then I'll have a look to see if you're doing something wrong, or whether we have a bug. You have not posted enough information for me to see what you're trying to do. Ok, here is a simple test program. use strict; use Win32::GUI; my $Win = new Win32::GUI::Window( -title = 'Test', -pos = [100, 100], -size = [400, 400], -dialogui = 1, ); $Win-AddButton( -name = 'But', -text = Ok, -pos = [10, 10], -size = [100, 20], -tabstop = 1, ); my $Field = $Win-AddTextfield( -name = 'Field', -pos = [10, 50], -size = [100, 20], -tabstop = 1, ); $Win-Show(); Win32::GUI::Dialog(); sub Win_Terminate {-1} sub Field_LostFocus { $Win-But-Text(New text); } __END__ The program works fine, and if I press the tab key when the focus is on the textfield, the focus moves to the button and the text of the button is changed. If I close the application in that moment, it closes without errors. But if I press agan the tab key and the focus moves again to the text field, and only after this I close the application, it gives an error, because the onLostFocus event is fired when the application closes. I have seen that if I give a name to the textfield using: my $Field = $Win-Textfield(... and then I use $Field-Text(...); instead of $Win-But-Text(New text); the program doesn't give an error. But why does it give an error when using $Win-Field-Text(...)? Thank you.
[perl-win32-gui-users] global destruction
Hi, I have tried to set an event handler -onLostFocus, but if the control loses the focus when the application closes (alt+F4), it gives the following error: Can't call method Text on an undefined value at E:\lucru\agenda\agenda.pl line 68 during global destruction. How can I detect if the control loses the focus because I have pressed the tab key, or that if the whole application was closed? Thank you. Teddy
[perl-win32-gui-users] dynamic menus
Hi, I want to create a part of a menu based on some settings from a configuration file, so I want it to be created on runtime. I want to have a menu item something like: ... Languages = Languages, English = {-name = english, -checked = 1, -onClick = \change_interface('en')}, French = {-name = French, -onClick = \change_interface('fr')}, ... How can I insert this piece of code in the menus? I don't know how many languages are defined in the configuration file, so I can't write this code staticly in the source, so I should define somehow only the Languages menu item, then insert its submenus at runtime. Also, how can I check/uncheck the menus while the program runs? Thank you. Teddy
[perl-win32-gui-users] Change()
Hi, Does anyone have an example of using the Change() method (or another way) for modifying the text that appears in the menus? I want to let the user change the language of the interface without needing to restart the application, so I need rewriting the menus. Perhaps it is possible to create more different sets of menus, one for each language, than to change the -menu parameter of $Window to use another menu, but I would like to know if it is possible to create a single menu, than to modify it to use another language. Thanks. Teddy
Re: [perl-win32-gui-users] A slightly OT question, how to create an icon on the fly
From: Plum, Jason [EMAIL PROTECTED] Remember, you're using perl. Technically speaking *anything* can be done :p BTW, if anything can be done, I am interested if there is a way of creating an mp3 player in perl that doesn't need another program for communicating with the sound card. How it is possible? Thanks.
Re: [perl-win32-gui-users] Using HTML help within A Win32-GUI app
Are you asking? Of course it would be great to let us know. Thank you very very much! Teddy - Original Message - From: Jeremy White [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Friday, February 17, 2006 6:25 PM Subject: [perl-win32-gui-users] Using HTML help within A Win32-GUI app Hi, Would it be of use for anyone to know how to integrate an Win32-GUI app with a MS HTML help system? If so, I could create a set of steps on how this is done. Cheers, jez. --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ 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/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.10/263 - Release Date: 2/16/2006
Re: [win32gui] [perl-win32-gui-users] -dialogui, textfields and enter
Oh great! Thank you very much. I have tried to find more about the -style options and its new variants on Win32::GUI docs, but I couldn't. It seems that I need to search in MSDN. Teddy - Original Message - From: Robert May [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, January 04, 2006 2:28 AM Subject: Re: [win32gui] [perl-win32-gui-users] -dialogui, textfields and enter Octavian Rasnita wrote: I need to use -dialogui option for a window in order to make it accessible with the keyboard, but after doing this, I have a problem with multiline Textfield boxes. If I use that option, when pressing enter to put an end-of-line in the multiline textfield, nothing happends. The cursor remains where it was before pressing enter, and no new line is created. -pushstyle = ES_WANTRETURN, If I remove the -dialogui option of the window in which that textfield is located, the textfield works fine. I have discovered that if I use the -dialogui option and I press Control+Enter instead of just enter, the program works as it should (although that I don't know if a correct \r\n end of line is inserted, or something more than that). Is there a way to be able to use -dialogui option and to be able to create new lines in the textfield by pressing just enter? By default if you use -dialogui, then the Enter key is 'reserved' for the default button action (-ok = 1 in the button's constructor). You can change the behaviour for multiline Textfields and RichEdit contols by adding the ES_WANTRETURN style to their constructors. Regards, Rob.
[perl-win32-gui-users] multiline Textfield
Hi, I am trying to create a multiline textfield on a window that has the -dialogui option set but the big problem is that I cannot move the focus out of that window by pressing the tab key. I have tried to use the onKeyDown, onKeyUp, onChar events and GetKeyboardState method to trap the tab and shift+tab key, and when those key are pressed, the focus is passed to the next or prior control from the window as it should. The problem is that if another key is pressed in the multiline textfield (the home key, page up, down, end, the arrow keys, the letters...) nothing happends. When an event like onKeyDown traps a keystroke, if that key pressed is a letter or an arrow key, the function that handles the event doesn't do anything with the key, but I want that letter to be printed on the textfield. I am able to do a $Win-Textfield-ReplaceSel(chr($key)) but it works only if the key is a letter, but it doesn't work if it is a arrow, or home, end, etc. Is there a solution for doing what I want? Thank you. Teddy
[perl-win32-gui-users] detecting a keystroke
Hi, I have seen that the multiline Textfield doesn't lose the focus when the tab or shift+tab key are pressed, and I want to trap these keys in order to pass the focus to other controls. I have tried using: $Win-AddTextfield( #... -onChar = \tab, ); sub tab { my ($self, $k1, $k2) = @_; if ($k2 == 9) { #Do some things } } Well, I don't know what $k1 represents, but both $k1 and $k2 are the same, doesn't matter if I press the tab key only or shift+tab, and I don't know how to detect when tab was pressed and when shift+tab. Is it possible? Thank you. Teddy
[perl-win32-gui-users] oem vs nem
Hi, I have started using nem instead of oem just because it is new and I think that it might be better and might have some advantages, but is there a practical reason for using nem instead of oem? Sometime I feel that OEM is better because requires less coding... Thank you. Teddy
[perl-win32-gui-users] nem events for menus
Hi, Is it possible to define a -onClick event for a menu instead of creating an Menu_Click function? Thank you. Teddy
Re: [perl-win32-gui-users] a question about -style
Hi, I found about -pushstyle and -popstyle and other options, but I couldn't find what they are doing and which are the styles that can be added. For example, I have seen lines like the one below, and I don't know what each style is doing and which are all the options that can be applied. -style = WS_CHILD | WS_VISIBLE | 1, So I can use -pushstyle instead of -style, but I don't know what are doing those options. Can you tell me where to look in the POD documentation of Win32::GUI to find more about them? Thank you. Teddy - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: perl-win32-gui-users@lists.sourceforge.net Sent: Tuesday, December 27, 2005 01:52 AM Subject: Re: [perl-win32-gui-users] a question about -style On approximately 12/26/2005 2:38 PM, came the following characters from the keyboard of Octavian Rasnita: Hi, Can you tell me if (and where) I can find more about the -style property in the Win32::GUI documentation? Look instead for -popstyle and -pushstyle, they are the replacements for -style, which is deprecated. -- Glenn -- http://nevcal.com/ === Having identified a vast realm of ignorance, Wolfram is saying that much of this realm lies forever outside the light cone of human knowledge. -- Michael Swaine, Dr Dobbs Journal, Sept 2002 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ 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: [win32gui] Re: [perl-win32-gui-users] Newbie Qs about Layout and Coordinates
From: Robert May [EMAIL PROTECTED] $Window-{dialogui} = 1; Please try to avoid accessing the object hash directly, it's bad practice. The ability to do this may well change in the future. Either set the value when you create the window with the '-dialogui' option or use the DialogUI() method. Regards. Rob. Ok, thanks for that. I first heard about dialogui option on a mailing list, then I couldn't find any notice in the documentation of Win32::GUI telling which is the best method of using it. Now it is the first time I heard about the method DialogUI(). Was the documentation for Win32::GUI updated? A few months ago I found it very small and relying on MSDN's site which is not same as easy to use as the POD documentation (for a screen reader user). Thanks. Teddy
Re: [perl-win32-gui-users] Newbie Qs about Layout and Coordinates
As a special note: be sure to set the tab order when creating the contents of your dialog considering its potential uses. I am sure others will be able to help you further, so I will put myself back to work (wish I spent more time coding @ work) Also, it would be helpful for the screen readers users if you would use: $Window-{dialogui} = 1; and in the controls that can get the focus when pressing the tab key: -tabstop = 1, Teddy
Re: [perl-win32-gui-users] Control for Displaying the contents of a text file?
You need to read the content of that file with: my $content; { local $/; open(FILE, $file_path); $content = FILE; close FILE; } Then insert the $content in the Win32::GUI control you want. Teddy - Original Message - From: Mark Sutfin [EMAIL PROTECTED] To: perl-win32-gui-users@lists.sourceforge.net Sent: Wednesday, August 03, 2005 23:02 PM Subject: [perl-win32-gui-users] Control for Displaying the contents of a text file? Hello, Newbie has just started experimenting with Win32::GUI. Great stuff. I see that GetOpenFileName() returns the file I selected from the dialog box. Which control(s) might easily display the contents of this text file? I was guessing textfield...? But did not see a method to assign the content to the control... TIA, Mark