How to prevent a user entering more text then fits the cell

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Frederik
Posts: 2
Joined: Tue Apr 22, 2014 4:43 pm

How to prevent a user entering more text then fits the cell

Post by Frederik »

Hi,

The cells in a table must keep their originally assigned size. To prevent the cells from re-sizing when the input text exceeds the visible cell space the table.options include [rvtoIgnoreContentWidth, rvtoIgnoreContentHeight, ...].
It prevents cell re-sizing but the user can still type in more text then fits the cell. How can I prevent users from entering more text then fits the visible cell area or at least give them a warning when they do?

Is there a way to calculate the "formatted" texheight from a cell so it can be compared to the cellheight. GetItemtext methods only seem to return "raw" text strings.

thanks in advance
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The only suggestion I can make is checking Cell.GetRVData.DocumentHeight in OnChange event, and calling Undo if it is too large.
Frederik
Posts: 2
Joined: Tue Apr 22, 2014 4:43 pm

Post by Frederik »

Hi Sergey,

The cell.documentheight somehow always returns 0 ... however, the documentheight of the TopLevelEditor does return the actual formatted textheight. When the input text "overfills" the cell the TopLevelEditor.DocumentHeight gets higher then the Cell.BestHeight. Bingo!

Thanks!
Post Reply