Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: HIman on August 24, 2005, 06:38:03 PM

Title: singl line editor control
Post by: HIman on August 24, 2005, 06:38:03 PM
Hello,
And it is possible to show a small example how to work with a line,
 read, write, erase
for singl line editor control?
Title: Re: singl line editor control
Post by: Mnemonic on August 25, 2005, 10:27:25 AM
Well, the editor control provides the .Text property, which is a normal string. You can manipulate strings using the methods in the String() object. Check the docs for more details.
Title: Re: singl line editor control
Post by: HIman on August 25, 2005, 12:07:53 PM
In an example wme_demo I have found code intervace\system\avegame.script
Code: [Select]
self.xResult = false;
if(self.xDescription!=null)
{
  var Editor = self.GetWidget("desc");
  Editor.Text = self.xDescription;
  Editor.SelStart = 0;
  Editor.SelEnd = 1000;
}
self.xDescription = "";
Other way to take the text is not present? Only so?
If yes, I could not find in the documentation
xResult
xDescription

And how to null a line if there the text has already been entered?
Title: Re: singl line editor control
Post by: Mnemonic on August 25, 2005, 01:28:30 PM
This code you posted comes from the window for entering savegame description. The xResult and xDescription properties are used as "parameters" of the window, i.e. the script calling the window first fills-in the DescWindow.xDescription, then displays the window. And after the player closes the window, the DescWindow.xResult property is filled with "true" if he clicked "OK".

These preudo-properties are NOT related to the editor control and they are NOT standard WME properties. They are custom properties only used in this single script. That's why you won't find them in the documentation.

But back to your question, you simply set the text in the editor control by calling:

  Editor.Text = "some text";

Or if you want to empty the editor, simply call:

  Editor.Text = "";

And, of course, you read the text the other way around:
 
  var SomeVariable = Editor.Text;


There's nothing complicated about it.