Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, howardR), 472 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Is it possible to assign FLAG on a case-by-case basis? #484906
12/28/21 15:36
12/28/21 15:36
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Hello guys,

I ran into a problem and no matter what I did, I couldn't find a solution. I'm trying to develop a content where the user is asked a question and after a while I want them to remember the information given for that question.
If the user writes a response longer than 50 characters real-time while entering the response in the response field, I want to make the response go one line.
I was able to do this with the WWRAP flag feature, but even if the user types a character, the cursor immediately goes to the bottom line. I want to prevent this.
As soon as the user reaches 50 characters while typing the reply, I want to make sure that the cursor goes down to one line and writes the reply.

In other words, as soon as the user reaches 50 characters, I want to enable WWRAP in the code I shared below. How can I do that?

Code
TEXT* retention_name_txt = 
{
       pos_x = 70;
       pos_y = 180;
       layer = 11;
       red=0;
       green=0;
       blue=0;
       font = "Calibri#30";
       string(retention_name_str);
       flags = FILTER /*| WWRAP*/;
       size_x=1800;
}

Re: Is it possible to assign FLAG on a case-by-case basis? [Re: gamers] #484908
12/28/21 16:27
12/28/21 16:27
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted by manual
a flag is set by or-ing the flags parameter with the flag (text.flags |= SHOW;) and reset by and-ing the flags parameter with the inverse flag (text.flags &= ~SHOW;).
So you could do:
Code
retention_name_txt.flags &= ~WWRAP; // to reset
retention_name_txt.flags |= WWRAP; // to set
Also, you could check for the length on the string with str_len.

But I would personally use imgui for this purposes, cause it's very simple and easy to use + offers much more than acknex panels/texts has.
You can find it here:
Imgui Lite-C Development

Best regards.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Is it possible to assign FLAG on a case-by-case basis? [Re: 3run] #484913
12/29/21 07:57
12/29/21 07:57
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Originally Posted by 3run
Originally Posted by manual
a flag is set by or-ing the flags parameter with the flag (text.flags |= SHOW;) and reset by and-ing the flags parameter with the inverse flag (text.flags &= ~SHOW;).
So you could do:
Code
retention_name_txt.flags &= ~WWRAP; // to reset
retention_name_txt.flags |= WWRAP; // to set
Also, you could check for the length on the string with str_len.

But I would personally use imgui for this purposes, cause it's very simple and easy to use + offers much more than acknex panels/texts has.
You can find it here:
Imgui Lite-C Development

Best regards.


Hi 3run,

Thank you for replying. I'll try the flag method you said. But IMGUI looks really nice. What I want is to create a text box that supports multi-line typing and let the user type in this field. On the other hand, I don't know how to integrate IMGUI's textbox feature into my own project.

Re: Is it possible to assign FLAG on a case-by-case basis? [Re: gamers] #484915
12/29/21 14:58
12/29/21 14:58
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
It's actually quite easy to use, just download the demo and study the code, it's not as hard as you might have imagined it. Multi-line is created withing few lines of code!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Is it possible to assign FLAG on a case-by-case basis? [Re: 3run] #484916
12/29/21 16:02
12/29/21 16:02
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Originally Posted by 3run
It's actually quite easy to use, just download the demo and study the code, it's not as hard as you might have imagined it. Multi-line is created withing few lines of code!


Thanks for your response 3run.
How can I write the code to enable WWRAP flag when the number of characters entered exceeds 50 as the user continues to enter characters in the text box?

Re: Is it possible to assign FLAG on a case-by-case basis? [Re: gamers] #484917
12/29/21 16:11
12/29/21 16:11
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Actually, what I want to do is exactly; real-time consideration of the number of characters entered as the user enters a response, and activation of the WWRAP function when the number of characters exceeds 50. I could never do this.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1