summaryrefslogtreecommitdiff
path: root/examples/apps/ide
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-12 16:06:08 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-12 16:06:08 +0000
commit78ce243ce4772556b2c13b63d4cfe3c02efb2663 (patch)
tree650d70c22546125319905ce7797607ea67f1bd52 /examples/apps/ide
parent46da80e11125fea2c05c783609c41fe13caa7441 (diff)
downloadfpGUI-78ce243ce4772556b2c13b63d4cfe3c02efb2663.tar.xz
ide: After reloading a unit, restore the previous scroll position.
This needs some more improvement, by also restoring the edit cursor position. But for this, the fpg_textedit needs to be improved first.
Diffstat (limited to 'examples/apps/ide')
-rw-r--r--examples/apps/ide/src/frm_main.pas14
1 files changed, 11 insertions, 3 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index d0b87fa6..37875f86 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -605,6 +605,9 @@ var
ts: TfpgTabSheet;
m: TfpgTextEdit;
ext: TfpgString;
+ pos_h: integer;
+ pos_v: integer;
+ editor: TfpgTextEdit;
begin
s := AFilename;
f := fpgExtractFileName(s);
@@ -619,9 +622,14 @@ begin
if found then
begin
// reuse existing tab
- TfpgTextEdit(pcEditor.Pages[i].Components[0]).Lines.BeginUpdate;
- TfpgTextEdit(pcEditor.Pages[i].Components[0]).LoadFromFile(s);
- TfpgTextEdit(pcEditor.Pages[i].Components[0]).Lines.EndUpdate;
+ editor := TfpgTextEdit(pcEditor.Pages[i].Components[0]);
+ pos_h := editor.ScrollPos_H;
+ pos_v := editor.ScrollPos_V;
+ editor.Lines.BeginUpdate;
+ editor.LoadFromFile(s);
+ editor.ScrollPos_H := pos_h;
+ editor.ScrollPos_V := pos_v;
+ editor.Lines.EndUpdate;
pcEditor.ActivePageIndex := i;
ts := pcEditor.ActivePage;
AddMessage('File reloaded: ' + s);