Re: Win32Lib and Unicode
- Posted by Larry Miller <larrymiller at sa?ktel?net> Mar 08, 2008
- 622 views
CChris wrote: > > Pete Stoner wrote: > > > > Hi Guys, > > I've got a nice routine to convert UTF-8 into "Windows" unicode (adapted > > from > > routines by Tommy Carlier) along with a modified wPuts to write the unicode > > to my window. That bit is working fine but now to complete the jigsaw I need > > a unicode version of setHint and at the moment I can't see an easy way to do > > it, can anyone help? > > > > Regards PeteS > > Simply use setHint[Ex]() and pass a routine_id as spelled out in the docs. The > routine will return an Euphoria sequence representing your 16-bit encoded > text, > like {'H',0,'e',0,'l',0,'l',0,'o',0,0}. > Note the extra zero at the end, because w32store() will add only one and > 16-bit > strings need 2 of them. So the char #ABCD would be coded as #CD,#AB. > Also, make sure the tooltip font supports the characters you are going to > display. > You may need to call setHintFont() for this purpose. > I didn't test this, but I'd be confident, if only because there are no special > Unicode tooltip messages in the API. > > HTH > CChris I'm sorry to say this but I don't think that will work. The setHint() procedure does not work in isolation but requires a ToolTip control. As with any windows control that deals with text strings, the ToolTip control comes in both ANSI and INICODE versions. The ToolTip control provided by Win32Lib is the ANSI version. Some controls can be put in unicode mode after creation but the ToolTip control is not one of them. You must create your own unicode version of the ToolTip control. The Win32Lib create() function is of no help here as it only creates ANSI controls. You would have to define and call CreateWindowW() to do this, passing only unicode strings. Next you would have to write a unicode version of SetHint() which will communicate with the new tooltip control. Some controls have unicode specific messages, most do not. A unicode ToolTip control requires that you send messages to it with SendMessageW(). In this case you would create a TOOLTIP structure which contains the desired text ( in Unicode) and send it to the ToolTip control using SendMessageW(). I have worked quite a bit with other Unicode controls but never had the need to do this with the ToolTip control. Larry Miller