summaryrefslogtreecommitdiff
path: root/examples/apps/ide/src/frm_main.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-03-17 12:20:05 +0000
committerDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-28 00:42:48 -0700
commitec19b4e446b958d66b6e01559deedcfcbeaf6615 (patch)
treed986cbe0299eb7b76e0e80aad72837e8856acce4 /examples/apps/ide/src/frm_main.pas
parent0307ad80db4ea3bfdfa442da4d72afce2871414e (diff)
downloadfpGUI-ec19b4e446b958d66b6e01559deedcfcbeaf6615.tar.xz
ide: restore caret and scroll bar position after a file reload.
For some reason the caret isn't displayed until the arrow keys are pressed, but it is in the correct location.
Diffstat (limited to 'examples/apps/ide/src/frm_main.pas')
-rw-r--r--examples/apps/ide/src/frm_main.pas7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index f5adaec6..821bcbf0 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -684,6 +684,8 @@ var
ext: TfpgString;
pos_h: integer;
pos_v: integer;
+ cur_pos_h: integer;
+ cur_pos_v: integer;
editor: TfpgTextEdit;
begin
s := AFilename;
@@ -702,10 +704,15 @@ begin
editor := TfpgTextEdit(pcEditor.Pages[i].Components[0]);
pos_h := editor.ScrollPos_H;
pos_v := editor.ScrollPos_V;
+ cur_pos_h := editor.CaretPos_H;
+ cur_pos_v := editor.CaretPos_V;
editor.Lines.BeginUpdate;
editor.LoadFromFile(s);
editor.ScrollPos_H := pos_h;
editor.ScrollPos_V := pos_v;
+ editor.CaretPos_H := cur_pos_h;
+ editor.CaretPos_V := cur_pos_v;
+ editor.UpdateScrollBars;
editor.Lines.EndUpdate;
pcEditor.ActivePageIndex := i;
ts := pcEditor.ActivePage;