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 ?
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
Thanks Rolf.
That make it easy!
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