May 12, 2024, 11:14:03 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


RichEdit Control

Started by ckoehn, February 04, 2010, 01:39:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ckoehn

How do you change which line is the top row?  I have searched for, found and highlighted a word, but it is way down in the text and does not automatically display.  How can I make it show the selected text?

aurelCB

Im not sure what you tra to ask but i guess that is about hilight selected text in Richedit control.
From help:
QuoteSelection operations

CONTROLCMD window | dialog, ID, @RTGETSELECTION, varStart, varEnd

Use this command to retrieve the current selection of the rich edit control.

varStart and varEnd must be of type INT. The zero-based index of the first and last characters selected are copied into the two variables. The selection includes everything if varStart =0 and varEnd = -1.

QuoteCONTROLCMD window | dialog, ID, @RTSETSELECTION, start, end

Use this statement to set the current selection in the rich edit control

start and end are the zero-based character indexes of the selection. If start = 0 and end = -1 then all of the text is selected.


ckoehn

I'm sorry about not being clear.  I am able to highlight the text.  But if the selection is outside of the viewing area, that is where it stays.  I want to be able to highlight the text and scroll it into the viewing area.

aurelCB

I only have this piece of code which LarryMc help me for ,Code is in CBasic but i hope you can transate them to
EBasic.
SUB hilites
lnum = startf
IF suberror=1 then lnum=startsub
htext$ = CONTROLCMD ( w1, 1, @RTGETLINE, lnum)
linelength=len(htext$)
charstart = SendMessage( w1, 0xBB, lnum,0, 1)
'char_start is lparam wich is 0,ID is 1
charend = charstart + linelength
CONTROLCMD w1, 1, @RTHIDESEL, 0
CONTROLCMD w1, 1, @RTSETSELECTION, charstart, charend
lnum=0:linelength=0:charstart=0:charend=0:htext$=""

ckoehn

Thanks, I'll have a go at it.

ckoehn

I don't think there is anything in there that will scroll up to the highlighted area. Isn't there any way to do that?

ckoehn

I finally figured it out.  You have to hide the selection and then make it visible again.

Thanks for your help.