Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls

2010-09-22 Thread Joshua New
Kevin,

Excellent work!  Thank you very much for your efforts on this.  I'm going
to test it out this week.  If everyone is interested, I'll let everyone
know how it goes.

Reini,

Also, excellent work.  The unfortunate thing is that your patch is for
1.04.  Most people are using 1.06 these days.  I found a patch for 1.05
but again that's still not 1.06.

Do you have a patch for 1.06?


Regards,
Joshua New

On Sat, August 28, 2010 7:17 am, Reini Urban wrote:

 2010/8/28 Kevin Marshall kejoh...@hotmail.com:

 After much experimentation, I have finally succeeded in creating an
 owner-drawn control in Win32::GUI. I decided to create this post
 detailing how to create an owner-drawn control in case someone else has
  the need to use one.

 I posted a fullfletched patch for the simplier CustomDraw,
 which I'm using for years to do the same. I primarily use it to color list
 items.

 Added
 http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/m
 sg00624.html and removed, promised for 1.04, but it didn't happen.
 http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/
 msg00628.html

 --
 Reini Urban
 http://phpwiki.org/           http://murbreak.at/


 -
 -
 Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
 Be part of this innovative community and reach millions of netbook users
 worldwide. Take advantage of special opportunities to increase revenue and
  speed time-to-market. Join now, and jumpstart your future.
 http://p.sf.net/sfu/intel-atom-d2d
 ___
 Perl-Win32-GUI-Users mailing list
 Perl-Win32-GUI-Users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
 http://perl-win32-gui.sourceforge.net/



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

Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls

2010-08-29 Thread Kevin Marshall
Reini,

The thing is that Custom Draw is supported by a different set of 
controls to Owner Draw, so I suppose a combination of both could be used.

Kevin.
 2010/8/28 Kevin Marshallkejoh...@hotmail.com:

 After much experimentation, I have finally succeeded in creating an
 owner-drawn control in Win32::GUI. I decided to create this post
 detailing how to create an owner-drawn control in case someone else has
 the need to use one.
  
 I posted a fullfletched patch for the simplier CustomDraw,
 which I'm using for years to do the same.
 I primarily use it to color list items.

 Added
 http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00624.html
 and removed, promised for 1.04, but it didn't happen.
 http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00628.html




--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
___
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/


Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls

2010-08-29 Thread Kevin Marshall
Octavian,

According to the Windows docs, the common controls are automatically 
accessible, which are what Win32::GUI uses, whereas custom controls 
require additional setup.

Kevin.
 Hi Kevin,

 I was asking this because all the standard controls which can be created with 
 Win32::GUI are accessible without doing anything special.

 Octavian

 - Original Message -
 From: Kevin Marshallkejoh...@hotmail.com
 To: Octavian Rasnitaorasn...@gmail.com
 Cc:perl-win32-gui-users@lists.sourceforge.net
 Sent: Saturday, August 28, 2010 1:56 PM
 Subject: Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls



 Hi Octavian,

 Thanks for your comments. It's good to know that you find it useful.

 I have been looking into Windows Accessibility to see how it works, and
 it seems that under normal circumstances (i.e. creating GUIs using C++,
 rather than Perl), the custom controls must provide an interface to the
 Accessibility API, which accessibility programs can use to interact with
 the control. Unfortunately, it looks like it is probably beyond the
 scope of the Win32::GUI module.

 Perhaps it is something that could be looked into for a separate module.

 Other people may have thoughts on the topic.

 Thanks again,

 Kevin.

  
 Hi Kevin,

 Congratulations for the program!

 I have tested it with a screen reader and it works. I added the -dialogui 
 =   1 option to the $winMain object to be able to use the keyboard for 
 changing the focus.

 The only problem, which is an important one, is that if I arrow up or down 
 in the list box, the screen reader announces just things like item 1 of 8, 
 item 2 of 8 and so on, without telling the label of the current item as it 
 should.

 Do you (or somebody else) have any idea how to add accessibility features 
 (MSAA) to this custom control in order to be as useful as a standard 
 control?

 Basicly it should also report the labels of the list box items and not just 
 print them.

 Thank you.

 Octavian

 - Original Message -
 From: Kevin Marshallkejoh...@hotmail.com
 To:perl-win32-gui-users@lists.sourceforge.net
 Sent: Saturday, August 28, 2010 8:07 AM
 Subject: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls




 Hi everyone,

 After much experimentation, I have finally succeeded in creating an
 owner-drawn control in Win32::GUI. I decided to create this post
 detailing how to create an owner-drawn control in case someone else has
 the need to use one.

 For those of you who don't know, an owner-drawn control allows the user
 more control over the appearance of the control. This usually involves
 responding to messages sent whenever the control needs to be drawn and
 drawing the control in anyway that you wish.

 In order to get my sample to work you will need to install the PeekPoke
 module from CPAN. This module allows reading and writing of data to and
 from arbitrary memory locations. This is needed to set the height of the
 items of the listbox. More on this below.

 This example was created using ActiveState Perl v5.12.0 running on
 Windows XP.

 For this example, I will demonstrate how to create an owner-drawn
 listbox. The listbox will have items with a larger height, will display
 two lines of text with different formats, and an image.

 All of the files related to this example at the bottom of this post.

 Anyway, on with the example.

 I decided to store the information about each listbox item in an
 external XML file and use XML::Simple to parse it. This makes it rather
 simple to change the information for the listbox items.

 I also created 8 simple 40x40 bitmaps that will be displayed in each
 listbox item.

 Now for a description of the code.

 The first step is to create a window for our listbox and load our XML
 data from the file using XML::Simple::XMLin(). This is all fairly
 simple, so I won't bother explaining.

 Next step is to create a hook for the WM_MEASUREITEM message. This
 message is sent when the listbox is created so the user can specify the
 width and height of the listbox items. The $lParam variable contains the
 address of the structure that is passed to the message, which needs to
 be filled out. Here we use the poke() function to write the desired
 height into the structure, which in our case is 50. 16 is the offset of
 the itemHeight member of the structure which needs to contain the height
 that we want when the message returns.

 Next a hook is created for the WM_DRAWITEM message. This message is sent
 whenever an item in the listbox requires drawing. First step is to
 unpack the structure that is passed to the message. If the itemID
 contains -1, then the listbox is empty, so we simply return from the sub
 if this occurs. Otherwise, it contains the zero-based index of the item
 being drawn. The itemAction member contains the action required for the
 drawing. Here we respond if the entire item needs drawing. To begin with
 we draw the bitmap for the item. First we create a compatible DC

Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls

2010-08-28 Thread Octavian Rasnita
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

2010-08-28 Thread Kevin Marshall
Hi Octavian,

Thanks for your comments. It's good to know that you find it useful.

I have been looking into Windows Accessibility to see how it works, and 
it seems that under normal circumstances (i.e. creating GUIs using C++, 
rather than Perl), the custom controls must provide an interface to the 
Accessibility API, which accessibility programs can use to interact with 
the control. Unfortunately, it looks like it is probably beyond the 
scope of the Win32::GUI module.

Perhaps it is something that could be looked into for a separate module.

Other people may have thoughts on the topic.

Thanks again,

Kevin.

 Hi Kevin,

 Congratulations for the program!

 I have tested it with a screen reader and it works. I added the -dialogui =  
 1 option to the $winMain object to be able to use the keyboard for changing 
 the focus.

 The only problem, which is an important one, is that if I arrow up or down in 
 the list box, the screen reader announces just things like item 1 of 8, item 
 2 of 8 and so on, without telling the label of the current item as it should.

 Do you (or somebody else) have any idea how to add accessibility features 
 (MSAA) to this custom control in order to be as useful as a standard control?

 Basicly it should also report the labels of the list box items and not just 
 print them.

 Thank you.

 Octavian

 - Original Message -
 From: Kevin Marshallkejoh...@hotmail.com
 To:perl-win32-gui-users@lists.sourceforge.net
 Sent: Saturday, August 28, 2010 8:07 AM
 Subject: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls



 Hi everyone,

 After much experimentation, I have finally succeeded in creating an
 owner-drawn control in Win32::GUI. I decided to create this post
 detailing how to create an owner-drawn control in case someone else has
 the need to use one.

 For those of you who don't know, an owner-drawn control allows the user
 more control over the appearance of the control. This usually involves
 responding to messages sent whenever the control needs to be drawn and
 drawing the control in anyway that you wish.

 In order to get my sample to work you will need to install the PeekPoke
 module from CPAN. This module allows reading and writing of data to and
 from arbitrary memory locations. This is needed to set the height of the
 items of the listbox. More on this below.

 This example was created using ActiveState Perl v5.12.0 running on
 Windows XP.

 For this example, I will demonstrate how to create an owner-drawn
 listbox. The listbox will have items with a larger height, will display
 two lines of text with different formats, and an image.

 All of the files related to this example at the bottom of this post.

 Anyway, on with the example.

 I decided to store the information about each listbox item in an
 external XML file and use XML::Simple to parse it. This makes it rather
 simple to change the information for the listbox items.

 I also created 8 simple 40x40 bitmaps that will be displayed in each
 listbox item.

 Now for a description of the code.

 The first step is to create a window for our listbox and load our XML
 data from the file using XML::Simple::XMLin(). This is all fairly
 simple, so I won't bother explaining.

 Next step is to create a hook for the WM_MEASUREITEM message. This
 message is sent when the listbox is created so the user can specify the
 width and height of the listbox items. The $lParam variable contains the
 address of the structure that is passed to the message, which needs to
 be filled out. Here we use the poke() function to write the desired
 height into the structure, which in our case is 50. 16 is the offset of
 the itemHeight member of the structure which needs to contain the height
 that we want when the message returns.

 Next a hook is created for the WM_DRAWITEM message. This message is sent
 whenever an item in the listbox requires drawing. First step is to
 unpack the structure that is passed to the message. If the itemID
 contains -1, then the listbox is empty, so we simply return from the sub
 if this occurs. Otherwise, it contains the zero-based index of the item
 being drawn. The itemAction member contains the action required for the
 drawing. Here we respond if the entire item needs drawing. To begin with
 we draw the bitmap for the item. First we create a compatible DC from
 the DC that is passed to the message, then select the bitmap for the
 current item into it. Then we BitBlt() the contents of the compatible DC
 into the item DC. Next we need to draw the text that will be displayed
 in the item. We create a large font that will be used for the item's
 heading, and select the font into the item DC, remembering the old font.
 Then we draw the text into the item DC using DrawText(). Next we select
 the old font, and draw the other text that will be displayed in the
 item. That completes the drawing for the item, so we return from our sub.

 Next step is to create our listbox. The only difference here from

Re: [perl-win32-gui-users] Win32::GUI Owner Drawn Controls

2010-08-28 Thread Octavian Rasnita
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] Win32::GUI Owner Drawn Controls

2010-08-28 Thread Reini Urban
2010/8/28 Kevin Marshall kejoh...@hotmail.com:
 After much experimentation, I have finally succeeded in creating an
 owner-drawn control in Win32::GUI. I decided to create this post
 detailing how to create an owner-drawn control in case someone else has
 the need to use one.

I posted a fullfletched patch for the simplier CustomDraw,
which I'm using for years to do the same.
I primarily use it to color list items.

Added
http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00624.html
and removed, promised for 1.04, but it didn't happen.
http://www.mail-archive.com/perl-win32-gui-hack...@lists.sourceforge.net/msg00628.html

-- 
Reini Urban
http://phpwiki.org/           http://murbreak.at/

--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
___
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/