Page 1 of 1
TEdit and resizing
Posted: Fri Jan 11, 2008 12:04 pm
by BernhardRoos
Is it possible that a TEdit control changes its size during the user is editing in this TEdit Field (like as MS Word).
How can I solve this?
Best wishes
Bernhard
Posted: Sat Jan 12, 2008 1:38 pm
by Sergey Tkachenko
You can assign this code to OnChange of TEdits:
Code: Select all
procedure TForm1.OnControlChange(Sender: TObject);
var txt: TEdit;
begin
txt := (Sender as TEdit);
Canvas.Font := txt.Font;
txt.ClientWidth := Canvas.TextWidth(txt.Text)+6;
RichViewEdit1.AdjustControlPlacement2(txt);
end;
(do not forget to reassign it in OnControlAction, after RVF loading).
There is one problem: AdjustControlPlacement2 does not update item resizer. It will be fixed in the next update.
Posted: Mon Jan 14, 2008 2:05 pm
by BernhardRoos
Thanks for your answer.
Is there a similar function for TRichView because the user makes his inputs in a TRichView component (not in TRichViewEdit)
AdjustControlPlacement2 is only for TRichViewEdit.
Best wishes
Bernhard
Posted: Mon Jan 14, 2008 2:08 pm
by BernhardRoos
I've found something.
If I call Format it works.
Best wishes
Bernhard