Re: VFP9: Multiple Check Box Clicks

Author: Frank Cazabon

Posted: 2011-10-21 at 14:22:42

Desmond,

I have some old code that does that (this is really old so no guarantees):

Add a property to your form called

ilCallMultiSelect

and set it to .F.

add a checkbox to a column in the grid and delete the default textbox

that's there.

This is the checkbox's MouseDown():

LPARAMETERS nButton, nShift, nXCoord, nYCoord

* nButton = 1 (left), 2 (right), or 4 (middle).

#DEFINE SHIFTKEY 1

#DEFINE LEFTMOUSEBUTTON 1

IF nButton = LEFTMOUSEBUTTON AND nShift = SHIFTKEY

THISFORM.ilCallMultiSelect = .T.

ENDIF

Checkbox's Click():

WITH THISFORM

IF .ilCallMultiSelect = .T.

.ilCallMultiSelect = .F.

MultiSelectCustomers(iOwnerId, 'PrintLetter', 0, 1)

ENDIF

ENDWITH

CheckBox's KeyPress()

LPARAMETERS nkeycode,nshiftaltctrl

IF MultiSelectCustomers(v_SaleLetters.iOwnerId, 'PrintLetter', nkeycode,

nshiftaltctrl)

THIS.Refresh()

ENDIF

DODEFAULT(nkeycode,nshiftaltctrl)

This is my MultiSelectCustomers program:

LPARAMETERS tiCustId, tcField, nKeyCode, nShiftAltCtrl

LOCAL llFound, llRetVal

* we want to let the user hold the shift key down while selecting an item

* and if it is down then all items between this one and the next one

above it will be selected

#DEFINE SHIFTKEY 1

#DEFINE ENTERKEY 13

#DEFINE SPACEBAR 32

#DEFINE LEFTMOUSE 0

IF (nShiftAltCtrl = SHIFTKEY AND INLIST(nKeyCode, ENTERKEY, SPACEBAR))

AND NOT EVAL(tcField);

OR (nShiftAltCtrl = SHIFTKEY AND nKeyCode = LEFTMOUSE AND

EVAL(tcField))

* skip backwards until we find a selected one

DO WHILE !BOF()

SKIP -1

IF EVAL(tcField)

llFound = .T.

EXIT

ENDIF

ENDDO

IF llFound

DO WHILE .T. && iCustid # tiCustId

REPLACE (tcField) WITH .T.

IF iOwnerid # tiCustId

SKIP

ELSE

EXIT

ENDIF

ENDDO

ELSE

LOCATE FOR iOwnerId = tiCustId

ENDIF

llRetVal = .T.

ENDIF

RETURN llRetVal

Frank.

Frank Cazabon

On 21/10/2011 02:01 PM, Desmond Lloyd wrote:

> Alrighty then,

>

> VFP9 grid, with a check box as control for each record. Click on the check

> box and print a document, great. Grid will have up to 1,200 records in and

> they need to be able to highlight a range, or click on one and the final

> one (say ten records down) and have the check boxes check in between. Like

> a multiple select.

>

> Has anyone done this.... Could prompt for a range of records, seems a

> little clumsy, multiple select would be good....

>

> Regards,

> Desmond

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/4EA1B872.2060501@gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Frank Cazabon