mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 17:20:55 +02:00
rewritten WM_COMMAND by Micha
git-svn-id: trunk@4424 -
This commit is contained in:
parent
d22221b36c
commit
e81b1fe34e
@ -145,9 +145,11 @@ Begin
|
|||||||
Begin
|
Begin
|
||||||
Msg := LM_INSERTTEXT;
|
Msg := LM_INSERTTEXT;
|
||||||
Position := WParam;
|
Position := WParam;
|
||||||
NewText := String(LParam);
|
// need to init to nil because typecasting LMessage struct
|
||||||
|
Integer(NewText) := 0;
|
||||||
|
NewText := PChar(LParam);
|
||||||
Length := System.Length(NewText);
|
Length := System.Length(NewText);
|
||||||
UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
|
// UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
WM_CLOSE:
|
WM_CLOSE:
|
||||||
@ -156,27 +158,31 @@ Begin
|
|||||||
End;
|
End;
|
||||||
WM_COMMAND:
|
WM_COMMAND:
|
||||||
Begin
|
Begin
|
||||||
OwnerObject := TObject(GetProp(LParam, 'Lazarus'));
|
OwnerObject := TObject(GetProp(LParam, 'Lazarus'));
|
||||||
Case Hi(WParam) Of
|
if LParam=0 then OwnerObject := GetMenuItemObject; {menuitem or shortcut}
|
||||||
0,1: {mouse click or a menuitem command or a shortcut pressed}
|
|
||||||
Begin
|
// is this for speedbuttons?
|
||||||
if LParam=0 then OwnerObject := GetMenuItemObject; {menuitem or shortcut}
|
// If ((OwnerObject Is TControl) And (Not (OwnerObject Is TButton))) Then
|
||||||
If ((OwnerObject Is TControl) And (Not (OwnerObject Is TButton))) Then
|
// CallEvent(OwnerObject, TControl(OwnerObject).OnClick, Nil, etNotify)
|
||||||
CallEvent(OwnerObject, TControl(OwnerObject).OnClick, Nil, etNotify)
|
|
||||||
Else If OwnerObject Is TMenuItem Then
|
if OwnerObject is TMenuItem then
|
||||||
LMessage.Msg := LM_ACTIVATE
|
begin
|
||||||
Else
|
if (Hi(WParam) = 0) or (Hi(WParam) = 1) then
|
||||||
LMessage.Msg := LM_CLICKED;
|
LMessage.Msg := LM_ACTIVATE;
|
||||||
End;
|
end else if OwnerObject is TButton then
|
||||||
BN_KILLFOCUS, EN_KILLFOCUS:
|
begin
|
||||||
Begin
|
case Hi(WParam) of
|
||||||
LMessage.Msg := LM_EXIT;
|
BN_CLICKED: LMessage.Msg := LM_CLICKED;
|
||||||
End;
|
BN_KILLFOCUS: LMessage.Msg := LM_EXIT;
|
||||||
EN_CHANGE:
|
end;
|
||||||
Begin
|
end else if OwnerObject is TEdit then
|
||||||
LMessage.Msg := CM_TEXTCHANGED;
|
case Hi(WParam) of
|
||||||
End;
|
EN_CHANGE: LMessage.Msg := CM_TEXTCHANGED;
|
||||||
End;
|
end;
|
||||||
|
// no specific message found? try send a general msg
|
||||||
|
if LMessage.Msg = -1 then
|
||||||
|
if OwnerObject is TControl then
|
||||||
|
TControl(OwnerObject).Perform(CN_COMMAND, WParam, LParam);
|
||||||
End;
|
End;
|
||||||
WM_CREATE:
|
WM_CREATE:
|
||||||
Begin
|
Begin
|
||||||
@ -448,6 +454,11 @@ Begin
|
|||||||
TWinControl(OwnerObject).InvalidateClientRectCache;
|
TWinControl(OwnerObject).InvalidateClientRectCache;
|
||||||
Width := LoWord(LParam);
|
Width := LoWord(LParam);
|
||||||
Height := HiWord(LParam);
|
Height := HiWord(LParam);
|
||||||
|
// adjust size for scrollbars
|
||||||
|
if (Windows.GetWindowLong(Window, GWL_STYLE) and WS_VSCROLL) <> 0 then
|
||||||
|
Width := Width - GetSystemMetrics(SM_CXVSCROLL);
|
||||||
|
if (Windows.GetWindowLong(Window, GWL_STYLE) and WS_HSCROLL) <> 0 then
|
||||||
|
Height := Height - GetSystemMetrics(SM_CYHSCROLL);
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
WM_SYSKEYDOWN:
|
WM_SYSKEYDOWN:
|
||||||
@ -568,6 +579,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.42 2003/07/26 10:30:44 mattias
|
||||||
|
rewritten WM_COMMAND by Micha
|
||||||
|
|
||||||
Revision 1.41 2003/07/20 06:27:19 mattias
|
Revision 1.41 2003/07/20 06:27:19 mattias
|
||||||
fixed GetWindowRelativePosition
|
fixed GetWindowRelativePosition
|
||||||
|
|
||||||
|
@ -2126,6 +2126,7 @@ Begin
|
|||||||
SetProp(Window, 'Sender', @Sender);
|
SetProp(Window, 'Sender', @Sender);
|
||||||
if DoSubClass then
|
if DoSubClass then
|
||||||
SetProp(Window, 'DefWndProc', Pointer(SetWindowLong(Window, GWL_WNDPROC, LongInt(@WindowProc))));
|
SetProp(Window, 'DefWndProc', Pointer(SetWindowLong(Window, GWL_WNDPROC, LongInt(@WindowProc))));
|
||||||
|
SendMessage(Window, WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||||
end;
|
end;
|
||||||
End
|
End
|
||||||
Else If (Sender Is TMenuItem) Then
|
Else If (Sender Is TMenuItem) Then
|
||||||
@ -2743,6 +2744,9 @@ End;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.76 2003/07/26 10:30:44 mattias
|
||||||
|
rewritten WM_COMMAND by Micha
|
||||||
|
|
||||||
Revision 1.75 2003/07/25 09:28:03 mattias
|
Revision 1.75 2003/07/25 09:28:03 mattias
|
||||||
fixed notebook page resize from Micha
|
fixed notebook page resize from Micha
|
||||||
|
|
||||||
|
@ -2024,6 +2024,16 @@ Begin
|
|||||||
Result := HideCaret(Handle)
|
Result := HideCaret(Handle)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function TWin32Object.SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean;
|
||||||
|
var
|
||||||
|
ComboBox: TCustomComboBox;
|
||||||
|
Begin
|
||||||
|
ComboBox := TObject(GetProp(Handle, 'Lazarus')) as TCustomComboBox;
|
||||||
|
if ComboBox = nil then exit;
|
||||||
|
Windows.MoveWindow(Handle, ComboBox.Left, ComboBox.Top, ComboBox.Width, ComboBox.Height + 15 * MinItemCount + 2, TRUE);
|
||||||
|
Result := true;
|
||||||
|
End;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: SetFocus
|
Method: SetFocus
|
||||||
Params: HWnd - Handle of new focus window
|
Params: HWnd - Handle of new focus window
|
||||||
@ -2363,6 +2373,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.46 2003/07/26 10:30:44 mattias
|
||||||
|
rewritten WM_COMMAND by Micha
|
||||||
|
|
||||||
Revision 1.45 2003/07/20 06:27:19 mattias
|
Revision 1.45 2003/07/20 06:27:19 mattias
|
||||||
fixed GetWindowRelativePosition
|
fixed GetWindowRelativePosition
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ Function SetCapture(Value: LongInt): LongInt; Override;
|
|||||||
Function SetCaretPos(X, Y: Integer): Boolean; Override;
|
Function SetCaretPos(X, Y: Integer): Boolean; Override;
|
||||||
Function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; Override;
|
Function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; Override;
|
||||||
Function SetCaretRespondToFocus(Handle: HWND; ShowHideOnFocus: Boolean): Boolean; Override;
|
Function SetCaretRespondToFocus(Handle: HWND; ShowHideOnFocus: Boolean): Boolean; Override;
|
||||||
|
Function SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean; Override;
|
||||||
Function SetFocus(HWnd: HWND): HWND; Override;
|
Function SetFocus(HWnd: HWND): HWND; Override;
|
||||||
Function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; Override;
|
Function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; Override;
|
||||||
Function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; Override;
|
Function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; Override;
|
||||||
@ -178,6 +179,9 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.28 2003/07/26 10:30:44 mattias
|
||||||
|
rewritten WM_COMMAND by Micha
|
||||||
|
|
||||||
Revision 1.27 2003/07/07 07:59:34 mattias
|
Revision 1.27 2003/07/07 07:59:34 mattias
|
||||||
made Size_SourceIsInterface a flag
|
made Size_SourceIsInterface a flag
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user