summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-10-20 23:23:38 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-10-20 23:23:38 +0200
commit86be181db8cc30700fcc13b1cec521e8fa3368bf (patch)
tree6c969280547565de3d2dfb5deac78e50ac4f661a
parentbefb9a8ecddbdb9a0c29f8dc00d35dd99dc5902d (diff)
downloadfpGUI-86be181db8cc30700fcc13b1cec521e8fa3368bf.tar.xz
Better keyboard handling in the Search tab.
Signed-off-by: Graeme Geldenhuys <graemeg@gmail.com>
-rw-r--r--src/frm_main.pas42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/frm_main.pas b/src/frm_main.pas
index 273cc3cc..c150f218 100644
--- a/src/frm_main.pas
+++ b/src/frm_main.pas
@@ -33,8 +33,8 @@ type
miFile: TfpgPopupMenu;
miSettings: TfpgPopupMenu;
miBookmarks: TfpgPopupMenu;
- miDebug: TfpgPopupMenu;
miHelp: TfpgPopupMenu;
+ miDebug: TfpgPopupMenu;
miOpenRecentMenu: TfpgPopupMenu;
btnIndex: TfpgButton;
btnGo: TfpgButton;
@@ -93,6 +93,8 @@ type
procedure btnShowIndex(Sender: TObject);
procedure btnGoClicked(Sender: TObject);
procedure tvContentsChange(Sender: TObject);
+ procedure edSearchTextKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+ procedure lbSearchResultsKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
procedure MainFormException(Sender: TObject; E: Exception);
procedure MainFormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure PageControl1Change(Sender: TObject; NewActiveSheet: TfpgTabSheet);
@@ -451,6 +453,31 @@ begin
DisplayTopic(nil);
end;
+procedure TMainForm.edSearchTextKeyPress(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if (KeyCode = keyReturn) or (KeyCode = keyPEnter) then
+ begin
+ Consumed := True;
+ btnSearch.Click;
+ end
+ else if (KeyCode = keyDown) then
+ begin
+ Consumed := True;
+ lbSearchResults.SetFocus;
+ end;
+end;
+
+procedure TMainForm.lbSearchResultsKeyPress(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if (KeyCode = keyReturn) or (KeyCode = keyPEnter) then
+ begin
+ Consumed := True;
+ DisplayTopic(nil);
+ end
+end;
+
procedure TMainForm.MainFormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
writeln('DEBUG: TMainForm.MainFormCloseQuery >>>>>');
@@ -1430,7 +1457,7 @@ begin
begin
Name := 'PageControl1';
SetPosition(0, 0, 260, 328);
- ActivePageIndex := 4;
+ ActivePageIndex := 2;
TabOrder := 0;
Align := alLeft;
OnChange := @PageControl1Change;
@@ -1697,6 +1724,7 @@ begin
TabOrder := 1;
Text := '';
FontDesc := '#Edit1';
+ OnKeyPress :=@edSearchTextKeyPress;
end;
Label2 := TfpgLabel.Create(tsSearch);
@@ -1718,6 +1746,7 @@ begin
GroupIndex := 0;
TabOrder := 3;
Text := 'This section';
+ Enabled := False;
end;
RadioButton2 := TfpgRadioButton.Create(tsSearch);
@@ -1729,6 +1758,7 @@ begin
GroupIndex := 0;
TabOrder := 4;
Text := 'Marked sections';
+ Enabled := False;
end;
RadioButton3 := TfpgRadioButton.Create(tsSearch);
@@ -1736,10 +1766,12 @@ begin
begin
Name := 'RadioButton3';
SetPosition(12, 108, 192, 20);
+ Checked := True;
FontDesc := '#Label1';
GroupIndex := 0;
TabOrder := 5;
Text := 'All sections';
+ Enabled := False;
end;
RadioButton4 := TfpgRadioButton.Create(tsSearch);
@@ -1751,6 +1783,7 @@ begin
GroupIndex := 0;
TabOrder := 6;
Text := 'Index';
+ Enabled := False;
end;
RadioButton5 := TfpgRadioButton.Create(tsSearch);
@@ -1762,6 +1795,7 @@ begin
GroupIndex := 0;
TabOrder := 7;
Text := 'Marked libraries';
+ Enabled := False;
end;
RadioButton6 := TfpgRadioButton.Create(tsSearch);
@@ -1773,6 +1807,7 @@ begin
GroupIndex := 0;
TabOrder := 8;
Text := 'All libraries';
+ Enabled := False;
end;
lbSearchResults := TfpgListBox.Create(tsSearch);
@@ -1785,7 +1820,8 @@ begin
HotTrack := False;
PopupFrame := False;
TabOrder := 9;
- OnDoubleClick := @lbSearchResultsDoubleClick;
+ OnDoubleClick := @lbSearchResultsDoubleClick;
+ OnKeyPress := @lbSearchResultsKeyPress;
end;
Label3 := TfpgLabel.Create(tsSearch);