Hi Paul,
This worked very nicely, thanks. The only remaining issue is that the tooltip is always visible, and follows the mouse around, updating as it goes. I have got around this by introducing my own code to make the tip appear when the mouse is moved in a certain way, but if you have any comments, I would be glad to hear them.
In case anyone else is watching, here are some bits of code that were used to get the tip updating and having multi-line capability:
Assuming that %th[ms_style] has been used at some point and that we have a help string attached to a graphics region...:
I used %lc after creating the graphics region, so as to get the region's handle:
i = winio@('%`^?gr[white,rgb_colours,flush,full_mouse_input]@&', &
& width,height, &
& MainGraphicsHdl,GRCallback,infostr)
i = winio@('%lc&',GraphicsControlHdl)
Then, whenever I am about to set the tooltip text, according to where on the graphics region I am pointing, I do the following:
HwndP = GetParent(GraphicsControlHdl)
ToolTipHdl = GetWindowLong(HwndP,GWL_USERDATA)
if (ToolTipHdl /= 0) then
call SendMessage(ToolTipHdl,TTM_SETMAXTIPWIDTH,0,500) ! maximum of 500 pixels wide
call SendMessage(ToolTipHdl,TTM_SETTIPBKCOLOR,RGB@(255,255,128),0)! pale yellow background
call SendMessage(ToolTipHdl,TTM_SETDELAYTIME,TTDT_AUTOPOP,10000) ! make tooltip stay visible for 10 secs if mouse stationary
call set_tooltip_text@(GraphicsControlHdl,trim(infostr))
end if
Not all of this is necessary, of course. I set the background and autopop values, too, just for playing-around's sake.
One small point: the constants that are used in the send message routine are not defined in the MSWIN module, so I have set them up as parameters:
integer, parameter :: TTM_SETMAXTIPWIDTH = 1048, TTM_SETTIPBKCOLOR = 1043, TTM_SETTIPTEXTCOLOR = 1044
integer, parameter :: TTM_GETTIPBKCOLOR = 1046
integer, parameter :: TTM_SETDELAYTIME = 1027
integer, parameter :: TTDT_AUTOPOP = 2
Thanks for the help.
Could you provide brief explanation as to why one gets the tooltip handle using GWL_USERDATA?
Mark.