mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 20:20:16 +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
|
||||
Msg := LM_INSERTTEXT;
|
||||
Position := WParam;
|
||||
NewText := String(LParam);
|
||||
// need to init to nil because typecasting LMessage struct
|
||||
Integer(NewText) := 0;
|
||||
NewText := PChar(LParam);
|
||||
Length := System.Length(NewText);
|
||||
UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
|
||||
// UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
|
||||
End;
|
||||
End;
|
||||
WM_CLOSE:
|
||||
@ -156,27 +158,31 @@ Begin
|
||||
End;
|
||||
WM_COMMAND:
|
||||
Begin
|
||||
OwnerObject := TObject(GetProp(LParam, 'Lazarus'));
|
||||
Case Hi(WParam) Of
|
||||
0,1: {mouse click or a menuitem command or a shortcut pressed}
|
||||
Begin
|
||||
if LParam=0 then OwnerObject := GetMenuItemObject; {menuitem or shortcut}
|
||||
If ((OwnerObject Is TControl) And (Not (OwnerObject Is TButton))) Then
|
||||
CallEvent(OwnerObject, TControl(OwnerObject).OnClick, Nil, etNotify)
|
||||
Else If OwnerObject Is TMenuItem Then
|
||||
LMessage.Msg := LM_ACTIVATE
|
||||
Else
|
||||
LMessage.Msg := LM_CLICKED;
|
||||
End;
|
||||
BN_KILLFOCUS, EN_KILLFOCUS:
|
||||
Begin
|
||||
LMessage.Msg := LM_EXIT;
|
||||
End;
|
||||
EN_CHANGE:
|
||||
Begin
|
||||
LMessage.Msg := CM_TEXTCHANGED;
|
||||
End;
|
||||
End;
|
||||
OwnerObject := TObject(GetProp(LParam, 'Lazarus'));
|
||||
if LParam=0 then OwnerObject := GetMenuItemObject; {menuitem or shortcut}
|
||||
|
||||
// is this for speedbuttons?
|
||||
// If ((OwnerObject Is TControl) And (Not (OwnerObject Is TButton))) Then
|
||||
// CallEvent(OwnerObject, TControl(OwnerObject).OnClick, Nil, etNotify)
|
||||
|
||||
if OwnerObject is TMenuItem then
|
||||
begin
|
||||
if (Hi(WParam) = 0) or (Hi(WParam) = 1) then
|
||||
LMessage.Msg := LM_ACTIVATE;
|
||||
end else if OwnerObject is TButton then
|
||||
begin
|
||||
case Hi(WParam) of
|
||||
BN_CLICKED: LMessage.Msg := LM_CLICKED;
|
||||
BN_KILLFOCUS: LMessage.Msg := LM_EXIT;
|
||||
end;
|
||||
end else if OwnerObject is TEdit then
|
||||
case Hi(WParam) of
|
||||
EN_CHANGE: LMessage.Msg := CM_TEXTCHANGED;
|
||||
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;
|
||||
WM_CREATE:
|
||||
Begin
|
||||
@ -448,6 +454,11 @@ Begin
|
||||
TWinControl(OwnerObject).InvalidateClientRectCache;
|
||||
Width := LoWord(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;
|
||||
WM_SYSKEYDOWN:
|
||||
@ -568,6 +579,9 @@ end;
|
||||
|
||||
{
|
||||
$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
|
||||
fixed GetWindowRelativePosition
|
||||
|
||||
|
@ -2126,6 +2126,7 @@ Begin
|
||||
SetProp(Window, 'Sender', @Sender);
|
||||
if DoSubClass then
|
||||
SetProp(Window, 'DefWndProc', Pointer(SetWindowLong(Window, GWL_WNDPROC, LongInt(@WindowProc))));
|
||||
SendMessage(Window, WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
end;
|
||||
End
|
||||
Else If (Sender Is TMenuItem) Then
|
||||
@ -2743,6 +2744,9 @@ End;
|
||||
|
||||
{
|
||||
$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
|
||||
fixed notebook page resize from Micha
|
||||
|
||||
|
@ -2024,6 +2024,16 @@ Begin
|
||||
Result := HideCaret(Handle)
|
||||
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
|
||||
Params: HWnd - Handle of new focus window
|
||||
@ -2363,6 +2373,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$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
|
||||
fixed GetWindowRelativePosition
|
||||
|
||||
|
@ -149,6 +149,7 @@ Function SetCapture(Value: LongInt): LongInt; Override;
|
||||
Function SetCaretPos(X, Y: Integer): Boolean; Override;
|
||||
Function SetCaretPosEx(Handle: HWnd; X, Y: Integer): 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 SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; Override;
|
||||
Function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; Override;
|
||||
@ -178,6 +179,9 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
|
||||
{ =============================================================================
|
||||
|
||||
$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
|
||||
made Size_SourceIsInterface a flag
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user