textarea

i am writing to a textarea programatically. how do i detect that the text exceeds the size of the textarea and the scrollbars aare displayed so that i trim the text or reduce the font size.

As far as I know there is no method available to perform such a check.

If your base font is monospaced (e.g. - 12 cpi Courier New), you could do a calculation based on height and width (and compare this to the string length of the text field) and then adjust downwards … the math can get a little tricky depending on font though … you will need to know in advance the “pixel multiplier” (how may pixels equals a given character) as you move through different pitches. I wouldn’t attempt this without a monospaced font.

Michael

But the tricky part would be multi-platform apps I am afraid…

So true … I agree with Marcel … especially with Mac’s at 1/72" pixel dimensions and PC’s at 1/96". Maybe try to talk Marcel into writing a Pixel-Normalizer :)

M^2

And not only that but also width of scrollbars etc.

With a ps (aka plug-for-BeanPlugIn-writers) to Servoy Engineering: will you be incorporating web-compatible hooks soon for third party plug-in/bean developers developing GUI-related functions?

M^2

Haven’t checked the ReleaseNotes of 3.5 have you? :-)

Api’s have been added in RC4/5

Paul

Great! Yes, I did miss those … thanks,

Michael

thanks for all responses. i am using servoy 3.1.6 and i can not find any functions. please direct me to the module or function that can do this. which api?

It is for 3.5, and we are talking java api for plugins/beans!

what does getScrollX or getScrollY do?

r43233:
what does getScrollX or getScrollY do?

That’s to save the position of the scrollbars so can you set them back using the corresponding set function. Note that this is also discussed in the docs. Press F1, on search tab search for the function and voila, explanation including example.