1
0
mirror of synced 2024-11-21 19:03:50 +00:00

Fixes for MonitorForm

- Fixed text details not showing up when first activated
- Fixed #4: MaxEntries being enforced while paused, causing the view to empty
- Added translations for details panel
This commit is contained in:
Mark van Renswoude 2018-02-15 16:46:28 +01:00
parent 7fe3eb6518
commit d37d729bb1
4 changed files with 77 additions and 14 deletions

View File

@ -95,6 +95,12 @@ resourcestring
LogMonitorFormMenuWindow = 'Window'; LogMonitorFormMenuWindow = 'Window';
LogMonitorFormMenuWindowAlwaysOnTop = 'Always on top'; LogMonitorFormMenuWindowAlwaysOnTop = 'Always on top';
{ Caption of the details view headers }
LogMonitorFormMessageHeader = 'Message';
LogMonitorFormDetailHeader = 'Details';
LogMonitorFormKeyHeader = 'Key';
LogMonitorFormValueHeader = 'Value';
{ Status messages } { Status messages }
LogMonitorFormStatusPaused = 'Paused: %d log message(s) skipped'; LogMonitorFormStatusPaused = 'Paused: %d log message(s) skipped';

View File

@ -35,7 +35,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Height = 496 Height = 496
Align = alRight Align = alRight
BevelOuter = bvNone BevelOuter = bvNone
TabOrder = 0 TabOrder = 1
object tbDetails: TToolBar object tbDetails: TToolBar
Left = 0 Left = 0
Top = 0 Top = 0
@ -100,7 +100,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Left = 0 Left = 0
Top = 19 Top = 19
Width = 298 Width = 298
Height = 451 Height = 343
Align = alClient Align = alClient
BorderStyle = bsNone BorderStyle = bsNone
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
@ -112,22 +112,24 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
PlainText = True PlainText = True
ReadOnly = True ReadOnly = True
ScrollBars = ssBoth ScrollBars = ssBoth
TabOrder = 1 TabOrder = 0
Visible = False Visible = False
ExplicitHeight = 451
end end
object sbDetailsImage: TScrollBox object sbDetailsImage: TScrollBox
Left = 0 Left = 0
Top = 19 Top = 19
Width = 298 Width = 298
Height = 451 Height = 343
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Tracking = True VertScrollBar.Tracking = True
Align = alClient Align = alClient
BorderStyle = bsNone BorderStyle = bsNone
DoubleBuffered = True DoubleBuffered = True
ParentDoubleBuffered = False ParentDoubleBuffered = False
TabOrder = 2 TabOrder = 1
Visible = False Visible = False
ExplicitHeight = 451
object imgDetailsImage: TImage object imgDetailsImage: TImage
Left = 0 Left = 0
Top = 0 Top = 0
@ -140,15 +142,47 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Left = 0 Left = 0
Top = 19 Top = 19
Width = 298 Width = 298
Height = 451 Height = 343
Align = alClient Align = alClient
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goAlwaysShowEditor, goThumbTracking] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goAlwaysShowEditor, goThumbTracking]
TabOrder = 3 TabOrder = 2
OnKeyDown = vleDetailsDictionaryKeyDown OnKeyDown = vleDetailsDictionaryKeyDown
ExplicitHeight = 451
ColWidths = ( ColWidths = (
150 150
142) 142)
end end
object mmoMessage: TMemo
Left = 0
Top = 381
Width = 298
Height = 89
Align = alBottom
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 3
ExplicitLeft = -2
ExplicitTop = 440
end
object hcMessage: THeaderControl
Left = 0
Top = 362
Width = 298
Height = 19
Align = alBottom
BiDiMode = bdLeftToRight
Sections = <
item
AutoSize = True
ImageIndex = -1
Text = 'Message'
Width = 298
end>
NoSizing = True
ParentBiDiMode = False
ExplicitLeft = -2
ExplicitTop = 440
end
end end
end end
object pnlLog: TPanel object pnlLog: TPanel
@ -158,7 +192,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Height = 496 Height = 496
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
TabOrder = 1 TabOrder = 0
object vstLog: TVirtualStringTree object vstLog: TVirtualStringTree
Left = 0 Left = 0
Top = 22 Top = 22
@ -174,7 +208,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible] Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
HintMode = hmTooltip HintMode = hmTooltip
Images = ilsLog Images = ilsLog
TabOrder = 0 TabOrder = 1
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toThemeAware] TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toThemeAware]
TreeOptions.SelectionOptions = [toFullRowSelect] TreeOptions.SelectionOptions = [toFullRowSelect]
OnFocusChanged = vstLogFocusChanged OnFocusChanged = vstLogFocusChanged
@ -214,7 +248,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Images = ilsLog Images = ilsLog
List = True List = True
ShowCaptions = True ShowCaptions = True
TabOrder = 1 TabOrder = 0
OnCustomDraw = ToolbarCustomDraw OnCustomDraw = ToolbarCustomDraw
object tbPause: TToolButton object tbPause: TToolButton
Left = 0 Left = 0
@ -284,7 +318,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Left = 448 Left = 448
Top = 48 Top = 48
Bitmap = { Bitmap = {
494C01010A004000040110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C01010A004000080110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030 0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

View File

@ -100,6 +100,8 @@ type
mmMainFileSaveAs: TMenuItem; mmMainFileSaveAs: TMenuItem;
sdSaveAs: TSaveDialog; sdSaveAs: TSaveDialog;
vleDetailsDictionary: TValueListEditor; vleDetailsDictionary: TValueListEditor;
mmoMessage: TMemo;
hcMessage: THeaderControl;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
@ -360,6 +362,11 @@ begin
vstLog.Header.Columns[ColumnCategory].Text := GetLogResourceString(@LogMonitorFormColumnCategory); vstLog.Header.Columns[ColumnCategory].Text := GetLogResourceString(@LogMonitorFormColumnCategory);
vstLog.Header.Columns[ColumnMessage].Text := GetLogResourceString(@LogMonitorFormColumnMessage); vstLog.Header.Columns[ColumnMessage].Text := GetLogResourceString(@LogMonitorFormColumnMessage);
hcMessage.Sections[0].Text := GetLogResourceString(@LogMonitorFormMessageHeader);
hcDetails.Sections[0].Text := GetLogResourceString(@LogMonitorFormDetailHeader);
vleDetailsDictionary.TitleCaptions[0] := GetLogResourceString(@LogMonitorFormKeyHeader);
vleDetailsDictionary.TitleCaptions[1] := GetLogResourceString(@LogMonitorFormValueHeader);
mmMainFile.Caption := GetLogResourceString(@LogMonitorFormMenuFile); mmMainFile.Caption := GetLogResourceString(@LogMonitorFormMenuFile);
mmMainLog.Caption := GetLogResourceString(@LogMonitorFormMenuLog); mmMainLog.Caption := GetLogResourceString(@LogMonitorFormMenuLog);
mmMainDetails.Caption := GetLogResourceString(@LogMonitorFormMenuDetails); mmMainDetails.Caption := GetLogResourceString(@LogMonitorFormMenuDetails);
@ -505,8 +512,11 @@ begin
vstLog.IsVisible[node] := (not Paused) and (ALevel in VisibleLevels); vstLog.IsVisible[node] := (not Paused) and (ALevel in VisibleLevels);
if not paused then
begin
while vstLog.RootNodeCount > MaxEntries do while vstLog.RootNodeCount > MaxEntries do
vstLog.DeleteNode(vstLog.GetFirst); vstLog.DeleteNode(vstLog.GetFirst);
end;
finally finally
vstLog.EndUpdate; vstLog.EndUpdate;
end; end;
@ -620,9 +630,12 @@ begin
else if Supports(ADetails, IX2LogDetailsText, logDetailsText) then else if Supports(ADetails, IX2LogDetailsText, logDetailsText) then
begin begin
reDetails.Text := logDetailsText.AsString;
canWrap := True; canWrap := True;
SetVisibleDetails(reDetails); SetVisibleDetails(reDetails);
// Must be set after Visible = True, because the Text will get lost
// as soon as the handle is allocated.
reDetails.Text := logDetailsText.AsString;
end; end;
end else end else
SetVisibleDetails(nil); SetVisibleDetails(nil);
@ -900,9 +913,14 @@ begin
if Assigned(Node) then if Assigned(Node) then
begin begin
nodeData := Sender.GetNodeData(Node); nodeData := Sender.GetNodeData(Node);
mmoMessage.Text := nodeData^.Message;
SetDetails(nodeData^.Details); SetDetails(nodeData^.Details);
end else end else
begin
mmoMessage.Clear;
SetDetails(nil); SetDetails(nil);
end;
UpdateUI; UpdateUI;
end; end;

View File

@ -38,6 +38,11 @@ begin
SetLogResourceString(@LogMonitorFormMenuWindow, 'Venster'); SetLogResourceString(@LogMonitorFormMenuWindow, 'Venster');
SetLogResourceString(@LogMonitorFormMenuWindowAlwaysOnTop, 'Altijd op voorgrond'); SetLogResourceString(@LogMonitorFormMenuWindowAlwaysOnTop, 'Altijd op voorgrond');
SetLogResourceString(@LogMonitorFormMessageHeader, 'Melding');
SetLogResourceString(@LogMonitorFormDetailHeader, 'Details');
SetLogResourceString(@LogMonitorFormKeyHeader, 'Naam');
SetLogResourceString(@LogMonitorFormValueHeader, 'Waarde');
SetLogResourceString(@LogMonitorFormStatusPaused, 'Gepauzeerd: %d melding(en) overgeslagen'); SetLogResourceString(@LogMonitorFormStatusPaused, 'Gepauzeerd: %d melding(en) overgeslagen');
SetLogResourceString(@LogMonitorFormSaveDetailsFilter, 'Alle bestanden (*.*)|*.*'); SetLogResourceString(@LogMonitorFormSaveDetailsFilter, 'Alle bestanden (*.*)|*.*');