Table of Contents

Class PmpTextBox

Namespace
Hymma.Solidworks.Addins
Assembly
Hymma.Solidworks.Addins.dll

A text box control for SolidWorks property manager pages.

public class PmpTextBox : PmpTextBase<PropertyManagerPageTextbox>, IWrapSolidworksObject<PropertyManagerPageTextbox>, IReleaseSolidworksObject
Inheritance
PmpControl<PropertyManagerPageTextbox>
PmpTextBase<PropertyManagerPageTextbox>
PmpTextBox
Implements
IWrapSolidworksObject<PropertyManagerPageTextbox>
Inherited Members

Examples

Creating a text box with initial value:

var textBox = new PmpTextBox("Enter your text here", "Tooltip help text");
textBox.TypedInto += (sender, newText) =>
{
    Console.WriteLine($"User typed: {newText}");
};

// Add to a group
group.AddControls(new List<IPmpControl> { textBox });

Creating a multi-line text box:

var multiLineTextBox = new PmpTextBox("Default text")
{
    Style = TexTBoxStyles.Multiline,
    Height = 100
};

Remarks

Text boxes allow users to enter and edit text values. They can be styled as single-line or multi-line, and support various formatting options.

Use the TypedInto event to respond to text changes in real-time.

Constructors

PmpTextBox(string, string)

Creates a new text box control for a property manager page.

public PmpTextBox(string initialValue = "", string tip = "")

Parameters

initialValue string

The initial text displayed in the text box. Defaults to empty string.

tip string

Tooltip text displayed when hovering over the control.

Examples

// Simple text box
var nameBox = new PmpTextBox("John Doe", "Enter your name");

// Text box with event handler
var urlBox = new PmpTextBox("https://", "Enter URL");
urlBox.TypedInto += (s, text) => ValidateUrl(text);

Properties

Height

set the height of this control

public short Height { get; set; }

Property Value

short

Style

Styles as defined by bitmask TexTBoxStyles

public TexTBoxStyles Style { get; set; }

Property Value

TexTBoxStyles

Value

value for this text box

public string Value { get; set; }

Property Value

string

Methods

UnsubscribeFromEvents()

unsubscribe from events

public override void UnsubscribeFromEvents()

Events

TypedInto

Occurs when the user types into or modifies the text box content.

public event EventHandler<string> TypedInto

Event Type

EventHandler<string>

Examples

var textBox = new PmpTextBox("Enter value");
textBox.TypedInto += (sender, newText) =>
{
    // Validate input
    if (string.IsNullOrEmpty(newText))
    {
        ShowWarning("Value cannot be empty");
    }
};

Remarks

This event fires each time the text changes, allowing real-time validation or processing of user input.

Important: Subscribe to this event before adding the control to a group via AddControls(IEnumerable<IPmpControl>).

See Also