Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid as listbox
Message
De
02/02/1999 11:49:13
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00182965
Message ID:
00182975
Vues:
13
>I wanted a listbox to have a picture as the second column. There either would be a picture or there wouldn't be a picture, depending on a logical field in the same cursor.
>
>People said the only way to do this was to make a grid look like a listbox. So that's what I did. And it works in that I have the unit number and the picture (or no picture) in each row.
>
>The problem is that it's very clunky. When I click on a row, it just outlines it, not highlights it. When the grid loses focus, the item isn't highlighted anymore. Also, when the grid is refreshed, it turns grey and flashes before settling back to normal.
>
>Is there any way to make this act like a listbox? Does someone have a grid as listbox class they could send me? I'm also asking once again if there's anyway to put the picture in the listbox. The listbox has a picture property. Is there no way to turn the picture off for selected rows?
>
>Thanks,
>
>-Michelle
Michelle,
For listbox, you could set picture to "" for those you don't want picture. I prefer grid approach :) Just for highlighting one row :
**************************************************
*-- Class:        highlighted (d:\vfpclasses\grids.vcx)
*-- ParentClass:  grid
*-- BaseClass:    grid
*-- Current row highlighted grid.
*
DEFINE CLASS highlighted AS grid

	Height = 200
	Width = 320
	ccurrecbackcolor = (RGB(0,0,255))
	ccurrecforecolor = (RGB(255,255,0))
	PROTECTED lingrid
	lingrid = .T.
	ncurrec = .F.
	Name = "highlighted"

	*-- Refresh when recpointer moves. For calling outside of grid.
	PROCEDURE recchange
		This.nCurRec = recno()
		This.refresh
	ENDPROC

	PROCEDURE When
		this.lInGrid = .T.
	ENDPROC

	PROCEDURE Valid
		this.lInGrid = .F.
	ENDPROC

	PROCEDURE Init
		WITH this
			IF !empty(.RecordSource)
				.nCurRec = recno(this.RecordSource)
				.SetAll("DynamicBackColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecBackColor)+","+str(this.BackColor)+")", "Column")
				.SetAll("DynamicForeColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecForeColor)+","+str(this.ForeColor)+")", "Column")
			ENDIF
		ENDWITH
	ENDPROC

	PROCEDURE BeforeRowColChange
		LPARAMETERS nColIndex
		thisform.LockScreen = this.lInGrid
	ENDPROC

	PROCEDURE AfterRowColChange
		LPARAMETERS nColIndex
		this.nCurRec = recno(This.RecordSource)
		thisform.LockScreen = .F.
		IF !this.lInGrid
			this.refresh()
		ENDIF
	ENDPROC


ENDDEFINE
*
*-- EndDefine: highlighted
**************************************************
Cetin
Ç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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform