Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Browse.prg
Message
From
27/07/2011 08:13:12
 
 
To
27/07/2011 06:15:02
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01519297
Message ID:
01519304
Views:
84
Dragan,

cool code, but it causes VFP to hang from time to time, but unfortunately I am not able to remember exactly what I did to make this happen.

NB! I did comment out the lise which references generall.vcx.
>I'm using this little piece of code frequently. I wrote it to make my browses more readable - nulls are gray, blanks are pinkish, logicals have checkboxes, and font is what I say, not what I got by default in my foxuser or registry, and it remembers the position.
>
>You should have a currently selected alias before you Do Browse, or else you'll get a blank form.
>
>Feel free to add whatever you find useful and please post back here.
>
>
* browse.prg
>LPARAMETERS justaparameter
>*[2002/05/29 03:53:34] nDragan - poslednja neobeležena verzija
>*[2011/03/13 14:44:51] nDragan - dynamicbackcolor
>oForm=CREATEOBJECT("browform")
>oForm.SHOW()
>READ events
>RETURN oForm
>
>DEFINE CLASS browform AS FORM
>	ADD OBJECT oGrid AS GRID WITH RECORDSOURCE=ALIAS()
>	KEYPREVIEW=.T.
>
>	PROCEDURE ACTIVATE
>		THIS.CAPTION="Browse "+THIS.oGrid.RECORDSOURCE
>		THIS.RESIZE()
>	ENDPROC
>
>*---------------------------------------------------
>	PROCEDURE INIT()
>*-- dn 2011/03/13
>* this is the object which saves/restores position. Roll your own or delete this line:
>		THIS.NEWOBJECT("srpos","srposition","generall.vcx","", "top,left,height,width")
>
>*---------------------------------------------------
>	PROCEDURE KEYPRESS(tnKey, tnSCA)
>*-- dn 2011/03/13
>		IF tnKey=27
>			THIS.RELEASE()
>			CLEAR EVENTS
>		ENDIF
>
>*---------------------------------------------------
>	PROCEDURE oGrid.INIT
>		LOCAL i, N
>		SET PROCEDURE TO BROWSE.prg
>		FOR i=1 TO THIS.COLUMNCOUNT
>			WITH THIS.COLUMNS[i]
>				cSource=.CONTROLSOURCE
>				cType=TYPE(cSource)
>				DO CASE
>					CASE cType="L"
>						.ADDOBJECT("check","gcheck")
>						.CHECK.VISIBLE=.T.
>						.REMOVEOBJECT("text1")
>						.CURRENTCONTROL="check"
>						.CHECK.READONLY=.F.
>						.SPARSE=.F.
>				ENDCASE
>				.DYNAMICBACKCOLOR="icase(ISNULL("+.CONTROLSOURCE+"), 0xcecece, ISblank("+.CONTROLSOURCE+"), 0xceffce,0xffffff)"
>			ENDWITH
>		ENDFOR
>		WITH THIS AS GRID
>			.GRIDLINECOLOR=0xcaaaaa
>			.SETALL("fontname","consolas")
>			.AUTOFIT()
>		ENDWITH
>	ENDPROC
>
>	PROCEDURE RESIZE
>		WITH THIS.oGrid
>			.TOP=0
>			.LEFT=0
>			.WIDTH=THIS.WIDTH
>			.HEIGHT=THIS.HEIGHT
>			.SETALL("selectonentry",.F.)
>		ENDWITH
>	ENDPROC
>
>ENDDEFINE
>
>
>DEFINE CLASS gcheck AS CHECKBOX
>
>	caption_yes = ("Yes")
>	caption_no = ("No")
>	caption_null= ("<null>")
>	NAME = "gcheck"
>
>
>	PROCEDURE INIT
>* fire value_assign
>		THIS.VALUE=THIS.VALUE
>	ENDPROC
>
>	PROCEDURE value_assign(tu_val)
>		DO CASE
>			CASE ISNULL(tu_val)
>				THIS.CAPTION=THIS.caption_null
>			CASE EMPTY(tu_val)
>				THIS.CAPTION=THIS.caption_no
>			OTHERWISE
>				THIS.CAPTION=THIS.caption_yes
>		ENDCASE
>		THIS.REFRESH()
>		THIS.VALUE = tu_val
>	ENDPROC
>
>
>	PROCEDURE INTERACTIVECHANGE
>		THIS.VALUE=THIS.VALUE
>	ENDPROC
>
>
>	PROCEDURE CLICK
>		DODEFAULT()
>		THIS.REFRESH
>		NODEFAULT
>	ENDPROC
>
>
>ENDDEFINE
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform