Re: Tool tips & win32lib
- Posted by euman at bellsouth.net Mar 28, 2002
- 502 views
Heres a shot in the dark, I actually wrote this in my emailerso dont expect too much. Completely untested code...beware! integer xGetTextExtentPoint32 xGetTextExtentPoint32 = define_c_proc(gdi32, "GetTextExtentPoint32", {C_LONG, C_POINTER, C_INT, C_POINTER}) constant -- tagSIZE tagSIZE_x = 0, tagSIZE_y = 4 tagSize = allocate(8) sequence str str = " --type your text here " str_len = length(str) pstr = allocate_string(str) hdc = GetDC(hwnd) c_proc(xGetTextExtentPoint32,{hdc, pstr, str_len, tagSize}) ReleaseDC(hwnd, hdc) integer str_width str_width = peek4u(tagSize + 4) -- 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 object junk junk=sendMessage(tooltipControl, TTM_SETMAXTIPWIDTH, 0, tip_width) Euman euman at bellsouth.net