Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to highlight selected text in rich edit
Message
De
23/10/2003 10:52:15
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00841487
Message ID:
00841572
Vues:
21
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform