Re: Tool tips & win32lib

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

One extra note involved here...

str_width = peek4u(tagSize) -- returns the X or width in pixels
str_width = peek4u(tagSize + 4) -- returns the Y or height in pixels

in my example I had tested Y last and didnt change this back to X
just incase someone actually tries this.

by the way, I changed font sizes in windows and the size did increase
as it should. Using standard small fonts my X / width for " --type your text
here "
is 138 pixels.

Euman

----- Original Message ----- 
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>

> whoops again, Left an 'A' out and didnt declare pstr 
> 
> This part has been tested and seems to work OK on my Win98 SE
> 
> integer xGetTextExtentPoint32 
> xGetTextExtentPoint32 = define_c_proc(gdi32, "GetTextExtentPoint32A",{C_LONG,
> C_POINTER, C_INT, C_POINTER})
> 
> atom tagSize
> tagSize = allocate(8)
> 
> sequence str
> str = " --type your text here "
> 
> integer str_len
> atom pstr
> str_len = length(str)
> pstr = allocate_string(str)
> 
> atom hdc
> hdc = GetDC(hwnd)
> c_proc(xGetTextExtentPoint32,{hdc, pstr, str_len, tagSize})
> ReleaseDC(hwnd, hdc) 
> 
> integer str_width
> str_width = peek4u(tagSize + 4)
> 
> --  str = " --type your text here " was returned as str_width = 86 on my box
> 
> -- You do the math on this! you could even get real fancy and have euphoria
> -- look for a  '32' whitespace closes to your estimated largest width and
> -- set the width there but this is up to you.
> 
> integer tip_width
> if str_width > 50 and str_width < 100 then
>    tip_width = 100
> end if
> 
> Euman
> euman at bellsouth.net

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

Search



Quick Links

User menu

Not signed in.

Misc Menu