VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_TMPInputfield.updateValue ( )
inlinevirtual

This method is executed when the runtime user changes the value of the UI element. This method should change the field on the actual target respectively.

Implements AVR.UI.Link.AVRUI_Link.

Definition at line 41 of file AVRUI_Link_TMPInputfield.cs.

42  {
43  // Do nothing if the user is still typing the value
44  if (input.isFocused) return;
45 
46  // Get the value currently displayed in the inputfield
47  string text = input.text;
48 
49  // Update it to the target, if possible.
50  try {
51  switch (memberType)
52  {
53  case MemberType.FIELD:
54  {
55  target.GetType().GetField(field).SetValue(target,
56  System.Convert.ChangeType(text, target.GetType().GetField(field).FieldType)
57  );
58  break;
59  }
60  case MemberType.PROPERTY:
61  {
62  target.GetType().GetProperty(field).SetValue(target,
63  System.Convert.ChangeType(text, target.GetType().GetProperty(field).PropertyType)
64  );
65  break;
66  }
67  }
68  }
69  catch(System.Exception) {
70  AVR_DevConsole.cwarn("Could not update the given target value to "+text, this);
71  }
72  }