Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox In Grid
Message
 
 
To
26/12/2001 10:56:18
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00564668
Message ID:
00598199
Views:
17
Thanks, Marcia. It works almost perfectly. The only annoyance is if I click on the column in order to activate it, it shows the list. Do you know, how to fix it, but let ability to click and open list, if this column is already active?

>Hello Lakhani.
>
>>> I am using combobox in Grid, but I wants that when user press up/down arrow, Combobox's value shouldn't be changed. Instead it should navigate in Grid for next/previous record. <<
>
>Add a property to your combo called lDroppedDown. Set it to False in the click() method and to true in the DropDown(). This code in the KeyPress:
>
>
>IF This.HandleKey( nKeyCode )
>  NODEFAULT
>ENDIF
>
>
>This code in HandleKey():
>
>
>LPARAMETERS nKeyCode
>LOCAL lnMaxRows, llRetVal
>
>WITH This
>  *** If escape or enter pressed, the list is not dropped down anymore
>  IF nKeyCode = 27 OR nKeyCode = 13		
>    .lDroppedDown = .F.
>  ENDIF
>  *** If the list is not dropped down, traverse the grid with cursor keys
>  IF !.lDroppedDown
>   WITH .Parent.Parent
>     *** Calculate the maximum number of rows in the visible portion of the grid
>     lnMaxRows = INT( ( .Height - .HeaderHeight - ;
>		  IIF( INLIST( .ScrollBars, 1, 3 ), SYSMETRIC( 8 ), 0 ) ) / .RowHeight )
>     *** Move up a row in the grid
>     IF nKeyCode = 5 THEN					
>       *** If we are sitting on the top row in the visible portion of the grid,
>       *** Scroll the grid up a row in case there is a previous record
>       IF .RelativeRow = 1
>         .DoScroll( 0 )		
>       ENDIF
>       .ActivateCell( .RelativeRow - 1, .RelativeColumn )
>       *** Let KeyPress know we have handled the keystroke
>       llRetVal = .T.
>     ELSE
>       *** If we are sitting on the bottom row in the visible portion of the grid,
>       *** Scroll the grid down a row in case there is a next record	
>       IF nKeyCode = 24 THEN				
>         IF .RelativeRow >= lnMaxRows
>            .DoScroll( 1 )
> 	 ENDIF
>         .ActivateCell( .RelativeRow + 1, .RelativeColumn )
>	 llRetVal = .T.
>       ENDIF
>     ENDIF
>   ENDWITH
>  ENDIF
>ENDWITH
>
>RETURN llRetVal	
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform