Richedit how to highlight a defined word in memofields ?

Re: Richedit how to highlight a defined word in memofields ?

Postby cnavarro » Sat Mar 24, 2018 11:07 am

ukoenig wrote:Cristóbal,

thank You very much.
That is exactly the solution I've been looking for :shock:
A clean textpreview without any flickering.

Now I can finish the forum-sample-import.

regards
Uwe :D


Ok, Uwe, I am glad that it works correctly and to be able to help you
You can use the DATA nClrKey1 as an array and be able to assign each word a different color, and use in your function THIGHLIGHT as oCode:nClrKey1[ x ]
Remember that there is also the DATA aKeyWords2 and DATA nClrKey2
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6548
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Richedit how to highlight a defined word in memofields ?

Postby Marc Venken » Sat Mar 24, 2018 11:37 am

Antonio Linares wrote:Could we create a PRG to import all forums posts to a DBF ? :-)

How to know how many posts a forum has ?

How to know in a specific topic, what the next post ?

Could we have a function ForumGetPost( ... ) that returns an array or an object with ?

1. Title (topic)
2. Date
3. Author
4. Next post in topic
5. Contents
6. Forum that belongs to
7. number of views (?)
8. what else ?

that would be great! :-)


Most of this is already done by Uwe in this topic. viewtopic.php?f=3&t=35170
Not in 1 function.., but very interesting as utility.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Richedit how to highlight a defined word in memofields ?

Postby ukoenig » Mon Mar 26, 2018 7:45 am

Cristóbal ,

using 2 different keywords and colours is working fine.
I noticed a little problem to display more than one keyword in the same line

Your included functions and new testdata.
http://www.pflegeplus.com/DOWNLOADS/Richedit4.zip

Image

Image
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Richedit how to highlight a defined word in memofields ?

Postby cnavarro » Mon Mar 26, 2018 10:56 am

Uwe, easy, look

Code: Select all  Expand view


FUNCTION THIGHLIGHT( nLine, oCode )
LOCAL cLine := ""
LOCAL nAt1  := 0
LOCAL nAt2  := 0
LOCAL nPos1 := 0
LOCAL nPos2 := 0
LOCAL x

//   oCode:GoTo( nLine - 1 )
//   cLine       := Upper( oCode:GetLine( nLine ) )

FOR x = 1 to Len( oCode:aKeyWords1 )
   // Move here
   oCode:GoTo( nLine - 1 )
   cLine       := Upper( oCode:GetLine( nLine ) )
    IF !Empty( oCode:aKeyWords1[ x ] )
        nAt1     := At( Upper( oCode:aKeyWords1[ x ] ), cLine )
        IF nAt1 > 0
            nPos1   := oCode:GetPos() + nAt1 - 1
            nPos2   := nPos1 + Len( oCode:aKeyWords1[ x ] )
            oCode:Colorize( nPos1, nPos2, oCode:nClrKey1[ x ] )
        ENDIF
    ENDIF
NEXT x

RETURN NIL

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6548
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Richedit how to highlight a defined word in memofields ?

Postby ukoenig » Mon Mar 26, 2018 12:10 pm

Cristóbal,

that WORKS :D :D
a little change with big result.

thank You very much.

I'm just working on the forum-statistik using You forum-class
It will be a extra folderpage inside the SETUP-section ( a nice idea to complete it :wink: )
NO need to start something extra.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Richedit how to highlight a defined word in memofields ?

Postby Marc Venken » Mon Mar 26, 2018 12:14 pm

Uwe,

Since you see now the position and the count of the colored word into the text, maybe a button above the textfield with the name : "NEXT"

Every time we click on it, the cursor could move to the next colored text insite the textbox. Just a idea, but sure not a need !!
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Richedit how to highlight a defined word in memofields ?

Postby Marc Venken » Tue Mar 27, 2018 7:41 am

Hey Uwe,

Could you make a pre release where the words are colored ? I use the program for all my search lookups and it would make it better to use.

If you prefer, you can also mail marc(at)maveco.be Thanks.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests