• Welcome to Theos PowerBasic Museum 2017.

Rich Edit Control

Started by Gerald Clark, February 17, 2012, 04:10:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gerald Clark

Greetings All,

I'm frustrated with this control. I just can't get this thing to find text even though I see the text I'm searching for in the text area. It's just not doing what I think the docs are saying it does. Here is the code. Maybe someone with more experience concerning windows can see the obvious error. (It always seems to be obvious when you finally see the mistake.)

Sub Find_RtfText(byval hRichEdit as dword, byval sTxt as string)

    LOCAL ftxt AS FINDTEXTEXA
    local lResult&

'Notes   
'    FINDTEXTEXA Fields
'        CHARRANGE chrg;      -- range to search (The range includes everything if cpMin is 0 and cpMax is -1.)
'        LPSTR lpstrText;     -- null-terminated string to find
'        CHARRANGE chrgText;  -- range in which text is found (If the search operation finds a match, the chrgText member of the FINDTEXTEX
                               'structure returns the range of characters that contain the matching text.   
   
    ftxt.chrg.cpMin = 0
    ftxt.chrg.cpMax = -1   
    ftxt.lpstrText = strPTR(sTxt)
   
    '---The return value specifies the zero-based character index of the character nearest the specified point.
    'lResult = RichEdit_FindTextEx( hRichEdit, %FR_MATCHDIAC, ftxt)  '---This doesn't work 
   
   
    SendMessage(hRichEdit, %EM_FINDTEXTEX, %FR_MATCHDIAC, VARPTR(ftxt)) '---This doesn't work   
   
    msgbox "ftxt.chrgText.cpMin = " + str$(ftxt.chrgText.cpMin) + " ftxt.chrgText.cpMax = " + Str$(ftxt.chrgText.cpMax)

   '---cpMin and cpMax are both -1 even though the search string text is in the control

End Sub


I searched the forums but couldn't find the answer. I tried many different things but it just doesn't work. Any help will be appreciated.

Best Regards...
Contempt prior to investigation = Everlasting Ignorance

Gerald Clark

Hi Jim,

Thanks for the input. Yes, I'm aware of the thread. I started it. I guess same people uses both forums. Guess I only need to post it on one or the other.

Best Regards
Contempt prior to investigation = Everlasting Ignorance