summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-03-17 12:20:05 +0000
committerGraeme Geldenhuys <graemeg@gmail.com>2013-03-17 12:20:05 +0000
commita4e31a2c6404cf45a02ea3a481210af4fddf00fc (patch)
treea0755222fc27a78d3444c597faae42ffb12b88c6
parent08ef76a72589a985b33fd010058f74879ae4f736 (diff)
downloadfpGUI-a4e31a2c6404cf45a02ea3a481210af4fddf00fc.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.
-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;