Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Changing the text of a static control  (Read 2518 times)

0 Members and 1 Guest are viewing this topic.

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Changing the text of a static control
« on: September 05, 2007, 09:03:28 AM »

Howdy,

How exactly do I change the text of a static control I have in a window? I want to display a 4 digit number as the player clicks on the numbers of a keypad. So I have 4 variables, one for each number, which I am setting to a new number when the player clicks the keypad.

So, I want to display all 4 variables one after the other, but it won't work.

I thought it was just:

this.Text = Variable1 + Variable2 + Variable3 + Variable4;

Thanks.  8)

EDIT:

 :-[ I've achieved what I wanted.  :-[ Sorry. I'll try and wait a little bit before posting my next problem.  8)
« Last Edit: September 05, 2007, 09:29:43 AM by TheDerman »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Changing the text of a static control
« Reply #1 on: September 05, 2007, 05:43:20 PM »

For the record, it will work as long as the variables contain text. If they contain numbers, the script will first sum the numbers and then assign the result to the static control. A simple way to fix this - convert the numbers to text first:

this.Text = ToString(Variable1) + ToString(Variable2) + ToString(Variable3) + ToString(Variable4);
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Changing the text of a static control
« Reply #2 on: September 06, 2007, 02:51:41 AM »

I figured it was adding up all the variables.

So I just set them all like this: Variable1 = "1"

...and that has worked.

But that converting thing definitely makes sense - thanks.  8)
Logged
 

Page created in 0.037 seconds with 22 queries.