Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetVirtualButtonText + variable

Author
Message
Luca91
12
Years of Service
User Offline
Joined: 1st Sep 2012
Location: Italy
Posted: 1st Feb 2013 17:02
Hello, it is me again with another (stupid?) question :

I'm coding a menu for my app (to select levels), and I need to write the level name on every Virtual Button. I wrote this code:



It should create 10 virtualbuttons with "Level 1" ... "Level 10" text. But it fail to compile.
How can I fix it ? thanks
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Feb 2013 17:18
What error message are you getting?

Aside from that, you want to use Str(k) and Str(k+5). The Val function returns the numeric value for a string. The Str function returns a string for a numeric value.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Luca91
12
Years of Service
User Offline
Joined: 1st Sep 2012
Location: Italy
Posted: 1st Feb 2013 19:43
As usual, you are 100% right Ancient Lady. Thanks for the costant support
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Feb 2013 21:33
You are more than welcome.

Happy Programming!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 1st Feb 2013 22:51
generally the text in virtual button, if too long, exceeds the margins of the button. Making the button bigger doesn't work, because the text fonts become bigger too. In my apps, I have to restrict the length to <6 chars. Have this limitation been superseded in 1.88?
Thanks.
Luca91
12
Years of Service
User Offline
Joined: 1st Sep 2012
Location: Italy
Posted: 2nd Feb 2013 01:23
Quote: "generally the text in virtual button, if too long, exceeds the margins of the button. Making the button bigger doesn't work, because the text fonts become bigger too. In my apps, I have to restrict the length to <6 chars. Have this limitation been superseded in 1.88?
Thanks."


Nope mate, if the text is too long it still exceeds the margin of the button.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 2nd Feb 2013 09:56
Just print the text, grab it as an image and use setVirtualButtonImageDown / Up to set it as an image for the virtual button.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 2nd Feb 2013 12:10
@Luca: thanks! BTW, another Italian! Ciao!
@Impetus73, thanks but it is exactly what I would like to avoid (use an image instead of the text). To control the size of the text inside the button would be great.

Login to post a reply

Server time is: 2024-11-24 08:42:10
Your offset time is: 2024-11-24 08:42:10