Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Highlight Problem - Can you Duplicate it?
Message
De
14/09/2005 09:18:16
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01049139
Message ID:
01049379
Vues:
20
Now that is strange. In my testing of the previous code, if the cursor is in the first column and I use the up/dwn arrow to move between rows, column2 displays the special backcolor. Column3 does not show the highlight (and it should). Except in the case of the row with no special dynamicbackcolor set, it highlights correctly. I have tried it with themes on and off. I cannot figure out what is causing the different effect on different development systems in testing yet. On my live form that I am also testing with, I can get the entire row to highlight (actually emulating highlight by setting the backcolor on the cell) correctly whether there is a special dynamicbackcolor or not in the cell but that only works if I toggle sparse on/off depending on the backcolor. That would be perfect though (since it works) if only the data in the cell didn't jump left/right maneuvering between rows when sparse switches on/off.
* Data in column shifts when sparse changed but highlight effect is correct
IF TYPE('thisform.pgfprofile.pagpolicy.policygrid') = "O" .AND. !ISNULL(THISFORM.pgfprofile.pagpolicy.policygrid)

	llsetlockscreen = .F.
	IF !THISFORM.LOCKSCREEN
		llsetlockscreen = .T.
		THISFORM.LOCKSCREEN = .T.
	ENDIF

	WITH THISFORM.pgfprofile.pagpolicy.policygrid

		IF !EMPTY(.RECORDSOURCE)

			FOR lnColumn = 1 TO .COLUMNCOUNT

				IF .COLUMNS(lnColumn).CONTROLSOURCE == "PO_STATUS" ;
						.OR. .COLUMNS(lnColumn).CONTROLSOURCE == "PO_TYPE"

					.COLUMNS(lnColumn).SPARSE = .F.

					PRIVATE loCurrentControl
					STORE NULL TO loCurrentControl
					FOR EACH loControl IN .COLUMNS(lnColumn).CONTROLS
						IF loControl.NAME = loControl.PARENT.CURRENTCONTROL
							loCurrentControl = loControl
						ENDIF
					ENDFOR

					IF TYPE("loCurrentControl") = "O" AND NOT ISNULL(loCurrentControl)
						IF LOWER(loCurrentControl.BASECLASS) = "textbox" .OR. LOWER(loCurrentControl.BASECLASS) = "editbox"
							IF PEMSTATUS(loCurrentControl, "BackColor", 5 ) && Some controls in the column (i.e. Image) may not have .BackColor Property
								IF !EMPTY(.COLUMNS(lnColumn).DYNAMICBACKCOLOR)
									loCurrentControl.BACKCOLOR = EVALUATE(.COLUMNS(lnColumn).DYNAMICBACKCOLOR)
									IF loCurrentControl.BACKCOLOR = THISFORM.gridbackcolor
										loCurrentControl.BACKCOLOR = THISFORM.HIGHLIGHTBACKCOLOR
										.COLUMNS(lnColumn).SPARSE = .T.
									ENDIF
								ELSE
									loCurrentControl.BACKCOLOR = THISFORM.HIGHLIGHTBACKCOLOR
									.COLUMNS(lnColumn).SPARSE = .T.
								ENDIF
								IF loCurrentControl.BACKCOLOR <> THISFORM.gridbackcolor
									llsethighlight = .T.
								ELSE
									loCurrentControl.BACKCOLOR = THISFORM.HIGHLIGHTBACKCOLOR
									.COLUMNS(lnColumn).SPARSE = .T.
								ENDIF
							ENDIF
						ENDIF
					ENDIF
				ENDIF

			ENDFOR

			llsethighlight = .T.
			IF llsethighlight
				.HIGHLIGHTSTYLE = 0
			ELSE
				.HIGHLIGHTSTYLE = THISFORM.HIGHLIGHTSTYLE
			ENDIF

		ENDIF	&& not empty recordsource

	ENDWITH

	IF llsetlockscreen = .T.
		THISFORM.LOCKSCREEN = .F.
	ENDIF
ENDIF
RETURN
In this code, the data does not shift left/right because I am not toggling sparse on/off but when the column with special backcolor switches to no special backcolor (dependent on the value in the field in the row) then the cell stays the default color of the grid backcolor and doesn't emulate the highlight as it should so it in essence stays white.
* cells with no custom dynamic backcolor stay white but should emulate highlight blue
IF TYPE('thisform.pgfprofile.pagpolicy.policygrid') = "O" .AND. !ISNULL(THISFORM.pgfprofile.pagpolicy.policygrid)

	llsetlockscreen = .F.
	IF !THISFORM.LOCKSCREEN
		llsetlockscreen = .T.
		THISFORM.LOCKSCREEN = .T.
	ENDIF

	WITH THISFORM.pgfprofile.pagpolicy.policygrid

		IF !EMPTY(.RECORDSOURCE)

			FOR lnColumn = 1 TO .COLUMNCOUNT

				IF .COLUMNS(lnColumn).CONTROLSOURCE == "PO_STATUS" ;
						.OR. .COLUMNS(lnColumn).CONTROLSOURCE == "PO_TYPE"

					IF TYPE('EVALUATE(.COLUMNS(lnColumn).CONTROLSOURCE)') = "U"
						LOOP
					ENDIF

					.COLUMNS(lnColumn).SPARSE = .F.

					PRIVATE loCurrentControl
					STORE NULL TO loCurrentControl
					FOR EACH loControl IN .COLUMNS(lnColumn).CONTROLS
						IF loControl.NAME = loControl.PARENT.CURRENTCONTROL
							loCurrentControl = loControl
						ENDIF
					ENDFOR

					IF TYPE("loCurrentControl") = "O" AND NOT ISNULL(loCurrentControl)
						IF LOWER(loCurrentControl.BASECLASS) = "textbox" .OR. LOWER(loCurrentControl.BASECLASS) = "editbox"
							IF PEMSTATUS(loCurrentControl, "BackColor", 5 ) && Some controls in the column (i.e. Image) may not have .BackColor Property
								IF !EMPTY(.COLUMNS(lnColumn).DYNAMICBACKCOLOR)
									newcolor = EVALUATE(.COLUMNS(lnColumn).DYNAMICBACKCOLOR)
									IF newcolor <> THISFORM.gridbackcolor
										loCurrentControl.BACKCOLOR = newcolor
									ELSE
										loCurrentControl.BACKCOLOR = THISFORM.HIGHLIGHTBACKCOLOR
									ENDIF
								ELSE
									loCurrentControl.BACKCOLOR = THISFORM.HIGHLIGHTBACKCOLOR
								ENDIF
							ENDIF
						ENDIF
					ENDIF
				ENDIF

			ENDFOR

			llsethighlight = .T.
			IF llsethighlight
				.HIGHLIGHTSTYLE = 0
			ELSE
				.HIGHLIGHTSTYLE = THISFORM.HIGHLIGHTSTYLE
			ENDIF

		ENDIF	&& not empty recordsource

	ENDWITH

	IF llsetlockscreen = .T.
		THISFORM.LOCKSCREEN = .F.
	ENDIF
ENDIF
RETURN
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform