VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_Inputfield.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 42 of file AVRUI_Link_Inputfield.cs.

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