Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo in Grid causing problem while Manoeuvring.
Message
From
30/07/1999 19:46:36
 
 
To
30/07/1999 12:55:31
Diptesh Patel
Unitelsoftware Ltd.
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00248258
Message ID:
00248456
Views:
13
Hi Diptesh.

>I have a grid having a column selection from master. I am using
>a combo box with style property 2.
>
>while scrolling up and down using key board, item in combo box changes

This is the default behavior for the combo box. WHat you need to do is subclass your combo boc for special use inside a grid. Add a logical custom property called lDroppedDown to the combo subclass. Set it to true in the combo's DroppDown Method. Set it to false in the click method. And add this code to the keyPress method. SHould then work fine:
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL lnActiveColumn, lnActiveRow, lnRelativeRow
IF nKeyCode = 27 OR nKeyCode = 13		&& escape or enter
   THIS.lDroppedDown = .F.
ENDIF
*-- If the list is not dropped down, traverse the grid with cursor keys
IF !THIS.lDroppedDown
   WITH This.Parent.Parent
	   IF nKeyCode = 5 THEN					&& Up Arrow
	      lnActiveColumn = .ACTIVECOLUMN
	      lnRelativeRow = .RELATIVEROW 
	      IF lnRelativeRow = 1
	         .DOSCROLL(0)		&& scroll up 1 line
	         .ACTIVATECELL(1,lnActiveColumn)
	      ELSE
	         .ACTIVATECELL(lnRelativeRow-1,lnActiveColumn)
	      ENDIF   
	      NODEFAULT
	   ELSE
	      IF nKeyCode = 24 THEN				&& Down Arrow
	         lnActiveColumn = .ACTIVECOLUMN
	         lnActiveRow = .ACTIVEROW
	         lnRelativeRow = .RELATIVEROW
	         IF lnActiveRow > lnRelativeRow
	            .DOSCROLL(1)		&& scroll down 1 line
	            .ACTIVATECELL(.RELATIVEROW+1,lnActiveColumn)
	         ELSE
	            .ACTIVATECELL(lnRelativeRow+1,lnActiveColumn)
			 ENDIF
	         NODEFAULT
	      ENDIF
       ENDIF
   ENDWITH
ENDIF
Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform