trichview.support
Re: changing size in response to onChange |
Author |
Message |
Sergey Tkachenko |
Posted: 07/10/2004 11:35:45 Do not call BeginUpdate and EndUpdate. You can change height, but cannot change width. I tried the following code, it seems that it works with tables (RichViewEdit1 is inserted in Form1, its Align=alClient. // OnChange and OnResize procedure TForm1.RichViewEdit1Change(Sender: TObject); begin Form1.CLientHeight := RichViewEdit1.DocumentHeight+bw; end; procedure TForm1.FormCreate(Sender: TObject); begin bw := (RichViewEdit1.Height-RichViewEdit1.ClientHeight); end; procedure TForm1.FormActivate(Sender: TObject); begin RichViewEdit1.VSmallStep := 1; RichViewEdit1.Format; end; > In my application, i need to periodically change the size of the > RVEditor. I'm trying to get the effect like text boxes in Powerpoint, > which grow automatically when the user enters text that is bigger than > their boundaries. > This works well when there are no tables, but as soon as there are > tables involved, i start getting access violations. > > This is the code in the onChange of the RVEdit > > inherited; > tsEditor.beginUpdate; > if tsEditor.DocumentHeight > tsEditor.Height then > autoGrow; > tsEditor.EndUpdate; > > autoGrow is a method i wrote which calculates the new height, and > changes the height of the form who is the parent of the RVEdit. > > My guess is that when i'm changing the size, i may be triggering > somethign that destroys the top-level editor in the table, and then > other parts of the code are expecting it to still be there. > > Is there a way to do what i need to do that won't trigger any problems? > > Daniel |
Powered by ABC Amber Outlook Express Converter