Re: Tool tips & win32lib
- Posted by euman at bellsouth.net Mar 28, 2002
- 521 views
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