Re: program

new topic     » goto parent     » topic index » view thread      » older message » newer message

Judith wondered:

>Can anyone please find my error in this program?

The problem is with Win32Lib. Apparently, getTextExtent works with windows,
but not with controls. So changing the code to:

   setFont( TextWin, "Courier New", 10, Bold )
   s = getTextExtent( TextWin, "M" )
   setFont( TextWin, "Arial", 10, Bold )

will give you the result (12) that you are after. Note the spelling of
"Arial" needs to be corrected as well.

I suspect that the reason the function doesn't work is because the control
doesn't have a DC (device context) of it's own, so it merely borrows that of
the parent. In this case, it's the main window, and Win32 grabs the font
attributes set in the window. I'll have to do some trickery so that Win32Lib
automagically redirects font requests to a real window. Grumble...

Thanks!

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu