Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: Combo can not be set to ReadOnly
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
BUG: Combo can not be set to ReadOnly
Miscellaneous
Thread ID:
00796794
Message ID:
00796794
Views:
62
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
Mark McCasland
Midlothian, TX USA
Next
Reply
Map
View

Click here to load this message in the networking platform