mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 10:18:05 +02:00
fixed navigation key handling for TButton
git-svn-id: trunk@6816 -
This commit is contained in:
parent
7d8b514be9
commit
39df5fbcac
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1681,6 +1681,8 @@ lcl/tests/test1_3label.lpi svneol=native#text/plain
|
||||
lcl/tests/test1_3label.lpr svneol=native#text/pascal
|
||||
lcl/tests/test1_4edit.lpi svneol=native#text/plain
|
||||
lcl/tests/test1_4edit.lpr svneol=native#text/pascal
|
||||
lcl/tests/test2_1buttonnavigation.lpi svneol=native#text/plain
|
||||
lcl/tests/test2_1buttonnavigation.lpr svneol=native#text/pascal
|
||||
lcl/textstrings.pas svneol=native#text/pascal
|
||||
lcl/toolwin.pp svneol=native#text/pascal
|
||||
lcl/utrace.pp svneol=native#text/pascal
|
||||
|
@ -1145,7 +1145,14 @@ end;
|
||||
|
||||
procedure TApplication.ControlKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
AControl: TWinControl;
|
||||
begin
|
||||
if Sender is TWinControl then begin
|
||||
AControl:=TWinControl(Sender);
|
||||
if AControl=nil then ;
|
||||
//debugln('TApplication.ControlKeyDown A ',DbgSName(AControl));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TApplication.ControlKeyUp(Sender: TObject; var Key: Word;
|
||||
@ -1156,7 +1163,7 @@ var
|
||||
begin
|
||||
if Sender is TWinControl then begin
|
||||
AControl:=TWinControl(Sender);
|
||||
//debugln('TApplication.ControlKeyUp A ',Acontrol.Name);
|
||||
//debugln('TApplication.ControlKeyUp A ',DbgSName(AControl));
|
||||
|
||||
// handle tab keys
|
||||
if (Key=VK_Tab) and ((Shift-[ssShift])=[])
|
||||
@ -1383,6 +1390,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.101 2005/02/19 22:48:23 mattias
|
||||
fixed navigation key handling for TButton
|
||||
|
||||
Revision 1.100 2005/02/19 21:54:08 mattias
|
||||
moved LCL navigation key handling to key up, so that interface has the chance to handle keys
|
||||
|
||||
|
@ -73,11 +73,11 @@ procedure TCustomButton.ControlKeyUp(var Key: Word; Shift: TShiftState
|
||||
begin
|
||||
if (Key=VK_RETURN) and (Shift=[]) then begin
|
||||
// the interface didn't handle it.
|
||||
debugln('TCustomButton.ControlKeyUp User pressed Return on ',DbgSName(Self),' and interface did not handle it');
|
||||
//debugln('TCustomButton.ControlKeyUp User pressed Return on ',DbgSName(Self),' and interface did not handle it');
|
||||
Key:=VK_UNKNOWN;
|
||||
Click;
|
||||
end else
|
||||
inherited KeyDownAfterInterface(Key, Shift);
|
||||
inherited ControlKeyUp(Key, Shift);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -236,6 +236,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.40 2005/02/19 22:48:23 mattias
|
||||
fixed navigation key handling for TButton
|
||||
|
||||
Revision 1.39 2005/02/19 21:54:08 mattias
|
||||
moved LCL navigation key handling to key up, so that interface has the chance to handle keys
|
||||
|
||||
|
@ -2378,12 +2378,13 @@ end;
|
||||
|
||||
procedure TWinControl.KeyUpBeforeInterface(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
//debugln('TWinControl.KeyUpBeforeInterface ',DbgSName(Self));
|
||||
KeyUp(Key,Shift);
|
||||
end;
|
||||
|
||||
procedure TWinControl.KeyUpAfterInterface(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
|
||||
//debugln('TWinControl.KeyUpAfterInterface ',DbgSName(Self));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2621,6 +2622,7 @@ function TWinControl.DoRemainingKeyUp(var Message: TLMKeyDown): Boolean;
|
||||
var
|
||||
ShiftState: TShiftState;
|
||||
begin
|
||||
//debugln('TWinControl.DoRemainingKeyUp ',DbgSName(Self));
|
||||
Result:=true;
|
||||
|
||||
ShiftState := KeyDataToShiftState(Message.KeyData);
|
||||
@ -2722,6 +2724,7 @@ end;
|
||||
|
||||
procedure TWinControl.ControlKeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
//debugln('TWinControl.ControlKeyUp ',DbgSName(Self));
|
||||
Application.ControlKeyUp(Self,Key,Shift);
|
||||
end;
|
||||
|
||||
@ -3679,6 +3682,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.WMSysKeyUp(var Message: TLMKeyUp);
|
||||
begin
|
||||
debugln('TWinControl.WMSysKeyUp ',DbgSName(Self));
|
||||
DoRemainingKeyUp(Message);
|
||||
end;
|
||||
|
||||
@ -3690,7 +3694,8 @@ end;
|
||||
event handler.
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TWinControl.WMKeyUp(Var Message: TLMKeyUp);
|
||||
Begin
|
||||
begin
|
||||
//debugln('TWinControl.WMKeyUp ',DbgSName(Self));
|
||||
DoRemainingKeyUp(Message);
|
||||
end;
|
||||
|
||||
@ -4488,6 +4493,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.314 2005/02/19 22:48:23 mattias
|
||||
fixed navigation key handling for TButton
|
||||
|
||||
Revision 1.313 2005/02/19 21:54:08 mattias
|
||||
moved LCL navigation key handling to key up, so that interface has the chance to handle keys
|
||||
|
||||
|
@ -63,28 +63,28 @@ end;
|
||||
function GTK2KeyDown(Widget: PGtkWidget; Event : pgdkeventkey;
|
||||
Data: gPointer) : GBoolean; cdecl;
|
||||
begin
|
||||
debugln('GTK2KeyDown ',DbgSName(TObject(Data)));
|
||||
//debugln('GTK2KeyDown ',DbgSName(TObject(Data)));
|
||||
Result := HandleGtkKeyUpDown(Widget, Event, Data, True);
|
||||
end;
|
||||
|
||||
function GTK2KeyDownAfter(Widget: PGtkWidget; Event : pgdkeventkey;
|
||||
Data: gPointer) : GBoolean; cdecl;
|
||||
begin
|
||||
debugln('GTK2KeyDownAfter ',DbgSName(TObject(Data)));
|
||||
//debugln('GTK2KeyDownAfter ',DbgSName(TObject(Data)));
|
||||
Result := HandleGtkKeyUpDown(Widget, Event, Data, False);
|
||||
end;
|
||||
|
||||
function GTK2KeyUp(Widget: PGtkWidget; Event : pgdkeventkey;
|
||||
Data: gPointer) : GBoolean; cdecl;
|
||||
begin
|
||||
debugln('GTK2KeyUp ',DbgSName(TObject(Data)));
|
||||
//debugln('GTK2KeyUp ',DbgSName(TObject(Data)));
|
||||
Result := HandleGtkKeyUpDown(Widget, Event, Data, True);
|
||||
end;
|
||||
|
||||
function GTK2KeyUpAfter(Widget: PGtkWidget; Event : pgdkeventkey;
|
||||
Data: gPointer) : GBoolean; cdecl;
|
||||
begin
|
||||
debugln('GTK2KeyUpAfter ',DbgSName(TObject(Data)));
|
||||
//debugln('GTK2KeyUpAfter ',DbgSName(TObject(Data)));
|
||||
Result := HandleGtkKeyUpDown(Widget, Event, Data, False);
|
||||
end;
|
||||
|
||||
@ -1521,6 +1521,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.27 2005/02/19 22:48:23 mattias
|
||||
fixed navigation key handling for TButton
|
||||
|
||||
Revision 1.26 2005/02/19 21:54:08 mattias
|
||||
moved LCL navigation key handling to key up, so that interface has the chance to handle keys
|
||||
|
||||
|
@ -16,14 +16,14 @@
|
||||
</General>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<CursorPos X="23" Y="29"/>
|
||||
<CursorPos X="13" Y="18"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="test1_2button.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<TopLine Value="1"/>
|
||||
<UnitName Value="test1_2button"/>
|
||||
<UsageCount Value="40"/>
|
||||
<UsageCount Value="41"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
<PublishOptions>
|
||||
|
@ -9,19 +9,19 @@
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="3"/>
|
||||
<ActiveEditorIndexAtStart Value="2"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="test1_4edit"/>
|
||||
</General>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<CursorPos X="10" Y="36"/>
|
||||
<CursorPos X="11" Y="119"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="test1_4edit.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<TopLine Value="8"/>
|
||||
<TopLine Value="101"/>
|
||||
<UnitName Value="test1_4edit"/>
|
||||
<UsageCount Value="39"/>
|
||||
</Unit0>
|
||||
|
@ -32,6 +32,7 @@ type
|
||||
Edit1: TEdit;
|
||||
procedure Edit1ChangeBounds(Sender: TObject);
|
||||
procedure Edit1Click(Sender: TObject);
|
||||
procedure Edit1EditingDone(Sender: TObject);
|
||||
procedure Edit1Enter(Sender: TObject);
|
||||
procedure Edit1Exit(Sender: TObject);
|
||||
procedure Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
|
||||
@ -97,6 +98,11 @@ begin
|
||||
debugln('TForm1.Edit1Click ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Edit1EditingDone(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Edit1EditingDone ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Edit1Enter(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Edit1Enter ',DbgSName(Sender));
|
||||
@ -200,6 +206,7 @@ begin
|
||||
Parent:=Self;
|
||||
OnChangeBounds:=@Edit1ChangeBounds;
|
||||
OnClick:=@Edit1Click;
|
||||
OnEditingDone:=@Edit1EditingDone;
|
||||
OnEnter:=@Edit1Enter;
|
||||
OnExit:=@Edit1Exit;
|
||||
OnKeyDown:=@Edit1KeyDown;
|
||||
|
65
lcl/tests/test2_1buttonnavigation.lpi
Normal file
65
lcl/tests/test2_1buttonnavigation.lpi
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<ActiveEditorIndexAtStart Value="5"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="test2_1buttonnavigation"/>
|
||||
</General>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<CursorPos X="14" Y="32"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<Filename Value="test2_1buttonnavigation.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<Loaded Value="True"/>
|
||||
<TopLine Value="1"/>
|
||||
<UnitName Value="test2_1buttonnavigation"/>
|
||||
<UsageCount Value="42"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="4"/>
|
||||
<SearchPaths>
|
||||
<LCLWidgetType Value="gtk2"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
378
lcl/tests/test2_1buttonnavigation.lpr
Normal file
378
lcl/tests/test2_1buttonnavigation.lpr
Normal file
@ -0,0 +1,378 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
LCL Test 2_1
|
||||
|
||||
Showing a form at 0,0,320,240 with a four buttons
|
||||
}
|
||||
program test2_1buttonnavigation;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces, FPCAdds, LCLProc, LCLType, Classes, Controls, Forms, TypInfo,
|
||||
LMessages, Buttons;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2Ok: TButton;
|
||||
Button3: TButton;
|
||||
Button4Cancel: TButton;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button1Enter(Sender: TObject);
|
||||
procedure Button1Exit(Sender: TObject);
|
||||
procedure Button1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
|
||||
);
|
||||
procedure Button1KeyPress(Sender: TObject; var Key: char);
|
||||
procedure Button1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Button1MouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Button1MouseEnter(Sender: TObject);
|
||||
procedure Button1MouseLeave(Sender: TObject);
|
||||
procedure Button1MouseUp(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Form1Activate(Sender: TObject);
|
||||
procedure Form1Click(Sender: TObject);
|
||||
procedure Form1Close(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure Form1CloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure Form1Create(Sender: TObject);
|
||||
procedure Form1Deactivate(Sender: TObject);
|
||||
procedure Form1Enter(Sender: TObject);
|
||||
procedure Form1Exit(Sender: TObject);
|
||||
function Form1Help(Command: Word; Data: Longint; var CallHelp: Boolean
|
||||
): Boolean;
|
||||
procedure Form1Hide(Sender: TObject);
|
||||
procedure Form1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Form1KeyPress(Sender: TObject; var Key: char);
|
||||
procedure Form1MouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Form1MouseEnter(Sender: TObject);
|
||||
procedure Form1MouseLeave(Sender: TObject);
|
||||
procedure Form1MouseUp(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Form1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Form1MouseWheelDown(Sender: TObject; Shift: TShiftState;
|
||||
MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Form1MouseWheelUp(Sender: TObject; Shift: TShiftState;
|
||||
MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Form1Paint(Sender: TObject);
|
||||
procedure Form1Shortcut(var Msg: TLMKey; var Handled: Boolean);
|
||||
procedure Form1Show(Sender: TObject);
|
||||
procedure Form1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
procedure Form1WindowStateChanged(Sender: TObject);
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Button1Click ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Enter(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Button1Enter ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Exit(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Button1Exit ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
Debugln('TForm1.Button1KeyDown ',DbgSName(Sender),' Key=',dbgs(Key),
|
||||
' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1KeyPress(Sender: TObject; var Key: char);
|
||||
begin
|
||||
debugln('TForm1.Button1KeyPress ',DbgSName(Sender),' Key=',DbgStr(Key));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
|
||||
);
|
||||
begin
|
||||
Debugln('TForm1.Button1KeyUp ',DbgSName(Sender),' Key=',dbgs(Key),
|
||||
' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1MouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
debugln('TForm1.Button1MouseDown ',DbgSName(Sender),
|
||||
' Button=',GetEnumName(TypeInfo(TMouseButton),ord(Button)),
|
||||
' X=',dbgs(X),' Y=',dbgs(Y),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1MouseEnter(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Button1MouseEnter ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1MouseLeave(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Button1MouseLeave ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1MouseUp(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
debugln('TForm1.Button1MouseUp ',DbgSName(Sender),
|
||||
' Button=',GetEnumName(TypeInfo(TMouseButton),ord(Button)),
|
||||
' X=',dbgs(X),' Y=',dbgs(Y),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Activate(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Activate ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Click(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Click ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Close(Sender: TObject; var CloseAction: TCloseAction);
|
||||
begin
|
||||
debugln('TForm1.Form1Close ',DbgSName(Sender),' CloseAction=',
|
||||
GetEnumName(TypeInfo(TCloseAction),ord(CloseAction)));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1CloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
begin
|
||||
debugln('TForm1.Form1CloseQuery ',DbgSName(Sender),' CanClose',dbgs(CanClose));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Create(Sender: TObject);
|
||||
|
||||
procedure SetButtonEvents(AButton: TButton);
|
||||
begin
|
||||
with AButton do begin
|
||||
OnClick:=@Button1Click;
|
||||
OnEnter:=@Button1Enter;
|
||||
OnExit:=@Button1Exit;
|
||||
OnKeyDown:=@Button1KeyDown;
|
||||
OnKeyPress:=@Button1KeyPress;
|
||||
OnKeyUp:=@Button1KeyUp;
|
||||
OnMouseDown:=@Button1MouseDown;
|
||||
OnMouseEnter:=@Button1MouseEnter;
|
||||
OnMouseLeave:=@Button1MouseLeave;
|
||||
OnMouseUp:=@Button1MouseUp;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
debugln('TForm1.Form1Create ',DbgSName(Sender));
|
||||
|
||||
Button1:=TButton.Create(Self);
|
||||
with Button1 do begin
|
||||
Name:='Button1';
|
||||
SetBounds(10,30,175,25);
|
||||
Parent:=Self;
|
||||
end;
|
||||
SetButtonEvents(Button1);
|
||||
|
||||
Button2Ok:=TButton.Create(Self);
|
||||
with Button2Ok do begin
|
||||
Name:='Button2Ok';
|
||||
SetBounds(10,80,175,25);
|
||||
Parent:=Self;
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
SetButtonEvents(Button2Ok);
|
||||
|
||||
Button3:=TButton.Create(Self);
|
||||
with Button3 do begin
|
||||
Name:='Button3';
|
||||
SetBounds(10,130,175,25);
|
||||
Parent:=Self;
|
||||
end;
|
||||
SetButtonEvents(Button3);
|
||||
|
||||
Button4Cancel:=TButton.Create(Self);
|
||||
with Button4Cancel do begin
|
||||
Name:='Button4Cancel';
|
||||
SetBounds(10,180,175,25);
|
||||
Parent:=Self;
|
||||
ModalResult:=mrCancel;
|
||||
Cancel:=true;
|
||||
end;
|
||||
SetButtonEvents(Button4Cancel);
|
||||
|
||||
debugln('CancelControl=',DbgSName(CancelControl));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Deactivate(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Deactivate ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Enter(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Enter ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Exit(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Exit ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
function TForm1.Form1Help(Command: Word; Data: Longint; var CallHelp: Boolean
|
||||
): Boolean;
|
||||
begin
|
||||
debugln('TForm1.Form1Help Command=',dbgs(Command),' Data=',HexStr(Cardinal(Data),8),' CallHelp=',dbgs(CallHelp));
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Hide(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Hide ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
|
||||
);
|
||||
begin
|
||||
Debugln('TForm1.Form1KeyDown ',DbgSName(Sender),' Key=',dbgs(Key),
|
||||
' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1KeyPress(Sender: TObject; var Key: char);
|
||||
begin
|
||||
debugln('TForm1.Form1KeyPress ',DbgSName(Sender),' Key=',DbgStr(Key));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseDown ',DbgSName(Sender),
|
||||
' Button=',GetEnumName(TypeInfo(TMouseButton),ord(Button)),
|
||||
' X=',dbgs(X),' Y=',dbgs(Y),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseEnter(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseEnter ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseLeave(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseLeave ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseUp(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseUp ',DbgSName(Sender),
|
||||
' Button=',GetEnumName(TypeInfo(TMouseButton),ord(Button)),
|
||||
' X=',dbgs(X),' Y=',dbgs(Y),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseWheel ',DbgSName(Sender),
|
||||
' WheelDelta=',dbgs(WheelDelta),' MousePos=',dbgs(MousePos),
|
||||
' Handled=',dbgs(Handled),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseWheelDown(Sender: TObject; Shift: TShiftState;
|
||||
MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseWheelDown ',DbgSName(Sender),
|
||||
' MousePos=',dbgs(MousePos),
|
||||
' Handled=',dbgs(Handled),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1MouseWheelUp(Sender: TObject; Shift: TShiftState;
|
||||
MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
debugln('TForm1.Form1MouseWheelUp ',DbgSName(Sender),
|
||||
' MousePos=',dbgs(MousePos),
|
||||
' Handled=',dbgs(Handled),' Shift=',dbgs(Shift));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Paint(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Paint ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Shortcut(var Msg: TLMKey; var Handled: Boolean);
|
||||
begin
|
||||
debugln('TForm1.Form1Shortcut Msg.CharCode=',dbgs(Msg.CharCode),
|
||||
' Handled=',dbgs(Handled));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Show(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1Show ',DbgSName(Sender));
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
begin
|
||||
debugln('TForm1.Form1UTF8KeyPress ',DbgSName(Sender),' UTF8Key="',DbgStr(UTF8Key),'"');
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1WindowStateChanged(Sender: TObject);
|
||||
begin
|
||||
debugln('TForm1.Form1WindowStateChanged ',DbgSName(Sender),
|
||||
' State=',GetEnumName(TypeInfo(TWindowState),ord(WindowState)));
|
||||
end;
|
||||
|
||||
constructor TForm1.Create(TheOwner: TComponent);
|
||||
begin
|
||||
OnActivate:=@Form1Activate;
|
||||
OnClick:=@Form1Click;
|
||||
OnClose:=@Form1Close;
|
||||
OnCloseQuery:=@Form1CloseQuery;
|
||||
OnCreate:=@Form1Create;
|
||||
OnDeactivate:=@Form1Deactivate;
|
||||
OnEnter:=@Form1Enter;
|
||||
OnExit:=@Form1Exit;
|
||||
OnHelp:=@Form1Help;
|
||||
OnHide:=@Form1Hide;
|
||||
OnKeyDown:=@Form1KeyDown;
|
||||
OnKeyDown:=@Form1KeyDown;
|
||||
OnKeyPress:=@Form1KeyPress;
|
||||
OnMouseDown:=@Form1MouseDown;
|
||||
OnMouseEnter:=@Form1MouseEnter;
|
||||
OnMouseLeave:=@Form1MouseLeave;
|
||||
OnMouseUp:=@Form1MouseUp;
|
||||
OnMouseWheel:=@Form1MouseWheel;
|
||||
OnMouseWheelDown:=@Form1MouseWheelDown;
|
||||
OnMouseWheelUp:=@Form1MouseWheelUp;
|
||||
OnPaint:=@Form1Paint;
|
||||
OnShortcut:=@Form1Shortcut;
|
||||
OnShow:=@Form1Show;
|
||||
OnUTF8KeyPress:=@Form1UTF8KeyPress;
|
||||
OnWindowStateChanged:=@Form1WindowStateChanged;
|
||||
inherited Create(TheOwner);
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1,Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user