Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: gordonramp on April 11, 2011, 07:58:54 PM

Title: [solved] Textfield and button
Post by: gordonramp on April 11, 2011, 07:58:54 PM
Just purchased Playmaker and am trying to get to grips with it. Here is a question.. Can I set up a Textfield and a button in Playmaker so that when a User Types text into the field and clicks the button and if the text is correct then an event takes place.  Thanks.

Title: Re: Textfield and button
Post by: jeanfabre on April 13, 2011, 11:35:29 AM
Hi,

 Totally possible :)

String comparison action to trigger an event can be found here: https://hutonggames.fogbugz.com/default.asp?W408 (https://hutonggames.fogbugz.com/default.asp?W408)

Then you have a lot of different possibilities to get the string from the user. Let's keep it all in playmaker :)

You first need to create a variable that will hold the content of the textfield at start AND when the user is editing it.

You can display a gui text field with the following action : https://hutonggames.fogbugz.com/default.asp?W436 (https://hutonggames.fogbugz.com/default.asp?W436)
You can display a button using the following action :https://hutonggames.fogbugz.com/default.asp?W427 (https://hutonggames.fogbugz.com/default.asp?W427)

Look for the playmaker testLab samples on how to use GUI actions. The testlab samples are the first stop to learn playmaker.

Then you simply wire an event when the user is clicking on the button . That event triggers the State where you then compare the text of the textField with the string you want, and if equal, you trigger another event and do whatever you need on the State triggered by the successful comparison event.

 Does that make sense?

 Bye,

 Jean
 

Title: Re: Textfield and button
Post by: gordonramp on April 14, 2011, 10:02:06 PM
Yes, that helps, thanks.