mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 11:59:20 +02:00
applied TComboBox fix for grabbing keys from Yoyong
git-svn-id: trunk@4263 -
This commit is contained in:
parent
4bb7bc30be
commit
1f87f8a9bf
@ -364,20 +364,57 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState);
|
procedure TCustomComboBox.SetArrowKeysTraverseList(Value : Boolean);
|
||||||
begin
|
begin
|
||||||
inherited KeyDown(Key, Shift);
|
if Value <> FArrowKeysTraverseList then begin
|
||||||
if AutoDropDown then
|
FArrowKeysTraverseList := Value;
|
||||||
|
if HandleAllocated and (not (csLoading in ComponentState)) then
|
||||||
|
CNSendMessage(LM_SETPROPERTIES, Self, nil);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
skip : Boolean;
|
||||||
|
begin
|
||||||
|
Skip := False;
|
||||||
|
|
||||||
|
if AutoDropDown or ((Shift *[ssCtrl] = [ssCtrl]) and (Key = VK_DOWN))
|
||||||
|
or FReturnArrowState then
|
||||||
begin
|
begin
|
||||||
case Key of
|
case Key of
|
||||||
VK_TAB,VK_RETURN:
|
VK_TAB,VK_RETURN:
|
||||||
|
begin
|
||||||
|
|
||||||
|
if FReturnArrowState = True then
|
||||||
|
begin
|
||||||
|
SetArrowKeysTraverseList(False); //we need this here, else we cannot traverse popup list
|
||||||
|
FReturnArrowState := False;
|
||||||
|
end;
|
||||||
|
|
||||||
DroppedDown := False;
|
DroppedDown := False;
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
|
if ArrowKeysTraverseList = False then
|
||||||
|
begin
|
||||||
|
SetArrowKeysTraverseList(True); //we need this here, else we cannot traverse popup list
|
||||||
|
FReturnArrowState := True;
|
||||||
|
Skip := True;
|
||||||
|
end;
|
||||||
|
//AutoDropDown := True;
|
||||||
DroppedDown := True;
|
DroppedDown := True;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Skip then
|
||||||
|
Key := 0
|
||||||
|
else
|
||||||
|
inherited KeyDown(Key, Shift);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
|
function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
|
||||||
|
|
||||||
@ -523,6 +560,7 @@ begin
|
|||||||
FDropDownCount:=8;
|
FDropDownCount:=8;
|
||||||
FCanvas := TControlCanvas.Create;
|
FCanvas := TControlCanvas.Create;
|
||||||
TControlCanvas(FCanvas).Control := Self;
|
TControlCanvas(FCanvas).Control := Self;
|
||||||
|
ArrowKeysTraverseList := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -750,6 +788,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.28 2003/06/12 16:18:23 mattias
|
||||||
|
applied TComboBox fix for grabbing keys from Yoyong
|
||||||
|
|
||||||
Revision 1.27 2003/06/10 13:35:54 mattias
|
Revision 1.27 2003/06/10 13:35:54 mattias
|
||||||
implemented TComboBox dropdown from Yoyong
|
implemented TComboBox dropdown from Yoyong
|
||||||
|
|
||||||
|
@ -202,6 +202,8 @@ type
|
|||||||
FSelStart: integer;
|
FSelStart: integer;
|
||||||
FSorted : boolean;
|
FSorted : boolean;
|
||||||
FStyle : TComboBoxStyle;
|
FStyle : TComboBoxStyle;
|
||||||
|
FArrowKeysTraverseList : Boolean;
|
||||||
|
FReturnArrowState : Boolean; //used to return the state of arrow keys from termporary change
|
||||||
function GetDroppedDown: Boolean;
|
function GetDroppedDown: Boolean;
|
||||||
function GetItemWidth: Integer;
|
function GetItemWidth: Integer;
|
||||||
procedure SetItemWidth(const AValue: Integer);
|
procedure SetItemWidth(const AValue: Integer);
|
||||||
@ -209,6 +211,7 @@ type
|
|||||||
procedure LMDrawListItem(var TheMessage : TLMDrawListItem); message LM_DrawListItem;
|
procedure LMDrawListItem(var TheMessage : TLMDrawListItem); message LM_DrawListItem;
|
||||||
procedure CNCommand(var TheMessage : TLMCommand); message CN_Command;
|
procedure CNCommand(var TheMessage : TLMCommand); message CN_Command;
|
||||||
procedure UpdateSorted;
|
procedure UpdateSorted;
|
||||||
|
procedure SetArrowKeysTraverseList(Value : Boolean);
|
||||||
protected
|
protected
|
||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
procedure DestroyWnd; override;
|
procedure DestroyWnd; override;
|
||||||
@ -274,6 +277,8 @@ type
|
|||||||
|
|
||||||
property AutoDropDown: Boolean
|
property AutoDropDown: Boolean
|
||||||
read FAutoDropDown write FAutoDropDown default False;
|
read FAutoDropDown write FAutoDropDown default False;
|
||||||
|
property ArrowKeysTraverseList : Boolean
|
||||||
|
read FArrowKeysTraverseList write SetArrowKeysTraverseList default True;
|
||||||
property Canvas: TCanvas read FCanvas;
|
property Canvas: TCanvas read FCanvas;
|
||||||
property SelLength: integer read GetSelLength write SetSelLength;
|
property SelLength: integer read GetSelLength write SetSelLength;
|
||||||
property SelStart: integer read GetSelStart write SetSelStart;
|
property SelStart: integer read GetSelStart write SetSelStart;
|
||||||
@ -289,6 +294,7 @@ type
|
|||||||
property ItemIndex;
|
property ItemIndex;
|
||||||
published
|
published
|
||||||
property Anchors;
|
property Anchors;
|
||||||
|
property ArrowKeysTraverseList;
|
||||||
property AutoDropDown;
|
property AutoDropDown;
|
||||||
property Ctl3D;
|
property Ctl3D;
|
||||||
property DropDownCount;
|
property DropDownCount;
|
||||||
@ -1453,6 +1459,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.96 2003/06/12 16:18:23 mattias
|
||||||
|
applied TComboBox fix for grabbing keys from Yoyong
|
||||||
|
|
||||||
Revision 1.95 2003/06/10 17:23:34 mattias
|
Revision 1.95 2003/06/10 17:23:34 mattias
|
||||||
implemented tabstop
|
implemented tabstop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user