Forum > FV/Textmode IDE

TMemo gives stranges black area when using scrollbars

(1/1)

rolandvh:
Hi,

I'm using free vision and I'm using a TMemo in a dialog window. I give the memo 2 scrollbars and a indicator as you can see in the code below:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---// Menu Discription    R.Assign(3, 14, 48, 15);    MemoHScrollBar := New(PScrollbar, Init(R));    R.Assign(50, 7, 51, 14);    MemoVScrollBar := New(PScrollbar, Init(R));    Insert(MemoHScrollBar);    Insert(MemoVScrollBar);    R.Assign(48, 14, 51, 15);    MemoIndicator := New(PIndicator, Init(R));    Insert(MemoIndicator);    R.Assign(3,7,50,14);    PMemoMenuDescription:=New(PMemo,Init(R, MemoHScrollBar, MemoVScrollBar, MemoIndicator, 10000));    PMemoMenuDescription^.Limit.X := 70;    PMemoMenuDescription^.Limit.Y := 40;    Insert(PMemoMenuDescription);    R.Assign(3,6,32,7);    Insert(New(PLabel, Init(R,'~D~iscription menu ', PMemoMenuDescription))); When I type in the memo field and I get past the width of the field I get a strange black box and characters are repeated. Often I also get an error message after I close the application when this happens.  Error code 216 (general protection fault). I just can't see what I'm doing wrong. See the attachment.
This happens under windows 10 and linux
Thanks for any replies.


rolandvh:
To make it all a little simpler to test I made a simple program. Could it be a bug in TMemo?


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program errormemo;uses App, Menus, dialogs, drivers, views, objects, editors;type   TMyApp = OBJECT(TApplication)        constructor init;        procedure HandleEvent(var aEvent : TEvent); virtual;        procedure MakeMemoDialog;        procedure InitMenuBar; virtual;   end;  var        MyApp: TMyApp;const cmMemoDialog = 1000; constructor TMyApp.init;begin        inherited init;end; procedure TMyApp.InitMenuBar;var R : TRect;begin       GetExtent(R);        R.B.Y := R.A.Y + 1;        MenuBar := New(PMenubar, Init(R, NewMenu(NewSubMenu('~M~emo test',  hcNoContext,                                                 NewMenu(                                                 NewItem('Test', 'F2', kbF2, cmMemoDialog, hcNoContext, nil)),nil))));end; procedure TMyApp.HandleEvent(var aEvent : TEvent);begin        inherited HandleEvent(aEvent);        if aEvent.What = evCommand then begin          case aEvent.Command of            cmMemoDialog:            begin                MakeMemoDialog;            end            else            begin                Exit;            end;          end;    end;    ClearEvent(aEvent); end; procedure TMyApp.MakeMemoDialog;var    D: PDialog;    R: TRect;    rs: word;    aVScrollBar : PScrollBar;    aHScrollBar : PScrollBar;    aIndicator : PIndicator;    aMemo : PMemo;begin    GetExtent(R);    R.A.X := R.A.X + 4;    R.A.Y := R.A.Y + 1;    R.B.X := R.B.X - 4;    R.B.Y := R.B.Y - 4;    D := New(PDialog, Init(R, 'Test memo'));     R.A.X := 3;    R.A.Y := 10;    R.B.X := 60;    R.B.Y := 11;    aHScrollBar := New(PScrollbar, Init(R));    D^.Insert(aHScrollBar);     R.A.X := 60;    R.A.Y := 3;    R.B.X := 61;    R.B.Y := 10;    aVScrollBar := New(PScrollBar, Init(R));    D^.Insert(aVScrollBar);     R.A.X := 61;    R.A.Y := 7;    R.B.X := 64;    R.B.Y := 8;    aIndicator := New(PIndicator, Init(R));    D^.Insert(aIndicator);     R.A.X := 3;    R.A.Y := 3;    R.B.X := 60;    R.B.Y := 10;    aMemo := New(PMemo, Init(R, aHScrollBar, aVScrollBar, aIndicator, 10000));    aMemo^.Limit.X := 70;    aMemo^.Limit.Y := 40;    D^.Insert(aMemo);      rs := Desktop^.ExecView(D);    Dispose(D, Done); end; begin  MyApp.Init;  MyApp.Run;  MyApp.Done;end. 

TRon:
Hi rolandvh,

please be so kind to edit your first two posts and enclose your code with code tags, see: https://wiki.freepascal.org/Forum#Use_code_tags

edit: thank you   :)

edit2: and i am able to confirm (not that i have any knowledge code-wise on fv)

rolandvh:
Thank you for your reply.  Could be a bug then. Would be nice if someone could confirm this with the right knowledge of fv. But maybe I should report it in the bugtracker anyway.

Navigation

[0] Message Index

Go to full version