Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check Box back color in grids
Message
De
22/11/2006 11:29:59
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01171778
Message ID:
01171813
Vues:
21
This message has been marked as the solution to the initial question of the thread.
>We have always highlighted the selected object (text box, check box, etc.) when the user is editing in a form or grid. We change the object's backcolor in gotfocus and lostfocus. This works great in a form. However, I cannot seem to get anything to work in a grid with the checkbox backcolor. In order to see the checkboxes in all records and whether each is checked or not, you must set sparse to false. However, when the column with the checkbox is selected the checkbox in all rows are highlighted.
>
>Anyone have any idea how to somehow show only the checkbox in the current row as the current object? I know there are some settings in the grid layout but I have never been able to get them to work the way I would like. Maybe I just don't get it and need someone to explain what I am missing.
>Thanks.

this is a example with dynamicColor and highlight color.
o=createobject("frmColorButton")
o.show
o.addproperty("me",m.o)

#DEFINE HIGHLIGHTCOLOR 255

define class frmColorButton as form

	add object grd as GRD ;
		with columncount=1

	procedure init
		create cursor zz (ckk L , nColor i)
		insert into zz values (.F.,0xffffff)
		insert into zz values (.F.,0xffff7f)
		insert into zz values (.F.,0xff7fff)
		insert into zz values (.F.,0x7fffff)
		insert into zz values (.F.,0x7f7fff)
		insert into zz values (.F.,0xff7f7f)
		insert into zz values (.F.,0x7fff7f)
		locate
		with this.grd
			.recordsource="zz"
			.columncount = 1
			with .column1
				.sparse=.F.
				.bound = .F.
				.width = 100
				.removeobject(.controls[2].name)

				.dynamicbackColor=[IIF(m.this.recno=RECNO(),HIGHLIGHTCOLOR,nColor)]
			
				.addobject("cxColor", "checkbox")
				
				.cxColor.BackStyle = 0
				
				.cxColor.ControlSource = "ckk"
				
				.cxColor.visible=.t.
			
			endwith
		endwith

	endproc

	procedure destroy
		clear events
	endproc

enddefine

DEFINE CLASS grd as Grid
	recno = 0
	
	PROCEDURE AfterrowcolChange(c)
		this.recno = RECNO()
		this.Refresh
ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform