Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: Combo can not be set to ReadOnly
Message
From
05/06/2003 12:44:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00796794
Message ID:
00796803
Views:
22
Mark,
I think this is not a bug but a documented behaviour :
"For combo box controls, the ReadOnly property cannot be set to true (.T.) when the Style property is set to 2 – Drop-down List."
While this statement might be interpreted in a different way I think ReadOnly applies to 'text' entry.
PS: Behaviour was same in older versions.
Cetin

>A Dropdown List Combo can not be set to ReadOnly. The second combo in the code below does show the ReadOnly property to be TRUE, but you can still change the value of the combo. Repro Code:
>CREATE CURSOR crsProduce (Fruit C(15), Vegetable C(15))
>INSERT INTO crsProduce VALUES ('Oranges', 'Peas')
>PUBLIC o
>o = CREATEOBJECT('_Form')
>o.Show()
>
>DEFINE CLASS _Form AS Form
>
>	AutoCenter = .T.
>	Height = 140
>	Width = 280
>
>	ADD OBJECT lblInfo AS Label WITH ;
>	  Top = 5, ;
>	  Left = 10, ;
>	  AutoSize = .T.,;
>	  Caption = 'RightClick Combo to Display ReadOnly Value'
>
>	ADD OBJECT cboFruitValue AS _Combo1 WITH ;
>	  ControlSource = 'crsProduce.Fruit', ;
>	  Visible = .T., ;
>	  Top = 25, ;
>	  Left = 10
>	
>	ADD OBJECT cboVegValue AS _Combo2 WITH ;
>	  ControlSource = 'crsProduce.Vegetable', ;
>	  Visible = .T., ;
>	  Top = 55, ;
>	  Left = 10
>
>	ADD OBJECT cmdBrowse AS CommandButton WITH ;
>	  Top = 90, ;
>	  Left = 10, ;
>	  Height = 27, ;
>	  Width = 80, ;
>	  Caption = 'Browse', ;
>	  Visible = .T.
>
>	PROTECTED PROCEDURE Init
>		SET TALK off
>	ENDPROC
>	PROCEDURE cmdBrowse.Click
>		SELECT crsProduce
>		BROWSE normal
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS _Combo1 AS ComboBox
>
>	lEditPrivRequired = .T.
>	RowSourceType = 1
>	RowSource = 'Apples,Pears,Oranges,Grapes,Cherries,Bananas'
>	Style = 2
>
>	PROTECTED PROCEDURE Init
>		IF THIS.lEditPrivRequired
>			THIS.ReadOnly = .T.
>		ENDIF
>	ENDPROC
>	PROCEDURE RightClick
>		WAIT WINDOW [ReadOnly Value: ] + TRANSFORM(THIS.ReadOnly)
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS _Combo2 AS ComboBox
>
>	RowSourceType = 1
>	RowSource = 'Carrots,Lettuce,Beets,Peas,Asparagus,Potatoes'
>	Style = 2
>	ReadOnly = .T.
>
>	PROCEDURE RightClick
>		WAIT WINDOW [ReadOnly Value: ] + TRANSFORM(THIS.ReadOnly)
>	ENDPROC
>ENDDEFINE
>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform