PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on November 22, 2011, 11:46:37 PM

Title: how do I set the ReadOnly property of RichEdit Control
Post by: Martin Francom on November 22, 2011, 11:46:37 PM
I have a form with a RichEdit control and I would like to be able to set
the  "readOnly" property on or off at run time using a checkbox. 

What is the cold I should use to turn Read Only on or Off on a RichEdit control ?
Title: Re: how do I set the ReadOnly property of RichEdit Control
Post by: Rolf Brandt on November 23, 2011, 04:58:13 AM
This works;

Function FORM1_CHECK1_BN_CLICKED ( _
                                 ControlIndex     As Long,  _  ' index in Control Array
                                 hWndForm         As Dword, _  ' handle of Form
                                 hWndControl      As Dword, _  ' handle of Control
                                 idButtonControl  As Long   _  ' identifier of button
                                 ) As Long
   
   If FF_Control_GetCheck( HWND_FORM1_CHECK1 ) = %true Then
      SendMessage HWND_FORM1_RICHEDIT1, %EM_SETREADONLY, %TRUE, 0    'Set it ReadOnly
   Else
      SendMessage HWND_FORM1_RICHEDIT1, %EM_SETREADONLY, %false, 0   'Set it editable
   End If
   
End Function


Rolf
Title: Re: how do I set the ReadOnly property of RichEdit Control
Post by: Martin Francom on November 23, 2011, 12:06:46 PM
Thanks Rolf.
That make it easy!
Title: Re: how do I set the ReadOnly property of RichEdit Control
Post by: Rolf Brandt on November 24, 2011, 05:27:43 AM
Hi Marty,

Sometime I forget that Josè has given us wrappers for all these controls to make life easier. You can also use this:

RichEdit_SetReadOnly (HWND_FORM1_RICHEDIT1, %True)
'or
RichEdit_SetReadOnly (HWND_FORM1_RICHEDIT1, %False)


If you haven't done yet you should download Josè's Windows API Wrappers Reference. It is a Chm helpfile.You will find information much quicker than in the Win32 helpfile. Check under RichEdit and you find an enormous amount of information that will be of help to you.

Rolf