trichview.com

trichview.support




Re: Insert control & free


Return to index


Author

Message

Sergey Tkachenko

Posted: 12/09/2003 1:27:49


This code must work:


button1 := TButton.Create(nil);

Rich1.AddControl(button1,False);

button2 := TButton.Create(nil);

Rich1.AddControl(button2,False);

Rich1.Format;


Note: AddControl is an obsolete method, it's better to use AddControlEx


Please do not use RemoveControl method. This is a VCL method for removing a

child control from a parent control. It must not be used to remove controls

from TRichView document.


In TRichViewEdit, you can use:


// this operation can be undone/redone

// document must be formatted

if Rich1.SelectControl(button1) then

  Rich1.DeleteSelection;


Or do you want to delete control in TRichView, not TRichViewEdit?

If you know item index of this control, you can use DeleteItems method.

But you must be careful when using this method.





>

> Hi,

>

> I would like to insert 2 buttons like this :

> |button1| |button2|

> but its don't work, i can just put like :

> |button1|

> |button2|

> Rich1.AddControl(button1,False);

> Rich1.AddControl(button2,False);

>

> My second problem are :

> When i remove both buttons :

> Rich1.RemoveControl(button1);

> Rich1.RemoveControl(button2);

>

> Richview leave 2 blanks box .. How i can re-gain the space used by

buttons?

>

>

> Thanks





Powered by ABC Amber Outlook Express Converter