How do I really customize TextBox?

Get help using Construct 2

Post » Sat Jun 13, 2015 1:22 am

Hi everyone,

I read the manual, researched the forums but couldn't find answers for two matters:

1) the auto-scale property of TextBox doesn't fit the need I have for a custom size accordingly to different screen sizes. It is too small. If I set "font-size" to "2em", it will be too small for some devices but ideal for others. I think I could create some kind of condition based on the size of the WindowWidth, but there is no other way like putting "font-size" equal to "(WindowWidth/50)em" ? I tried this equation and others like "(Sprite.ImageWidth/20)em" but nothing worked. I think it has something to do with CSS, that I don't know, but then isn't there any way to get a custom font size for TextBox, other than Sprite Fonts?

2) I have a TextBox to the player put his name on it, but even if I set the Keyboard "When any key is pressed" to set an Instance for it that sums 1 each time a key is pressed, nothing happens when the keyboard is pressed on the TextBox and so I can't check if the player have put a name at all so he can begin the game. The Instance only adds when I press Enter or Esc. Does someone knows what I am doing wrong and how to solve that?

This is my first topic and I have solved other problems researching the forums and reading the manual, but those were above me. If you have any idea about how to deal with that, I would really appreciate the help.

Thank you for your time reading and I wish you a nice day.
B
8
S
2
G
1
Posts: 15
Reputation: 664

Post » Sat Jun 13, 2015 2:35 am

for 1;
try browser object
Image

and something like:
Code: Select all
Set CSS style "font-size" to Browser.ScreenWith/10&"px"


or compare Browser.ScreenWith
if Browser.ScreenWith is between 300&320 set font-size to.....etc

for 2;
try len ..len(x) - return length of the string x

system compare two values..len(TextBox.Text>0..
https://www.scirra.com/tutorials/711/ho ... box-object
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Sat Jun 13, 2015 1:01 pm

Hi korbaach,

Thanks for the help. I'll still figure out the "font-size" but your help to problem 2 solved it completely.

All the best to you,
LuciusCD
B
8
S
2
G
1
Posts: 15
Reputation: 664


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ChesVCF, Google [Bot], OBLIVION, shinkan, Solomon, ultrafop, yiuyiu6666 and 21 guests