Jump to content

CASTORGUI.GUITextfield dont give value


swat0284
 Share

Recommended Posts

Hello can i get value from CASTORGUI.GUITextfield? i try to do

 var testTextField = new CASTORGUI.GUITextfield("GUITextfield",  {x:20, y:(50) - 20 , w:180, h:300, value: textVal,placeholder: "tu wpisz"}, guisystem,true);
  var testButton = new CASTORGUI.GUITexture("editButasdsadton", "data/edit.png", {x:5, y: 100 , w:96/2, h:96/2}, guisystem,function() { textVal = testTextField.value;//i add this textVal = textField.value becouse without it return undefinied alert(textVal);});
now it return "". Yes i type some text in input box
  
Link to comment
Share on other sites

You have to forget the callback:

var textVal = null;var function_of_return = function() { textVal = testTextField.value; };var testTextField = new CASTORGUI.GUITextfield("GUITextfield",  {x:20, y:(50) - 20 , w:180, h:300, value: "textVal", placeholder: "tu wpisz"}, guisystem, function_of_return, true);

I think this should work. I will soon add a feature to getValue() simpler. I would do the same on GUITextarea()

Link to comment
Share on other sites

I add the getValue() and setValue(val) functions for GUITextarea and GUITexfield. The doc is up to date too.

 

You can now get the value like this:

var testTextField = new CASTORGUI.GUITextfield("GUITextfield",  {x:20, y:(50) - 20 , w:180, h:300, value: "textVal", placeholder: "tu wpisz"}, guisystem, null, true);var textVal = testTextField.getValue();
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...