Select Text in TextCell programatically

Hi, I need to select a text on a diagram block, programmatically. I call Block.EditText, the editor appears. Is it possible after that to select, through SelStart / SelLength or by the coordinates of text, or something else?


Oh, I found Diagram.InplaceMemo property. Hope it helps)
But what if there are several cells?

There is always only a single text cell being edited. Thus the InplaceMemo will be the one editing the cell. You can start editing an arbitrary cell using EditTextCell method:

1 Like

Thanks for your help, Wagner! Can you also tell me please, what is the best way to automatically set the block size according to the actual size of the text cell (something like TLabel.AutoSize)?

Unfortunately there is not such feature, calculating the text size is not a trivial task also.

1 Like

Yes, I see)) Now I'm researching the code of UML blocks, maybe there is a solution.

Yes, if you can inherit your blocks, there are internal protected helper methods that can calculate the size of text cell. UML blocks will give you a hint, still not trivial.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.