Is it possible to enter the user's response in a text box?

Posted By: gamers

Is it possible to enter the user's response in a text box? - 08/16/21 11:49

Hi Dear Developers,
Is it possible to enter the user's response in a text box and automatically reduce the text to a bottom line according to the size of the text box?

For example, let's have a text box field as in Figure-1 and the user is required to enter a response in this field.

Figure-1
[Linked Image]

As seen in Figure 2, when the user starts to enter the response, the text goes out of the text box area.

Figure-2
[Linked Image]

Actually I want the desired output to be like in Figure 3. How can I do that?

Figure-3
[Linked Image]
Posted By: gamers

Re: Is it possible to enter the user's response in a text box? - 08/18/21 14:58

Please could you help me?
Posted By: gamers

Re: Is it possible to enter the user's response in a text box? - 09/10/21 06:58

Do you have any ideas?
Posted By: Aku_Aku

Re: Is it possible to enter the user's response in a text box? - 09/10/21 11:01

Why don't you try it? Make a short program and do some exercises. One of the best way to learn and get knowledge.
Posted By: gamers

Re: Is it possible to enter the user's response in a text box? - 09/11/21 09:20

Thanks for your response Aku_Aku. I tried to do this many times, but I didn't get the result I wanted. I wanted to ask because I think that forum friends who have knowledge and experience about the mentioned subject will potentially contribute. Sometimes trying many times to do things you don't know or can't do may not yield wanted results. Thank you for your understanding!
Posted By: 3run

Re: Is it possible to enter the user's response in a text box? - 09/11/21 09:33

Hey, I've never done this type of input field myself. But I would start by looking into TEXT, text.size_x, text.size_y, flags (text) WWRAP and ttf fonts + I would change text's string using the inkey. For the background I would use a panel with a bmap.

Best regards!
Posted By: Aku_Aku

Re: Is it possible to enter the user's response in a text box? - 09/12/21 10:17

OK I understand you.
You know there are two types of reading in text from keyboard: inkey and inchar.
I think the second way should choose for your case, that reads only one character at once.
The base of this case, you must to know how wide is one character in your character set. That defines how many character fit into one line, assumed the set isn't proportional type.
So, with inchar you know when the width of typed in chars summed up is equal your line width. Then you open a new line.
I made kind of this computing in the past but not for type in text but for write out text, so I think it should work.

As an alternate solution you can try propose of 3run with WRAP, maybe that should work too.
Posted By: Dooley

Re: Is it possible to enter the user's response in a text box? - 10/06/21 14:57

Yes it's possible, but it's not pretty. I do it in Star Explorers.
But when entering, the cursor and words kind of jump around a bit. When you hit enter, it fixes it, but during entry it is a bit strange.
Posted By: Dooley

Re: Is it possible to enter the user's response in a text box? - 10/06/21 14:57

I am using inkey .... maybe I will try inchar and see what happens?
Posted By: Dooley

Re: Is it possible to enter the user's response in a text box? - 10/06/21 15:00

As mentioned, WWRAP only works with truetype fonts. If you are using a bitmap font, it will keep going past the entry box, as you show in your first example.
© 2024 lite-C Forums