
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
TEXT
Know if pasted text will be totally visible in an Edit Field
Savoir si un texte collé dans un Edit Field sera entièrement visible
Check out the toolbox call:
height% = FN TEGETHEIGHT (endLine&,startLine&,teH&)
and the .teNLines% field of the TEHANDLE.
My guess is you should go ahead and paste your scrap, then check these to see if it fits. If it doesn't, you can either undo it (if you've saved the previous contents) or adjust the rect of the field.
I think <height%> is the vertical length,in screen pixels, of the text in the edit field referenced by teH&.
<teH&..teNLines%> should tell you the total number of lines of text in teH&, so check it _after_ pasting. You'll need this number for the endLine& parameter when you call FN TEGETHEIGHT. I _think_ it will be updated as part of the paste operation, so you shouldn't need to do any TECALTEXT or anything.
I have _not_ tried this, so please observe all the disclaimers on p.2 ;>) but if you just want to know if the new text fits, your function might look something like this.
LOCAL FN canUCitAll%(teH&) 'Call after pasting
txtHeight% = FN TEGETHEIGHT(teH&..teNLines%,1,teH&)
fldHeight% = teH&..teViewRect.bottom% - teH&..teViewRect.top%
END FN = fldHeight% > txtHeight% '_ztrue if it fits
|