From: <ah...@us...> - 2007-08-18 12:23:52
|
Revision: 11471 http://jvcl.svn.sourceforge.net/jvcl/?rev=11471&view=rev Author: ahuser Date: 2007-08-18 05:23:50 -0700 (Sat, 18 Aug 2007) Log Message: ----------- Mantis #4190: TJvDBLookupCombo - Allow TAB key to select records (Mantis #4190) Modified Paths: -------------- trunk/jvcl/run/JvDBLookup.pas Modified: trunk/jvcl/run/JvDBLookup.pas =================================================================== --- trunk/jvcl/run/JvDBLookup.pas 2007-08-18 12:16:12 UTC (rev 11470) +++ trunk/jvcl/run/JvDBLookup.pas 2007-08-18 12:23:50 UTC (rev 11471) @@ -369,6 +369,7 @@ FSelMargin: Integer; FDisplayValues: TStringList; FDisplayAllFields: Boolean; + FTabSelects: Boolean; FOnDropDown: TNotifyEvent; FOnCloseUp: TNotifyEvent; procedure ListMouseUp(Sender: TObject; Button: TMouseButton; @@ -443,6 +444,7 @@ property DropDownWidth: Integer read FDropDownWidth write FDropDownWidth default 0; property EscapeClear: Boolean read FEscapeClear write FEscapeClear default True; property DisplayAllFields: Boolean read GetDisplayAllFields write SetDisplayAllFields default False; + property TabSelects : Boolean read FTabSelects write FTabSelects default False; property Color; property DataField; property DataSource; @@ -2752,6 +2754,9 @@ begin if FListVisible then begin + if TabSelects and IsDropDown and (Key = Tab) then + Key := Cr; + if Key in [Cr, Esc] then begin CloseUp(Key = Cr); @@ -3313,6 +3318,10 @@ procedure TJvDBLookupCombo.CNKeyDown(var Msg: TWMKeyDown); begin if not (csDesigning in ComponentState) then + begin + if TabSelects and IsDropDown and (Msg.Charcode = VK_TAB) then + Msg.Charcode := VK_RETURN; + if (Msg.CharCode in [VK_RETURN, VK_ESCAPE]) and FListVisible and FLookupMode and FDataLink.DataSourceFixed then begin @@ -3320,6 +3329,7 @@ Msg.Result := 1; Exit; end; + end; inherited; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |