Page 3 of 3

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

PostPosted: Sat Mar 24, 2018 11:07 am
by cnavarro
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

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

PostPosted: Sat Mar 24, 2018 11:37 am
by Marc Venken
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.

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

PostPosted: Mon Mar 26, 2018 7:45 am
by ukoenig
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

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

PostPosted: Mon Mar 26, 2018 10:56 am
by cnavarro
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

 

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

PostPosted: Mon Mar 26, 2018 12:10 pm
by ukoenig
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

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

PostPosted: Mon Mar 26, 2018 12:14 pm
by Marc Venken
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 !!

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

PostPosted: Tue Mar 27, 2018 7:41 am
by Marc Venken
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.