INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Classes and Objects

Multiselect Records in a Grid - Basic Example by craigsboyd
Posted: 4 Jul 03 (Edited 18 Feb 05)

Slighthaze = NULL


*!*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:

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

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close