Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox bug?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Checkbox bug?
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01313656
Message ID:
01313656
Views:
55
Maybe it is an old bug I cannot seem to remember but my memory was always bad...

If you have a disabled checkbox with a caption that spans multiple lines, and you want to dynamically change it's disabled fore color, it does not work properly if you try to set it to black!

Try the following code and then change myCheckBox.Refresh so it changes to any color but black, for example a near black value (1)
loForm			= Createobject('myForm')
loForm.Show(1)

define class myForm as Form
	add object myCheckBox as CheckBox with	Caption = 'Some caption, very long caption, that stretches more than one line', ;
						Enabled = .f., ;
						DisabledForeColor = 255, ;
						Value = .f., ;
						height = 200, ;
						width = 100, ;
						autosize = .f., ;
						wordwrap = .t.

	add object myCommand as CommandButton with Caption = 'Change color', Top = 210
	
	procedure myCommand.Click()
		thisform.myCheckBox.Value		= not thisform.myCheckBox.Value
		thisform.myCheckBox.Refresh()
	endproc
	
	procedure myCheckBox.Refresh()
		this.DisabledForeColor			= Iif(this.Value, 0, 255) && Use this for the first run, it will not work
*		this.DisabledForeColor			= Iif(this.Value, 1, 255) && Use this for the second run, it works
	endproc
enddefine
I am sure is something old, but I just found it and thought about sharing it
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Next
Reply
Map
View

Click here to load this message in the networking platform