Hi, Nice to see you here after our exchange in comp.lang.perl.misc.
Veli-Pekka Tätilä wrote:
By the way, my Win32::GUI version installed with PPM appears to be 1.02 (looking inside the PM file).
1.03 is available for download from SourceForge and is now in ActiveState repository for perl 5.8
But I'm still worried about the spacing. By looking at dialogs magnified, I've concluded that there's more than just a bit spacing between vertically layed out check boxes. What do the Win32 interface guidelines say about this?
'Official' Microsoft recommendations: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
Lastly, I've been pondering coordinates and spacing too. It would appear to me the Win32::GUI Windows use client coordinates but do the dialogs use dialog units, then? The Win32 API has a function GetDialogBaseUnits but I have not seen it imported in Win32::GUI at all.
Win32::GUI currently uses pixel positioning exclusively. Top-level windows in screen-coordinates and child windows in client coordinates. No use of dialog units currently, and you are correct that GetDialogBaseUnits is not currently implemented.
The following perl function can be used to do the conversion: ## Dialog Base Units to pixels # - object is a Win32::GUI::Window # - direction is one of: # Horizontal: W(idth), X, L(eft), R(ight) # Vertical : H(eight), Y, T(op), B(ottom) # - dbu is the dialog units to convert # Returns btu converted to pixels # Returns undef when in error sub convDBU { my ($object, ,$direction, $dbu) = @_; my %font_metrics = Win32::GUI::Font::GetMetrics($object->GetFont()); if (index("WXLR",$direction) != -1) { my $dbuX = $font_metrics{-avgwidth}; $dbu = ($dbuX * $dbu) / 4; } elsif (index("HYTP",$direction) != -1) { my $dbuY = $font_metrics{-height}; $dbu = ($dbuY * $dbu) / 8; } else { return undef; } # use int, as we need something that is always too small return int($dbu); } Regards, Rob.