April 25, 2024, 08:52:03 PM

News:

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


Clearing RichEdit Control

Started by billhsln, November 14, 2014, 11:32:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

November 14, 2014, 11:32:50 PM Last Edit: November 14, 2014, 11:35:19 PM by billhsln
I have a RichEdit control setup as read only:

CONTROL d1,@RICHEDIT," ",215,37,770,410,0x50800004|@CTEDITRO|@HSCROLL|@VSCROLL,d1_re

and I am using the following code to clear it out after loading info into it:

' Clear RichEdit
l = CONTROLCMD (d1,d1_re,@RTGETTEXTLENGTH)
CONTROLCMD d1,d1_re, @RTSETSELECTION, 0, l
CONTROLCMD d1,d1_re, @RTDELETESEL


The problem is, it is not clearing out the RichEdit.  I am working on a program to keep track of recipes for a friend.

I am attaching what I have completed so far with a few recipes for input.  All that works so far is I can read in the recipe and determine what the keywords are.  NOTHING ELSE WORKS yet.  There is a lot of coding not yet in place.

Thanks for any help,
Bill
When all else fails, get a bigger hammer.

LarryMc

It appears that a read-only RE control disables the @RTDELETESEL command

So, change this
' Clear RichEdit
l = CONTROLCMD (d1,d1_re,@RTGETTEXTLENGTH)
CONTROLCMD d1,d1_re, @RTSETSELECTION, 0, l
CONTROLCMD d1,d1_re, @RTDELETESEL

to this
' Clear RichEdit
CONTROLCMD d1,d1_re, @RTSETSELECTION, 0, -1
CONTROLCMD d1,d1_re, @RTREPLACESEL, ""

and it will do what you want.

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thank you, that fixed the problem.

Bill
When all else fails, get a bigger hammer.