*** GotFocus * Handle the ComboBox class's normal stuff dodefault() with this * Whether the drop down list is expanded and visible .ListExpanded = .F. endwith ********************************* *** Init with this * Handle the ComboBox class's normal stuff dodefault() * Keeps track of whether the dropdown list has dropped down & is visible .AddProperty( "ListExpanded ", .F. ) * The default value of ON( "KEY", "F3" ) outside of this control .AddProperty( "cWasOnKey_F3", "" ) * The maximum number of rows in this grid .AddProperty( "GridMaxRows", ; int( ( .Parent.Parent.Height - .Parent.Parent.HeaderHeight - ; iif( inlist( .Parent.Parent.ScrollBars, 1, 3), sysmetric(8), 0 ) ) ; / .Parent.Parent.RowHeight ) ) endwith && this ******************************* *** KeyPress lparameters nKeyCode, nShiftAltCtrl #INCLUDE InkeyValues.h && Values from VFP's help for function INKEY() local loGrid with this loGrid = .Parent.Parent do case case ( nKeyCode == KEY_F3_ALONE ) AND ( nShiftAltCtrl == NONE_PRESSED ) * F3 = Opens Combo box * We override the application's normal ON KEY LABEL "F3" action just while in this Combobox. * The application's normal ON KEY LABLE "F3" is deactivated in this object's * GotFocus and reactivated in LostFocus. nodefault if ( ! .ListExpanded ) .ListExpanded = .T. keyboard "{Alt+DnArrow}" endif case ( ! .ListExpanded ) && DropDown list is *NOT* displayed do case case ( ( nShiftAltCtrl == 4 ) AND ( nKeyCode == KEY_DOWN_ARROW_ALONE ) ) * "{Alt+DnArrow}" --- Opens Combo box .ListExpanded = .T. case ( ( nShiftAltCtrl == NONE_PRESSED ) AND ; ( inlist( nKeyCode, KEY_DOWN_ARROW_ALONE, KEY_UP_ARROW_ALONE ) ) ) nodefault .ListExpanded = .F. * - - - - - - - - - - - - - - - select ( loGrid.RecordSource ) * - - - - - - - - - - - - - - - * DOWN Arrow grid navigation if ( ( nKeyCode == KEY_DOWN_ARROW_ALONE ) AND ( nShiftAltCtrl == NONE_PRESSED ) ) if ( ! eof() ) skip if ( eof() ) go bottom endif endif endif * UP Arrow grid navigation if ( ( nKeyCode == KEY_UP_ARROW_ALONE ) AND ( nShiftAltCtrl == NONE_PRESSED ) ) if ( ! bof() ) skip -1 if ( bof() ) locate endif endif endif endcase otherwise * The Drop Down list is currently displayed if ( inlist( nKeyCode, KEY_ENTER_ALONE, KEY_TAB_ALONE ) ) .ListExpanded = .F. endif endcase endwith && this ********************************* *** LostFocus local lcMacro lcMacro = this.cWasOnKey_F3 on key label "F3" &lcMacro.