Re: Win32::GUI: Documentation, Layout and accessability



Veli-Pekka Tätilä wrote:
Rob wrote:
Updated (official) docs can be found at:
http://perl-win32-gui.sourceforge.net/docs/

As Syphius points out later in the thread
http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi
is the correct link. I'd got ahead of myself, and was on the TODO list to get /docs to return those pages. Both now work equally well.


Hey, you saved my day by pointing this out. I mean, I don't know hhow I've managed to miss them but for a long long time I thought my WIn32::GUI installation carried out with PPM didn't come with the docs.

There have certainly been some PPM releases in the past that didn't include any html docs (or for that matter most of the POD docs). I hope that I've fixed the build process so that doesn't happen again. It is also my intention to keep the on-line docs up to date with the latest release.


[Talking about Layout managers]

There's the (very) basic Win32::GUI::GridLayout.

Thanks, I'll check the docs. But I'll also be lazy and fire up a quick question asking if it is similar to Java's Grid layout? That is a rectangular grid of equal-sized controls.

It's a rectangular grid. You can set column and row width/height, although IIRC the default is for equal-sized columns and rows (window width/height divided by number of columns/rows). There have been some recent additions that allow for percentage widths/heights to be set, but I'm not am my regular PC right now, and can't check if that got into the latest release, or whether it's due for the next one (V1.03 should be released this weekend, hopefully).


you don't seem to be able to pull in dialogs from resource files

No, you can't do this, although if you want to raise a feature request <snip>

I think I might. That support with event handling would rock. Though I haven't used the mouse too much and need to design with heavy full-screen magnification, which is slow, I still prefer dragging and dropping conponents in a dialog graphically. That is at least if it is a static dialog.

I've never experimented with it, but there's a Win32::GUI graphical design environment (written in Win32::GUI as far as I know) called the GUI Loft: See http://user.bahnhof.se/~johanl/perl/Loft/
Although I don't think it allows for drag/drop.


where to get the exact font metrics that can be used to write
resolution, font and DPI independent code avoid it.

Me too.

Ah. again glad to hear this is a recognized problem. Petzold seems to use functions like
GetSystemMetrics and GetTextMetrics. Maybe these two and the related functions could be used possibly by importing them using Win32::API.
Both these functions are already available
http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi?doc=reference-methods#getsystemmetrics
- the 1.04 release should have the full set of SM_* constants available, for now you'll need to find them from elsewhere.


http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi?doc=font#getmetrics
- I'll not vouch for the correctness of the values though: I've not looked at the Win32::GUI::Font code yet, and recall that there are some outstanding bug reports in this area.


[Moving onto threads]
I can't comment in Win32::OLE.

Well, I've noticed that if you load OLE and try to create two or more threads the whole of Perl will crash. I asked in the Win32 list and it is a known problem with no Perl-only solution.

As I said, I can't comment on Win32::OLE, but for Win32::GUI if you know how many threads you are going to need, and spawn them all early (before creating any Win32::GUI objects, or delay loading Win32::GUI using an eval "use Win32::GUI" statement after spawning the threads), then Win32::GUI can be used in a single thread to run your gui, with other threads doing the work. If you fail to do this, then windows crashes when threads terminate (presumably due to destruction on the Win32::GUI objects that have been copied to the other thread, although investigation of this is another TODO).


I found the following article very enlightening:
http://www.perlmonks.org/?node_id=288022

try to address some of the accessibility issues that you raised with
Win32::GUI - in particular with Win32::GUI::Grid IIRC.

Hmm I don't exactly recall this instance. I think I've mostly been complaining about TK.

My mistake. I do have some of your accessibility mails filed, but they are all about Tk. I have some other reports of dialog navigation (particularly 'tab' navigation) not working as expected with Win32::GUI::GridLayout - although not a core module we've recently taken ownership of the source for this, so I hope to resolve the issue (time permitting).


If you can point me to sample code or real world apps that use the most of WIn32::GUI I could evaluate the keyboard and screen reader usability if you'd like. I've done similar things before, reporting bits and pieces that are inaccessible and giving a list of possible work-arounds.

I can't share most of the application code that I have currently, but hope to be extending the sample code that gets distributed with the module. If you'd be happy for me to contact you then I'd appreciate accessibility feedback. It may be some time before I have anything in a state that's worth you spending time on though. In the meantime, if you do come across any accessibility issues with Win32::GUI, please raise bug reports through either the perl-win32-gui@xxxxxxxxxxxxxxxxxxxxx list or the sourceforge tracker system.


To get back on topic, the OP may find the Win32::Clipboard package
useful

I've used that module succesfully. I'm not sure about the unicode support, either. But I've never really gotten the WaitForChange function to work as expected so I've been manually polling for changes. Maybe I'm missing something in the docs. Here's a simple test app:


use strict; use warnings;
use Win32::Clipboard;
my $clip = Win32::Clipboard->new();
for(;;)
{ # Infinite loop for testing purposes.
   $clip->WaitForChange();
   print 'Got: ', $clip->GetText(), "\n";
} # for

When I run this, it prints the previous clipboard contents on the screen even if the contents have not changed since the beginning of the program. not only that but it seems to freeze in the WaitForChange method the second time even if I copy more text in the clipboard.

It will always print the current contents of the clipboard on start-up. It seems to work OK for me, printing new clipboard contents as I copy test from my editor to the clipboard (AS Perl 5.8.7(build 813), Win32::Clipboard v0.5101, Win98SE)


Regards,
Rob.
.



Relevant Pages

  • Re: repeated notification for the same update
    ... Thats what happens when you use the Clipboard to much. ... (And it's lack of refactoring in Whidbey compared to C#;) ... The correct link was: ...
    (microsoft.public.windowsxp.security_admin)
  • Re: tabledesigner....dbfokcancel
    ... By design, I think. ... You then have information on the clipboard to paste into bug reports. ... In Table Designer fieldname, I clicked Ctrl+C and then Ctrl+V. ...
    (microsoft.public.fox.vfp.dbc)