Example #1
0
        private void CreateMoneyWidget(MoneyQuestionManager widget, WindowsStyleProperties style, ref Control result)
        {
            TextBox input = ConstructTextbox <double>(widget, style, ref result);

            // Add listener
            input.TextChanged += delegate(object sender, EventArgs e) { ChangedMoneyWidget(widget, input); };
        }
Example #2
0
 private void UpdateMoneyWidget(MoneyQuestionManager widget, Control control)
 {
     foreach (Control c in control.Controls)
     {
         if (c.GetType() == typeof(TextBox))
         {
             ((TextBox)c).Text = widget.Answer.Value.ToString();
         }
     }
 }
Example #3
0
        private void ChangedMoneyWidget(MoneyQuestionManager moneyWidget, TextBox input)
        {
            QuestionElementValue <double> value = moneyWidget.ParseInput(input.Text);

            if (value.IsValid)
            {
                input.Text = value.Value.ToString();
                moneyWidget.SetAnswer(value.Value);
            }
            else if (input.Text != "")
            {
                input.Text = moneyWidget.Answer.ToString();
            }
        }