Re: Tool tips & win32lib

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

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