private void btn_edit_Click(object sender, RoutedEventArgs e) { int idx = lb_P.SelectedIndex; if (idx < 0) { return; } PEditor pEditor = new PEditor(); pEditor.txt_P.Text = lb_P.SelectedItem.ToString(); if (pEditor.ShowDialog() == true) { string result = pEditor.getResult(); if (result.Trim().Length <= 0) { return; } lb_P.Items[idx] = result; } }
private void btn_add_Click(object sender, RoutedEventArgs e) { PEditor pEditor = new PEditor(); pEditor.txt_P.Text = "123"; if (pEditor.ShowDialog() == true) { string result = pEditor.getResult(); if (result.Trim().Length <= 0) { return; } lb_P.Items.Add(result); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Begin(position, property, label); currentPosition.height = EditorGUI.GetPropertyHeight(property, label); currentPosition = EditorGUI.PrefixLabel(currentPosition, label); BeginIndent(0); EditorGUI.PropertyField(currentPosition, property, GUIContent.none); EndIndent(); currentPosition.x -= 21f; currentPosition.y -= 1f; PEditor.Errors(currentPosition, errors); End(); }