Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiselect Records in a Grid - Basic Example

Classes and Objects

Multiselect Records in a Grid - Basic Example

by  craigsboyd  Posted    (Edited  )
Slighthaze = [color blue]NULL[/color]
[img http://www.sweetpotatosoftware.com/ttimages/multigrid.gif]
[color green]
*!*Here's some runable code, I think it pretty much speaks
*!*for itself so I won't be adding a lot of comments
*!*The two lines of code that really do the work are
*!* .SETALL('DynamicBackColor', 'IIF(selecter, RGB(0,219,219), RGB(255,255,255))', 'COLUMN')
*!* KEYBOARD '{DNARROW}'
*!*just cut-n-paste into a prg and run it from in VFP:
[/color]
PUBLIC oForm

oForm= CREATEOBJECT('clsmultigrid')

oForm.ADDOBJECT('Grid1','Grid')

WITH oForm.Grid1
.COLUMNCOUNT = 3
.HEIGHT = 288
.PANEL = 1
.WIDTH = 320
.LEFT = 24
.TOP = 24
.Column1.WIDTH = 17
.Column1.NAME = "Column1"
.Column1.Header1.CAPTION = ""
.Column1.ADDOBJECT('Check1','clscheck')
.Column1.Check1.VISIBLE = .T.
.Column1.CURRENTCONTROL = 'Check1'
.Column1.Text1.VISIBLE = .F.
.Column1.REMOVEOBJECT('Text1')
.Column1.SPARSE = .F.
.Column2.WIDTH = 148
.Column2.NAME = "Column2"
.Column2.Header1.CAPTION = "NAME"
.Column3.WIDTH = 114
.Column3.NAME = "Column3"
.Column3.Header1.CAPTION = "PHONE"
.Column3.FORMAT = "R"
.Column3.INPUTMASK = "(###)###-####"
.SETALL('DynamicBackColor', 'IIF(selecter, RGB(0,219,219), RGB(255,255,255))', 'COLUMN')
.VISIBLE = .T.
ENDWITH

oForm.VISIBLE = .T.

DEFINE CLASS clsmultigrid AS FORM

TOP = 0
LEFT = 0
HEIGHT = 334
WIDTH = 376
DOCREATE = .T.
CAPTION = "Form"
WINDOWTYPE = 1
WINDOWSTATE = 0
NAME = "clsmultigrid"

PROCEDURE LOAD
CREATE CURSOR crsTemp (selecter L, thename c(25), thephone c(10))
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "JOHN SMITH", "1111111111")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "AMY SUTTON", "2222222222")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "BILL BRADLEY", "3333333333")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "LUCY LUI", "4444444444")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "CHUCK NORRIS", "5555555555")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "BRUCE LEE", "6666666666")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "KATHERINE HEPBURN", "7777777777")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "JIM WALKER", "8888888888")
INSERT INTO crsTemp (selecter, thename, thephone) VALUES (.F., "SANDY LITTLETON", "9999999999")
GO TOP IN "crsTemp"
ENDPROC

ENDDEFINE

DEFINE CLASS clscheck AS CHECKBOX
HEIGHT = 17
WIDTH = 18
AUTOSIZE = .T.
CAPTION = ""
NAME = "clscheck"

PROCEDURE CLICK
IF DODEFAULT()
KEYBOARD '{DNARROW}'
ENDIF
ENDPROC

ENDDEFINE
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top