Textbox - input words and numbers

Started by Voedino, Thu 22/01/2015 18:50:47

Previous topic - Next topic

Voedino

Hi guys! Need a condition that only allows the input of numbers and a condition that only allows the input of words. Or numbers or words. Help me, please!
Code: ags

TextBox1.Text="asdfghjkl";
TextBox1.Text="123456789";

monkey0506

There's nothing built-in, but validating this type of input is really simple:

Code: ags
function TextBox1_OnActivate()
{
  String text = TextBox1.Text;
  int i = 0;
  while (i < text.Length)
  {
    if ((text.Chars[i] >= '0') && (text.Chars[i] <= '9')) // TODO: optionally check for decimal or thousands separators
    {
      // text is a valid number...
    }
    else
    {
      // text is not a number!
      TextBox1.Text = "";
      Display("Please enter a number! Value entered was \"%s\".", text);
    }
    i++;
  }
}

Voedino

#2
Don't work!


Gilbert

You need to elaborate on how it "doesn't work", otherwise we cannot help much by blind guessing.

One common problem people having is you cannot just type the codes in the script to make them automagically work. You need to link the functions to certain events. In this case, the On_Activate event of the Textbox, as illustrated by the following figure.
[imgzoom]http://i488.photobucket.com/albums/rr249/gilbot/tb_events_zps3d9c2234.png[/imgzoom]
First, click the Event icon (the lightning icon) of the Textbox's Property window. Then, click the '...' icon of the On_Activate event and a new function will be created in the script. You may then copy or type the codes of this function's body.

AlienCap

Iceboty V7000a - you really do not understand what is not working? In the event that after you enter all the code works not make sense. the desired effect can be achieved function function repeatedly_execute() ,but because it did not particularly want to load the project and therefore advised to use the optional GUI with buttons to enter numbers, but just wanted to Inventive Mind differently will review my version
new Global variables
int fcode - makes faster code
int strorint -  choice of input numbers or text
Code: ags
function repeatedly_execute() {

  String text = TextBox1.Text;
 if (text.Length != fcode){
   // strorint is 0 then enter the text (not numbers), 1 then the numbers
  int i = 0;
  while (i < text.Length)
  {
   if ((strorint==0) &&  (text.Chars[i] >= '0') && (text.Chars[i] <= '9')){
    text = text.Truncate(i);
    TextBox1.Text = text;
   }
   else if ((strorint==1) && !((text.Chars[i] >= '0') && (text.Chars[i] <= '9'))){
    text = text.Truncate(i);
    TextBox1.Text = text;
   }
   i++;
  }
  fcode=text.Length;
 }


 if (IsGamePaused() == 1) return; //Only indication the line before which to insert the code

monkey0506

#6
AlienCap, I must insist that you stop giving programming advice. What you are suggesting to do is wrong. This is not the proper way for things to be done in AGS: it unnecessarily clutters the repeatedly_execute function when there are specialized events, it requires additional polling of variables in memory thereby making the code less efficient, and what's more is that it doesn't even work properly.

You are attempting to use brute force to manipulate the TextBox text, but this does nothing to prevent other code from changing the property to an invalid value. So long as the length of the string is maintained then your code does not attempt to validate the text. What's more is that you are changing the length of the string inside of a loop that uses its own length as a terminating value - that's day one bad programming style. And although you're putting forward a good effort to make it look as though you're validating only the newly input bit of the string, you always begin parsing the string from the beginning, which is the least efficient way for you to parse it. You're using an integer to store a boolean value, which isn't inherently bad on its own, but especially on top of everything else it makes your code less readable. Adding to this unreadable mess, you are using the not operator on a pair of conditions instead of switching the inequality operators.

And you're missing a closing brace in your example.

STOP POSTING CODE AS "HELPFUL" ADVICE. YOU ARE WRONG.

AlienCap

#7
бавÃ'Ã' пеÃ'â,¬ÃÂµÃÂºÃÂ»ÃÂ°ÃÂ´ÃÂ°Ã'‡Ð¾Ð¼, Ã'‚и мене задовбав, Ã'‰Ð¾ Ã'†Ðµ Ã'‚и менÃ'â€" випаÃ'â,¬Ã'ŽÃ'”Ã'ˆ,
по пеÃ'â,¬Ã'ˆÐµ код Ã'â,¬ÃÂ¾ÃÂ±ÃÂ¾Ã'‡Ð¸Ð¹
по дÃ'â,¬Ã'Æ'ге Ã'‚ам вÃ'Ðµ пÃ'â,¬ÃÂ°ÃÂ²ÃÂ¸ÃÂ»Ã'Å'но, Ã' викоÃ'â,¬ÃÂ¸Ã'Ã'‚овÃ'Æ'Ã'Ž оÃ'Ð¾Ð±Ð»Ð¸Ð²Ð¾Ã'Ã'‚Ã'â€" команд на Ã'Ð²Ð¾Ã'Ž коÃ'â,¬ÃÂ¸Ã'Ã'‚Ã'Å', наÃ'‰Ð¾ менÃ'â€" Ã'‡ÐµÐºÐ°Ã'‚и поки веÃ'Ã'Å' код пÃ'â,¬ÃÂ¾ÃÂ²Ã'â€"Ã'â,¬ÃÂ¸Ã'‚Ã'Å'Ã'Ã' коли Ã' наÃ'ˆÐ¾Ð² помилкÃ'Æ' в Ã'Ã'Å'омÃ'Æ' Ã'‚екÃ'Ã'‚Ã'â€" коли напÃ'â,¬ÃÂ¸ÃÂºÃÂ»ÃÂ°ÃÂ´ Ã' найÃ'ˆÃ'ˆÐ¾Ð² помилкÃ'Æ' на 4 елеменÃ'‚Ã'â€" менÃ'â€" нема Ã'Ð¼Ð¸Ã'Ð»Ã'Æ' пÃ'â,¬ÃÂ¾ÃÂ²Ã'â€"Ã'â,¬Ã'Ã'‚и наÃ'Ã'‚Ã'Æ'пнÃ'â€" 20, а глобалÃ'Å'нÃ'â€"  змÃ'â€"ннÃ'â€" Ã'Ã'‚воÃ'â,¬ÃÂ¸ÃÂ² Ã'‚омÃ'Æ' Ã'‰Ð¾ Ã'â,¬ÃÂ¾ÃÂ·Ã'â,¬ÃÂ¾ÃÂ±ÃÂ½ÃÂ¸ÃÂº кÃ'â,¬ÃÂ¸ÃÂ²ÃÂ¾Ã'â,¬Ã'Æ'кий Ã'Ã'‚воÃ'â,¬ÃÂ¸ÃÂ² дÃ'Æ'же мало можливиÃ'… подÃ'â€"й, Ã'‡ÐµÃ'â,¬ÃÂµÃÂ· Ã'†Ðµ Ã' змÃ'Æ'Ã'ˆÐµÐ½Ð¸Ð¹ Ã'…оÃ'‡ Ã'ÐºÐ¾Ã'Ã'Å' опÃ'‚имÃ'â€"зовÃ'Æ'ваÃ'‚и код, Ã'†Ã' Ã'„Ã'Æ'нкÃ'†Ã'â€"Ã' (repeatedly_execute) повÃ'‚оÃ'â,¬Ã'ŽÃ'”Ã'‚Ã'Å'Ã'Ã' поÃ'Ã'‚Ã'â€"йно Ã'‚омÃ'Æ' пÃ'â,¬ÃÂ¾Ã'Ã'‚о необÃ'…Ã'â€"дно маÃ'‚и змÃ'â€"ннÃ'Æ' Ã'ÐºÐ° дозволиÃ'‚Ã'Å' обÃ'â€"йÃ'‚и пÃ'â,¬ÃÂ¾Ã'†ÐµÃ' пÃ'â,¬ÃÂ¾ÃÂ²Ã'â€"Ã'â,¬ÃÂºÃÂ¸ введеного кода 2 Ã'â,¬ÃÂ°ÃÂ·
Ã'â€" не бÃ'Æ'Ã'‚Ã'Å' Ã'â€"дÃ'â€"оÃ'‚ом, Ã'‰Ð¾ Ã'†Ðµ Ã' Ã'‚ак нÃ'â€"би пÃ'â,¬ÃÂ¾ÃÂ¿Ã'Æ'Ã'Ã'‚ив, длÃ' Ã'‚ого Ã'‰Ð¾Ð± не закÃ'â,¬ÃÂ¸Ã'‚и Ã'Ð°Ð¼Ð¾Ð¼Ã'Æ' Ã'„Ã'Æ'нкÃ'†Ã'â€"Ã'Ž Ã'‚Ã'â,¬ÃÂµÃÂ±ÃÂ° бÃ'Æ'Ã'‚и повним Ã'â€"мбÃ'â€"Ã'†Ð¸Ð»Ð¾Ð¼

Ã'â€" пеÃ'â,¬Ã'ˆÐµ нÃ'â€"ж казаÃ'‚и Ã'‰Ð¾ Ã' не пÃ'â,¬ÃÂ°ÃÂ²ÃÂ¸ÃÂ¹, в Ã'‚ебе взагалÃ'â€" код безполÃ'”зний Ã'‡ÐµÃ'â,¬ÃÂµÃÂ· викоÃ'â,¬ÃÂ¸Ã'Ã'‚аннÃ' Ã'„Ã'Æ'нкÃ'†Ã'â€"Ã'â€" OnActivate, Ã' ка по Ã'Ã'Æ'Ã'‚Ã'â€" Ã'‚Ã'â€"ки Ã'Ðº нажмеÃ'ˆ енÃ'‚Ã'â,¬ Ã'Ð¿Ã'â,¬ÃÂ°Ã'†Ã'ŽÃ'”, Ã'†Ðµ Ã'Ðº плаÃ'Ã'‚еÃ'â,¬ÃÂ¾ÃÂ¼ пÃ'â,¬ÃÂ¾Ã'‚Ã'â€"Ã'‡ÐºÃ'Æ' в Ã'ˆÐ»Ã'ŽÐ±Ã'†Ã'â€" заклеÃ'ŽÐ²Ð°Ã'‚и, Ã'‚обÃ'â€"ж напиÃ'Ð°Ð»Ð¸ Ã'‰Ð¾ Ã'‚Ã'â,¬ÃÂµÃÂ±ÃÂ° Ã'‰Ð¾Ð± вводивÃ'Ã' Ã'‚Ã'â€"ки Ã'‚екÃ'Ã'‚ Ã'‡Ð¸ бÃ'Æ'кви, один Ã'â,¬ÃÂµÃÂ·Ã'Æ'лÃ'Å'Ã'‚аÃ'‚ кÃ'â€"нÃ'†ÐµÐ²Ð¸Ð¹ Ã'†Ðµ не Ã'‚еж Ã'Ð°Ð¼Ðµ Ã'‰Ð¾ Ã'â€" пÃ'â,¬ÃÂ°ÃÂ²ÃÂ¸ÃÂ»Ã'Å'ний Ã'ˆÐ»Ã'Ã'…

Ã'‚а Ã'â€" Ã'‚и дÃ'â€"Ã'Ã'‚ав мене обвинÃ'Æ'ваÃ'‡Ã'Æ'ваÃ'‚и, Ã'Ð¶ обÃ'Ã'Ð½Ð¸Ð² пеÃ'â,¬ÃÂµÃÂ´ кодом пиÃ'ˆÃ'Æ' Ã'‚ак Ã'‚Ã'â€"лÃ'Å'ки Ã'‡ÐµÃ'â,¬ÃÂµÃÂ· Ã'‚воÃ'Ž непÃ'â,¬ÃÂ¾ÃÂ´Ã'Æ'манÃ'Æ' поÃ'â,¬ÃÂ°ÃÂ´Ã'Æ', Ã' деÃ'Ã'Å' 2 Ã'‚ижнÃ'â€" говоÃ'â,¬ÃÂ¸ÃÂ² Ã'‰Ð¾ може лÃ'â€"пÃ'ˆÐµ гÃ'Æ'Ã'â€" викоÃ'â,¬ÃÂ¸Ã'Ã'‚овÃ'Æ'ваÃ'‚и длÃ' менÃ'Å'Ã'ˆÐ¾Ã'â€" нагÃ'â,¬Ã'Æ'зки, Ã'‚а Ã'â€" Ã'‚акий код Ã'Ã'‚воÃ'â,¬Ã'ŽÃ'” Ã'â,¬ÃÂ¾ÃÂ·Ã'â,¬ÃÂ¾ÃÂ±ÃÂ½ÃÂ¸ÃÂº пÃ'â,¬ÃÂ¾ÃÂ³Ã'â,¬ÃÂ°ÃÂ¼ÃÂ¸ а не Ã', Ã'ÐºÃ'‰Ð¾ Ã'” ваÃ'â,¬Ã'â€"анÃ'‚ Ã'‰Ð¾ пÃ'â,¬ÃÂ°Ã'†Ã'ŽÐ²Ð°Ã'‚име полÃ'â€"пÃ'ˆÐµ мого Ã'‚о Ã'‡Ð¾Ð¼Ã'Æ'ж не напиÃ'Ð°Ð² його, Ã'‚ой код Ã'‰Ð¾ Ã'‚и напиÃ'Ð°Ð², вÃ'â€"н зовÃ'Ã'â€"м не пÃ'â,¬ÃÂ°ÃÂºÃ'‚иÃ'‡Ð½Ð¸Ð¹, багаÃ'‚о лиÃ'ˆÐ½Ã'â€"Ã'… дÃ'â€"й, Ã'‚ай накÃ'â€"неÃ'†Ã'Å'Ã'‚о пеÃ'â,¬ÃÂµÃÂ¿ÃÂ¸Ã'‚Ã'Æ'й пеÃ'â,¬ÃÂµÃÂ´ поÃ'â,¬ÃÂ°ÃÂ´ÃÂ°ÃÂ¼ÃÂ¸ Ã'‡Ð¾Ð³Ð¾ конкÃ'â,¬ÃÂµÃ'‚Ã'â,¬ÃÂ¾ в Ã'†Ã'Å'омÃ'Æ' кодÃ'â€" Ã'‚Ã'â,¬ÃÂµÃÂ±ÃÂ° доÃ'Ã'Ð³Ð½Ã'Æ'Ã'‚и

Ã'â€" пеÃ'â,¬Ã'ˆ нÃ'â€"ж мене обвиÃ'‚Ã'Æ'ваÃ'‡ÐºÐ²Ð°Ã'‚и, Ã'‚и Ã'â,¬ÃÂ¾ÃÂ±ÃÂ¸Ã'ˆ Ã'‚еж Ã'Ð°Ð¼Ðµ  TextBox1.Text = "";, Ã'‚Ã'â€"лÃ'Å'ки бÃ'â€"лÃ'Å' пÃ'â,¬ÃÂ¸ÃÂ¼Ã'â€"Ã'‚ивно, Ã'‚омÃ'Æ' Ã'‰Ð¾ навÃ'â€"Ã'‰Ð¾ позбÃ'Æ'ваÃ'‚иÃ'Ã'Å' вÃ'Ã'Å'ого Ã'‚екÃ'Ã'‚Ã'Æ' коли знаÃ'”мо мÃ'â€"Ã'Ã'†Ðµ помилки, не коÃ'â,¬ÃÂ¸Ã'Ã'‚Ã'Æ'ваÃ'‚иÃ'Ã'Å' Ã'†Ð¸Ð¼ Ã'†Ðµ Ã'‚Ã'â,¬ÃÂ°Ã'‚а Ã'‡Ð°Ã'Ã'Æ' на Ã'‡Ð¸Ã'‚аннÃ' пÃ'â,¬ÃÂ¸Ã'Ð»Ð°Ð½Ð¾Ð³Ð¾ кодÃ'Æ', бÃ'Æ'ло Ã'‚Ã'Æ'Ã'‚ бÃ'â€"лÃ'Å'Ã'ˆÐµ команд Ã' би пÃ'â,¬ÃÂ¾Ã'Ã'‚о видалÃ'Ð² непÃ'â,¬ÃÂ°ÃÂ²ÃÂ¸ÃÂ»Ã'Å'ний Ã'Ð¸Ð¼Ð²Ð¾Ð» а не обÃ'â,¬Ã'â€"зав Ã'‚екÃ'Ã'‚

Ã'â€" мавпа длÃ' Ã'‚ого Ã'‰Ð¾Ð± Ã' Ã'‚Ã'Æ'Ã'‚ не давав поÃ'â,¬ÃÂ°ÃÂ´, давай Ã'Ð°Ð¼ пÃ'â,¬ÃÂ¾ÃÂ´Ã'Æ'манÃ'â€" поÃ'â,¬ÃÂ°ÃÂ´ÃÂ¸, Ã'Ðº Ã' маÃ'Ž не бÃ'â€"Ã'Ð¸Ã'‚иÃ'Ã'Å' вÃ'â€"д Ã'‚воÃ'â€"Ã'… Ã'Ð»Ã'â€"в Ã'â€" поÃ'â,¬ÃÂ°ÃÂ´, коли Ã'‚и обвинÃ'Æ'ваÃ'‡Ã'Æ'Ã'”Ã'ˆ а Ã'Ð°Ð¼ нÃ'â€"Ã'‡Ð¾Ð³Ð¾ Ã'â,¬ÃÂ¾ÃÂ±ÃÂ¾Ã'‡Ð¾Ð³Ð¾ не пÃ'â,¬ÃÂ¾ÃÂ¿ÃÂ¾ÃÂ½Ã'Æ'Ã'”Ã'ˆ. Та Ã'â€" навÃ'‡Ð¸Ã'Ã'Å' Ã'‡Ð¸Ã'‚аÃ'‚и Ã'‚екÃ'Ã'‚ пеÃ'â,¬ÃÂµÃÂ´ кодом, Ã' ж поÃ'Ã'Ð½Ð¸Ð² Ã'‡Ð¾Ð¼Ã'Æ' не Ã'…оÃ'‚Ã'â€"в Ã'Ã'‚воÃ'â,¬Ã'ŽÐ²Ð°Ã'‚и код, а Ã'ÐºÃ'‰Ð¾ не вмÃ'â€"Ã'”Ã'ˆ Ã'‡Ð¸Ã'‚аÃ'‚и Ã'‚екÃ'Ã'‚ мÃ'â€"ж Ã'â,¬Ã'Ð´ÐºÃ'â€"в, пÃ'â,¬Ã'Ð¼Ð° мова бÃ'Æ'де Ã'‡Ð°Ã'Ã'‚о в обÃ'â,¬ÃÂ°ÃÂ·ÃÂ»ÃÂ¸ÃÂ²Ã'â€"й Ã'„оÃ'â,¬ÃÂ¼Ã'â€".

забÃ'Æ'в поÃ'Ã'Ð½Ð¸Ã'‚и Ã'‡Ð¾Ð¼Ã'Æ' нема пÃ'â,¬ÃÂ¾ÃÂ²Ã'â€"Ã'â,¬ÃÂºÃÂ¸ коли збеÃ'â,¬Ã'â€"гаÃ'”Ã'‚Ã'Å'Ã'Ã' довжина Ã'â,¬Ã'Ð´ÐºÐ° (Ã'…оÃ'‡Ð° задÃ'Æ'мÃ'Æ'Ã'ŽÃ'Ã'Å' комÃ'Æ' взагалÃ'â€" Ã'‚Ã'â,¬ÃÂµÃÂ±ÃÂ° Ã'‚аке поÃ'Ã'Ð½Ã'ŽÐ²Ð°Ã'‚и), поÃ'‡Ð½ÐµÐ¼ з Ã'‚ого Ã'‰Ð¾ Ã'„Ã'Æ'нкÃ'†Ã'â€"Ã' виконÃ'Æ'Ã'” поÃ'Ã'‚Ã'â€"йнÃ'â€" повÃ'‚оÃ'â,¬ÃÂµÃÂ½ÃÂ½Ã' кодÃ'Æ', Ã'‰Ð¾ маÃ'” Ã'‚ебе заÃ'Ã'‚авиÃ'‚и задÃ'Æ'маÃ'‚иÃ'Ã'Å' Ã'Ðº обÃ'â€"йÃ'‚и пÃ'â,¬ÃÂ¾Ã'†ÐµÃ' поÃ'Ã'‚Ã'â€"йний пÃ'â,¬ÃÂ¾Ã'†ÐµÃ' пеÃ'â,¬ÃÂµ пÃ'â,¬ÃÂ¾ÃÂ²Ã'â€"Ã'â,¬ÃÂºÃÂ¸ повÃ'â€"Ã'â,¬ÃÂµÃÂ½ÃÂ¾ÃÂ³ÃÂ¾ введеного Ã'‚екÃ'Ã'‚Ã'Æ', длÃ' Ã'‚ого Ã'â€" необÃ'…Ã'â€"дна додаÃ'‚кова змÃ'â€"нна, Ã'â€"накÃ'ˆÐµ можливÃ'â€" навÃ'â€"Ã'‚Ã'Å' пÃ'â€"двиÃ'Ð°Ð½Ð½Ã' Ã'â€" Ã'ÐºÃ'‰Ð¾ Ã'‚и задÃ'Æ'маÃ'”Ã'ˆÃ'Ã' Ã'‚о зÃ'â,¬ÃÂ¾ÃÂ·Ã'Æ'мÃ'â€"Ã'”Ã'ˆ Ã'‰Ð¾ лÃ'ŽÐ´Ã'Ã'Å'ка Ã'â,¬ÃÂµÃÂ°ÃÂºÃ'†Ã'â€"Ã' не наÃ'Ã'‚Ã'â€"лÃ'Å'ки виÃ'Ð¾ÐºÐ° Ã'‰Ð¾Ð± вÃ'Ã'‚игнÃ'Æ'Ã'‚и змÃ'â€"ниÃ'‚и довжинÃ'Æ' Ã'‚екÃ'Ã'‚ового Ã'â,¬Ã'Ð´ÐºÐ° до наÃ'Ã'‚Ã'Æ'пного Ã'†Ð¸ÐºÐ»Ã'Æ' кода, а Ã'Ð°Ð¼ Ã'†Ã'â€"кил повÃ'‚оÃ'â,¬Ã'ŽÃ'”Ã'‚Ã'Å'Ã'Ã' Ã'Ã'‚Ã'â€"ки Ã'â,¬ÃÂ°ÃÂ· Ã'‰Ð¾ Ã'‚ака змÃ'â€"нна бÃ'â€"лÃ'Å'Ã'ˆÐµ нÃ'â€"ж опÃ'â,¬ÃÂ°ÃÂ²ÃÂ´Ã'Æ'Ã'” Ã'ÐµÐ±Ðµ вона пÃ'â,¬ÃÂ¾Ã'Ã'‚о необÃ'…Ã'â€"дна
Ã'â€" Ã' не збиÃ'â,¬ÃÂ°Ã'ŽÃ'Ã'Å' пÃ'â€"дÃ'Ã'‚Ã'â,¬ÃÂ¾Ã'ŽÐ²Ð°Ã'‚иÃ'Ã'Å' пÃ'â€"д подÃ'â€"Ã'â€" Ã'ÐºÃ'â€" лиÃ'ˆÐ¸Ð² Ã'â,¬ÃÂ¾ÃÂ·ÃÂ·Ã'â,¬ÃÂ¾ÃÂ±ÃÂ½ÃÂ¸ÃÂº , лÃ'â€"пÃ'ˆÐµ Ã' код пÃ'â€"д Ã'ÐµÐ±Ðµ пÃ'â€"дÃ'Ã'‚Ã'â,¬ÃÂ¾Ã'Ž нÃ'â€"ж бÃ'Æ'дÃ'Æ' згибаÃ'‚иÃ'Ã'Å' пеÃ'â,¬ÃÂµÃÂ´ Ã'‚Ã'â,¬Ã'Æ'дноÃ'‰Ð°Ð¼Ð¸ Ã'â€" говоÃ'â,¬ÃÂ¸Ã'‚и Ã'‰Ð¾ Ã'‚ак Ã'â,¬ÃÂ¾ÃÂ±ÃÂ¸Ã'‚и не пÃ'â,¬ÃÂ°ÃÂ²ÃÂ¸ÃÂ»Ã'Å'но Ã'â€" Ã'â,¬ÃÂ°ÃÂ· Ã'‚аке не пÃ'â,¬ÃÂ¾ÃÂ´Ã'Æ'мовалоÃ'Ã'Å' Ã'‚о Ã'‚Ã'â,¬ÃÂµÃÂ±ÃÂ° коÃ'â,¬ÃÂ¸Ã'Ã'‚Ã'Æ'ваÃ'‚иÃ'Ã'Å' Ã'‡Ð°Ã'Ã'‚ковим виÃ'â,¬Ã'â€"Ã'ˆÐµÐ½Ð½Ã'Ð¼

Snarky

(Mod hat on)

AlienCap, the language of this forum is English. Since you and IM seem to know each other, if it's easier for you to write in Russian or Ukrainian, why don't you just communicate directly?

That said, from glancing at your code snippets, I don't think monkey's response was appropriate. His code no doubt works perfectly, but as far as I can tell it doesn't actually do what IM was apparently looking for. (It's hard to tell, because as usual Insane Mind didn't properly explain what he was trying to do and where he was failing. However, I took the problem to be how to implement a text box that will not allow you to enter a non-supported character, i.e. it will ignore any other keypresses.) Your code may be flawed, but it does have a good stab at solving the task, and in that it was in fact helpful.

Voedino

#9
Bravo, Alien Cap!
I put your code in the Global (repeatedly executly) and it works!

Quote from: monkey_05_06 on Thu 22/01/2015 19:21:14
There's nothing built-in, but validating this type of input is really simple:
Thanks! Your code partly helped!

AlienCap

Quote from: Snarky on Sat 24/01/2015 16:30:24
(Mod hat on)

AlienCap, the language of this forum is English. Since you and IM seem to know each other, if it's easier for you to write in Russian or Ukrainian, why don't you just communicate directly?

That said, from glancing at your code snippets, I don't think monkey's response was appropriate. His code no doubt works perfectly, but as far as I can tell it doesn't actually do what IM was apparently looking for. (It's hard to tell, because as usual Insane Mind didn't properly explain what he was trying to do and where he was failing. However, I took the problem to be how to implement a text box that will not allow you to enter a non-supported character, i.e. it will ignore any other keypresses.) Your code may be flawed, but it does have a good stab at solving the task, and in that it was in fact helpful.

I certainly understand but when the soul comes to a boil as much text to check no desire.
And please re ask him what exactly the problem. I always do it.
and if you can explain where in the code the error when I look, I do not see it, if you see an error in the code that I am not a template, and for a specific task you wrote too carped.
and the forum usually get questions for which I have not found a simple solution by using an event or function in the hope that I'm just bad looking in Help. Valid but asks what the problem is, or can not avoid miscommunication

SMF spam blocked by CleanTalk