focus code fixes

This commit is contained in:
April Ayres-Griffiths 2019-04-14 11:02:46 +10:00
parent fa7b52b927
commit e1e3b01f96
10 changed files with 53 additions and 20 deletions

View File

@ -5483,6 +5483,7 @@ object GUIForm: TGUIForm
Height = 23
Top = 8
Width = 80
OnKeyPress = txtAddressKeyPress
TabStop = False
TabOrder = 1
Text = '$0400'

View File

@ -488,6 +488,7 @@ type
procedure ToolTimerTimer(Sender: TObject);
procedure tbMasterVolumeChange(Sender: TObject);
procedure TrackBar2Change(Sender: TObject);
procedure txtAddressKeyPress(Sender: TObject; var Key: char);
procedure txtValueKeyPress(Sender: TObject; var Key: char);
procedure UpdateRenderMode;
procedure UnFreeze;
@ -527,6 +528,7 @@ type
procedure UpdateRecordState;
function IsMouseBtnDown(const AMouseBtn: TMouseBtnType): Boolean;
function IsMouseBtnDown: Boolean;
function IsMicroM8Active: boolean;
private
lx, ly, lw, lh: integer;
lastShowTime: TDateTime;
@ -537,6 +539,7 @@ type
inPopup: boolean;
isFS: boolean;
disableFocusStealing: boolean;
guiActive: boolean;
public
procedure AppActivate(Sender: TObject);
procedure AppDeactivate(Sender: TObject);
@ -617,8 +620,17 @@ begin
Application.OnActivate:=@AppActivate;
end;
function TGUIForm.IsMicroM8Active: boolean;
begin
result := false;
if guiActive then
exit;
result := GetTitleOfActiveWindow = 'microM8';
end;
procedure TGUIForm.AppActivate(Sender: TObject);
begin
guiActive := true;
//StatusBar1.SimpleText := 'App has gained focus!';
if MillisecondsBetween(Now(), lastHideTime) < 1000 then
exit;
@ -628,6 +640,7 @@ end;
procedure TGUIForm.AppDeactivate(Sender: TObject);
begin
guiActive := false;
// if we have deactivated because of a click on the main window
// then sort it...
@ -635,7 +648,7 @@ begin
exit;
RepaintWindow;
if GetTitleOfActiveWindow <> 'microM8' then
if not IsMicroM8Active then
HideM8
else
begin
@ -1986,6 +1999,14 @@ begin
end;
end;
procedure TGUIForm.txtAddressKeyPress(Sender: TObject; var Key: char);
begin
if Key = #13 then
begin
btnReadClick(sender);
end;
end;
procedure TGUIForm.txtValueKeyPress(Sender: TObject; var Key: char);
begin
if Key = #13 then
@ -2429,7 +2450,7 @@ begin
exit;
//if hidden then
// exit;
if GetTitleOfActiveWindow = 'microM8' then
if IsMicroM8Active then
begin
{$IFDEF WINDOWS}

View File

@ -34,7 +34,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="4">
<Units Count="3">
<Unit0>
<Filename Value="poc.lpr"/>
<IsPartOfProject Value="True"/>
@ -53,13 +53,6 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit2>
<Unit3>
<Filename Value="images\memory.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="memform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit3>
</Units>
</ProjectOptions>
<CompilerOptions>
@ -70,7 +63,6 @@
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="images"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>

View File

@ -21,8 +21,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="1990"/>
<CursorPos X="29" Y="1994"/>
<TopLine Value="541"/>
<CursorPos X="24" Y="551"/>
<UsageCount Value="323"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -55,7 +55,6 @@
</Unit4>
<Unit5>
<Filename Value="images\memory.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="memform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10434,7 +10434,7 @@ object GUIForm: TGUIForm
end
object CheckTimer: TTimer
Enabled = False
Interval = 250
Interval = 125
OnTimer = CheckTimerTimer
left = 168
top = 104

View File

@ -528,6 +528,7 @@ type
procedure UpdateRecordState;
function IsMouseBtnDown(const AMouseBtn: TMouseBtnType): Boolean;
function IsMouseBtnDown: Boolean;
function IsMicroM8Active: boolean;
private
lx, ly, lw, lh: integer;
lastShowTime: TDateTime;
@ -538,6 +539,7 @@ type
inPopup: boolean;
isFS: boolean;
disableFocusStealing: boolean;
guiActive: boolean;
public
procedure AppActivate(Sender: TObject);
procedure AppDeactivate(Sender: TObject);
@ -618,8 +620,17 @@ begin
Application.OnActivate:=@AppActivate;
end;
function TGUIForm.IsMicroM8Active: boolean;
begin
result := false;
if guiActive then
exit;
result := GetTitleOfActiveWindow = 'microM8';
end;
procedure TGUIForm.AppActivate(Sender: TObject);
begin
guiActive := true;
//StatusBar1.SimpleText := 'App has gained focus!';
if MillisecondsBetween(Now(), lastHideTime) < 1000 then
exit;
@ -629,6 +640,7 @@ end;
procedure TGUIForm.AppDeactivate(Sender: TObject);
begin
guiActive := false;
// if we have deactivated because of a click on the main window
// then sort it...
@ -636,7 +648,7 @@ begin
exit;
RepaintWindow;
if GetTitleOfActiveWindow <> 'microM8' then
if not IsMicroM8Active then
HideM8
else
begin
@ -2438,7 +2450,7 @@ begin
exit;
//if hidden then
// exit;
if GetTitleOfActiveWindow = 'microM8' then
if IsMicroM8Active then
begin
{$IFDEF WINDOWS}

14
poc.lps
View File

@ -21,8 +21,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="541"/>
<CursorPos X="24" Y="551"/>
<TopLine Value="2441"/>
<CursorPos X="3" Y="2443"/>
<UsageCount Value="323"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -64,7 +64,7 @@
<UsageCount Value="24"/>
</Unit5>
</Units>
<JumpHistory Count="22" HistoryIndex="21">
<JumpHistory Count="24" HistoryIndex="23">
<Position1>
<Filename Value="main.pas"/>
<Caret Line="540" Column="30" TopLine="520"/>
@ -153,6 +153,14 @@
<Filename Value="main.pas"/>
<Caret Line="1999" Column="28" TopLine="1995"/>
</Position22>
<Position23>
<Filename Value="main.pas"/>
<Caret Line="531" Column="15" TopLine="664"/>
</Position23>
<Position24>
<Filename Value="main.pas"/>
<Caret Line="2472" Column="33" TopLine="2480"/>
</Position24>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>