Problem with findText (win32lib v0.60.6)
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Oct 29, 2006
- 580 views
I tested the following innocuous program on WinXP home SP1:
include win32lib.ew constant w=create(Window,"Test",0,100,100,100,100,0), r=create(RichEdit,"tadarzadarmi",w,10,10,50,50,0), b=create(PushButton,"push",w,60,10,40,20,0) procedure x(integer id,integer event,sequence p) puts(1,"findText(r,\"adar\",{1,24},0)"&'\n) ?findText(r,"adar",{1,24},0) setIndex(r,{4,10}) ?getSelectedText(r) end procedure setHandler(b,w32HClick,routine_id("x")) WinMain(w,Normal)
Everything displays fine. WC_RICHEDIT reads "RICHED50". Pushing the button produces the following output:
findText(r,"adar",{1,24},0) 0 {97,0,114,0,122,0}
From what getSelectedText() returns, it looks like the text is stored using 16-bit characters somewhere. Does anyone has an idea how to fix this? I bet the trick is changing the way the string is stored in the FINDTEXTEX structure. However, I tried replacing "adar" with {97,0,100,0,97,0,114,0}, and that wasn't any better. Thanks in advance. CChris