Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to highlight selected text in rich edit
Message
From
23/10/2003 10:52:15
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00841487
Message ID:
00841572
Views:
20
>You can use SelBold and SelColor properties of the control
lnPos = Thisform.RTF.Object.Find(...)
>IF lnPos >= 0
>  Thisform.RTF.Object.SelBold = .T.
>  Thisform.RTF.Object.SelColor = RGB()
>ENDIF
>
>>Hi, Folks!
>>
>>I've tried unsuccessfully to implement the following:
>>
>>There's a richedit with a loaded file. Then, I've created an Edit as a Search. The user has asked me that any word that coincides with the typed text be highlighted and in bold form. In this case, he wants all the matches. I've just gotten the first match and, when changing the color, the whole richedit has also changed, not only the selection.
>>
>>Does anybody have an idea how I can solve this?
>>
In addition:

He is trying to highlight for every occurrence of some text.. Starting by sergey's answer.. Here we go:

Works perfectly here..
Declare INTEGER LockWindowUpdate IN Win32API INTEGER hWnd
lnpos                               = 1
lnoccurs                            = 0
With Thisform.RTF
    LockWindowUpdate(.hWnd)
    Do while lnpos > 0
        lnpos                       = .Object.Find(allt(ThisForm.Text1.value), lnpos)
        If lnpos >= 0
           .Object.SelBold          = .T.
           .object.selunderline     = .T.
           .Object.SelColor         = RGB(255,0,0)
           .object.selfontsize      = .object.selfontsize + 3
            lnpos                   = .Object.selstart + 1
            lnpos                   = iif(lnpos=1, 0, lnpos)
            lnoccurs                = lnoccurs + 1
        Endif
    Enddo
    if  lnoccurs > 0
        lnpos                       = .Object.Find(allt(ThisForm.Text1.value), 1)
        wait window allt(str(lnoccurs,10,0))+"  occurrence(s) founded " nowait
    else
        wait window "Not found any "+allt(ThisForm.Text1.value)+" !" nowait
    endif
endwith
LockWindowUpdate(0)
HTH

Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform