procedure TForm1.Timer1Timer(Sender: TObject);
begin
Memo1.Lines.Add('Test '+IntToStr(Random(1000)));
end;
I use Win7 64bit, tested Lazarus 1.0.14 and 1.3Trunc - same behavior.
With which widgetset do you see this behaviour? On Windows whether Scrollbars=ssVertical orthis is Linux, gtk2.
ScrollBars=ssAutoVertical the memo autoscrolls when the caret is about to disappear below the last visible memo line.
Memo1.SelStart := Length(Memo1.Lines.Text);
Listbox1.Items.Add('...');
Listbox1.ItemIndex:=Listbox1.Items.Count-1;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Memo1.Lines.Add('Test '+IntToStr(Random(1000)));
Memo1.VertScrollBar.Position:=1000;
end;
Just set the memo's scrollbars to ssAuto and add the line setting the scrollbar's vertical position to something suitably high.This was my first intention but it works not on Win7, also difference.
SendMessage(Memo1.Handle, WM_VSCROLL, SB_LINEDOWN, 0);
SendMessage(Memo1.Handle, WM_VSCROLL, SB_LINEUP, 0);
SendMessage(Memo1.Handle, WM_VSCROLL, SB_TOP, 0);
SendMessage(Memo1.Handle, WM_VSCROLL, SB_BOTTOM, 0);
SendMessage(Memo1.Handle, WM_VSCROLL, SB_PAGEDOWN, 0);
SendMessage(Memo1.Handle, WM_VSCROLL, SB_PAGEUP, 0);
...
Hm, in Windows (even in Wine emulator) it works good...With which widgetset do you see this behaviour? On Windows whether Scrollbars=ssVertical orthis is Linux, gtk2.
ScrollBars=ssAutoVertical the memo autoscrolls when the caret is about to disappear below the last visible memo line.
Hm, in Windows (even in Wine emulator) it works good...
So, seems to be widget-specific problem?
Tried all proposed solutions here, but it doesn't work...
Hm, in Windows (even in Wine emulator) it works good...
So, seems to be widget-specific problem?
Tried all proposed solutions here, but it doesn't work...
Are you saying that adding the auto scrollbars with yourmemoname.VertScrollBar.Position := 1000 following each line written to the memo doesn't work in Linux GTK-2?
procedure LogMRP(AString: String);
begin
with FormMain do begin
Refresh;
//MemoMRPLog.Append(AString);
MemoMRPLog.Lines.Add(AString);
//MemoMRPLog.ScrollBy(0, 1);
//MemoMRPLog.SelStart:=Length(FormMain.MemoMRPLog.Lines.Text);
MemoMRPLog.VertScrollBar.Position:=1000;
//MemoMRPLog.Refresh;
//Refresh;
end;
end;
{$IFDEF LINUX}
// scroll down:
Memo2.SelStart:=Length(Memo2.lines.Text);
Memo2.VertScrollBar.Position:=1000000;
{$ELSE }
{$ENDIF}
{$IFDEF LINUX}
// scroll down:
Memo2.SelStart:=Length(Memo2.lines.Text)-1;
Memo2.VertScrollBar.Position:=1000000;
{$ELSE }
{$ENDIF}