Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid movement
Message
From
18/08/1999 05:34:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/08/1999 14:59:10
James Boden
Software Solutions For Business
Cumberland, Maryland, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00254642
Message ID:
00254858
Views:
20
>I need to prevent a user from moving up or down in my grid. Except to move left or right. How do I prevent the user from doing just a left or right movement. I see that there is a keypress event. Am I able to use this in doing this?
>
>Thanks Jim Boden

Keypress wouldn't help much. Because it's for the controls contained in columns. There isn't a gridwise keypress (but form.keypreview = .t. provides it). Also it wouldn't intercept mouse.
To do it at grid level use beforerowcolchange event.
LPARAMETERS nColIndex
WITH this
  IF mdown()
    lnBottom		= .top+.headerheight+.relativerow * .rowheight
    lnTop		= lnBottom - this.rowheight
    lnMouseRowPos	= mrow(wontop(),3)
    lnMouseColPos	= mcol(wontop(),3)
    llChangingRow	= !(between(lnMouseRowPos,lnTop, lnBottom) ;
      and between(lnMouseColPos,.left,.left+.width))
* Is click on a different row
  ELSE
    llChangingRow	= inlist(lastkey(),24,5,18,3)
* Was lastkey() in Up,down, pgup,pgdown
  ENDIF
ENDWITH
if llChangingRow && About to change row
 if ICantLetItToGo    && Would you let him/her go
     nodefault     && Do not let to change
 endif
endif
Code assumes you use default Scalemode (pixels) for form.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform