IonicWind Software

IWBasic => GUI Central => Topic started by: billhsln on November 14, 2014, 11:32:50 PM

Title: Clearing RichEdit Control
Post by: billhsln on November 14, 2014, 11:32:50 PM
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
Title: Re: Clearing RichEdit Control
Post by: LarryMc on November 15, 2014, 02:35:15 AM
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.

Title: Re: Clearing RichEdit Control
Post by: billhsln on November 15, 2014, 11:06:18 AM
Thank you, that fixed the problem.

Bill