 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Clayton L. Wilson Guest
|
Posted: Sun Aug 03, 2003 11:03 pm Post subject: Need strange component |
|
|
Greetings everyone,
I wonder if I can get some help. I need a TRichEdit component that doesn't
allow for more text to be inserted or typed than what the window will hold.
For example, My TRichEdit component is sized to allow 5 lines by 32
characters (fixed width) only. How do I do this?
Thanks.
--
Clayton L. Wilson
|
|
| Back to top |
|
 |
Alexander Bauer Guest
|
Posted: Mon Aug 04, 2003 10:19 am Post subject: Re: Need strange component |
|
|
Hi,
Maybe this works:
Write a new TRichEdit derived from TRichEdit and check the count of chars
per line and the count of lines when a key is pressed.
Or use the Windows Edits callback function "EditWordBreakProc" (An
application-defined callback function used with the EM_SETWORDBREAKPROC
message) and the message EM_SETLIMITTEXT (32x5 = 160 Chras maximum) (See
Win32.hlp or MS Platform SDK for mor information).
I hope this can help you,
Regards,
Alexander Bauer
"Clayton L. Wilson" <claytonwilson (AT) ev1 (DOT) net> schrieb im Newsbeitrag
news:3f2d94ef$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Greetings everyone,
I wonder if I can get some help. I need a TRichEdit component that doesn't
allow for more text to be inserted or typed than what the window will
hold.
For example, My TRichEdit component is sized to allow 5 lines by 32
characters (fixed width) only. How do I do this?
Thanks.
--
Clayton L. Wilson
|
|
|
| Back to top |
|
 |
D Whaley Guest
|
Posted: Tue Aug 05, 2003 1:36 pm Post subject: Re: Need strange component |
|
|
You can just test the TextEntent of the Canvas in an OnKeyDown event and
block input if it exceeds it.
|
|
| Back to top |
|
 |
Alexander Bauer Guest
|
Posted: Wed Aug 06, 2003 10:54 am Post subject: Re: Need strange component |
|
|
Hi D Whaley,
OK, thats possible but not verry safe. Why don't use Lenght(Lines[i])? But
anyway, how would you permit, that the user can type more the wanted
charakters to a line if not handling the wordbreak your self (if you don't
want to block the key input), just in case there is selected a font size
that enables more than wanted chars to a line before the standart wordbreak
proc breaks down the line because the clientarea is large engough to hold
eg. 50 chars?
To block a key input is possible, as you said, but I think it's not verry
nice. The control generally supports wordbreaking so it should work in that
descendant control too - don't it? I would only block the key input, if the
total count of chars has exceeded.
Regards,
Alexander Bauer
"D Whaley" <dwhaley (AT) hs-technologies (DOT) com> schrieb im Newsbeitrag
news:3f2fb2d6$1 (AT) newsgroups (DOT) borland.com...
| Quote: | You can just test the TextEntent of the Canvas in an OnKeyDown event and
block input if it exceeds it.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|