private string RunExtEditor_(TreeNodeAdv treeNodeAdv, string value, NodeCustomBox.EditMethod editMethod) { switch (editMethod) { case NodeCustomBox.EditMethod.Color: value = RunColorEditor(value); break; case NodeCustomBox.EditMethod.File: value = RunFilenameEditor(value); break; default: value = RunTextEditor(value); break; } return value; }
private void PushStringValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { _grtTree.set_field(node.NodeId, _valueColumn, value); }
private void PushIntValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { try { int intValue = 0; switch (editMethod) { case NodeCustomBox.EditMethod.Bool: switch (value) { case "": case "False": intValue = 0; break; default: intValue = 1; break; } break; default: try { Decimal d = Decimal.Parse(value, System.Globalization.NumberStyles.Float); intValue = Decimal.ToInt32(Decimal.Round(d, 0)); } catch (Exception) { } break; } _grtTree.set_field(node.NodeId, _valueColumn, intValue); } catch (Exception ex) { MessageBox.Show(String.Format("The value you have entered is not an integer value.\n\n({0})", ex.Message)); } }
private void PushRealValue(GrtTreeNode node, string value, NodeCustomBox.EditMethod editMethod) { try { double doubleValue = double.Parse(value); _grtTree.set_field(node.NodeId, _valueColumn, doubleValue); } catch (Exception ex) { MessageBox.Show(String.Format("The value you have entered is not a float value.\n\n({0})", ex.Message)); } }
void BeforeEdit_(TreeNodeAdv treeNode, NodeCustomBox customBox) { GrtTreeNode node = treeNode.Tag as GrtTreeNode; if (null == node) return; string editMethod; _grtTree.get_field(node.NodeId, _editMethodColumn, out editMethod); if (editMethod.StartsWith("numeric")) { string[] sa = editMethod.Split(new Char[] { ':', ',' }); if (1 < sa.Length) { for (int n = 1; sa.Length > n; ++n) { try { int v = int.Parse((string)sa.GetValue(n)); switch (n) { case 1: customBox.Minimum = v; break; case 2: customBox.Maximum = v; break; case 3: customBox.Increment = v; break; case 4: customBox.DecimalPlaces = v; break; } } catch (Exception) { } } } } }