Hi David,
>I have never seen a readonly cbo in any other application. I have seen disabled cbo's, but never one that could be dropped if the user could not change the value.
I don't understand why a readonly cbo is so odd. And in the Readonly state the dropdownlist isn't fired. I'll post my code for my combo base class at the bottom of this message.
>So IMHO you should just Enable=.f. if the user doesn't have the correct access level. They probably shouldn't even be able to see the list of possible values.
The security at this point in time is Add, Edit or Full. If the user didn't have viewing access s/he would never make it to this point. Then, my INIT for all databound controls checks the acces of the controlsource. If in an Edit form, and a non-Edit or Full value is returned, the control is set to readonly.
>Conditional instantiation, or even just conditional visiblity isn't really that much more work than what you've probably done already.
You're right, I just chose conditional "ReadOnly"
Here is my ComboBox base class ( there are some differences between this and True-ReadOnly, I know, cannot highlight to copy text, ect.):
**************************************************
*-- Class: securecombobox (i:\framework\libs\asecure.vcx)
*-- ParentClass: sfcombobox (i:\stonefield\sfcommon\sfctrls.vcx)
*-- BaseClass: combobox
*-- Time Stamp: 07/26/99 11:01:03 AM
*
DEFINE CLASS securecombobox AS sfcombobox
Name = "securecombobox"
lreadonly = .F.
PROCEDURE readonly_assign
LPARAMETERS vNewVal
THIS.lReadOnly = m.vNewVal
This.BackColor=iif(this.lreadonly, this.disabledbackcolor, RGB(255,255,255))
This.TabStop=!This.lReadOnly
ENDPROC
PROCEDURE readonly_access
RETURN THIS.lReadOnly
ENDPROC
PROCEDURE When
dodefault()
return !this.lreadonly
ENDPROC
ENDDEFINE
*
*-- EndDefine: securecombobox
**************************************************