molto bene!  ok, excuse my italian, but i'm practicing for my trip to florence
in 2 weeks.  thanks this is quite cool :)





"Aldo Calpini" <[EMAIL PROTECTED]> on 03/03/99 11:52:19 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (Sundar Raman/MW/US/3Com)
Subject:  Re: [perl-win32-gui] fontfaces in controls




Sundar Raman wrote:
>i'm trying to change the face of the font in a listbox control in order for
it
>to be a fixed width font so that i can display some data "properly".  i've
tried
>$lstBox->ChooseFont(), which brings up the font choice box, but then what
do i
>trap for the font name and size and stuff?  i see SetFont() and GetFont(),
but
>i'm not sure what they return or set.
>
>i tried $lstList->SetFont($lstList->ChooseFont());
>
>but this seems to always set the font face to system, bold!

you should use a Win32::GUI::Font object for this.
eg.

    $MyFont = new Win32::GUI::Font(
        -name => "Courier New",
        -height => 16,
    );

and then

    $lstList = new Win32::GUI::Listbox(
        -font => $MyFont,
        # etc. etc.
    );

or

    $lstList->SetFont($MyFont);

of course, you can also use:

    $MyFont = new Win32::GUI::Font(Win32::GUI::ChooseFont());

but I've seen that ChooseFont seems to interpet font heights
differently from new Win32::GUI::Font (eg. -height is negative!).
I'll look into it... for now, a workaround is:

    %MyFontData = Win32::GUI::ChooseFont();
    $MyFontData{-height} = -$MyFontData{-height}
        if $MyFontData{-height} < 0;
    $MyFont = new Win32::GUI::Font(%MyFontData);


cheers,
Aldo Calpini
<[EMAIL PROTECTED]>












Reply via email to