Silverfrost Forums

Welcome to our forums

%eb and highlighting text

26 Jul 2005 3:47 #241

I use %eb to display a read-only file and use FIND_EDIT_STRING to locate the text, and highlight the line containing a user provided search string. If the string is there multiple times then on each occasion when the user activates 'Find' I simply advance to the line following the previous entry and perform the FIND_EDIT_STRING again. Works fine.

However (typically) it has been suggested that when FIND is carried out then immediately each line containing the given text should be highlighted / coloured in some way - rather than one at a time.

If I firstly scanned the whole file for the matches with the given string, stored the line numbers and then used %tc to colour lines in some way would this allow multiple lines in the file to be coloured?

Many Thanks

Bill

27 Jul 2005 12:14 #242

Yes you can do this but the coding is not trivial. You need to get an address from the edit_info array and then use CORE4 as illustrated in the following code....

  WINAPP

c------------------------------------------------------ INTEGER i,edit_inf(24),winio@ COMMON edit_inf EXTERNAL eb_cb i=winio@('%`^40.10eb[user_colours,extended]','',0,edit_inf,eb_cb) END c------------------------------------------------------- INTEGER FUNCTION eb_cb() INCLUDE <windows.ins> INTEGER edit_inf(24) COMMON edit_inf IF(edit_inf(15).gt.0)THEN c Make first character on the line red
core4(edit_inf(17))=RGB@(255,0,0) c Make the last character on the line blue core4(edit_inf(17)+4
(edit_inf(15)-1))=RGB@(0,0,255) ENDIF eb_cb=0 END

Please login to reply.