Events - nicklikescoffee/UltimateUiPlugin GitHub Wiki

Ultimate UI has the ability to subscribe to events as well as unsubscribe all events.

UI Add Event

UI Add Event will add an event to a Control. This is found under the XAML Commands section - and not the UI Add Event Commands section. The reason for this is quick access to a command that can add an event to any standard WPF Control. So that means this command is not bound to any specific Control, it will work on a TextBox, Button, DataGrid, or any other WPF Control.

Let's take a look at some code:

plugin command("UltimateUI.dll", "UI Load XAML", "<StackPanel>
			<TextBox x:Name=\"nameTextBox\" Text=\"Enter your name...\"/>
			<Button x:Name=\"sayHelloButton\" Content=\"Say Hello\" Width=\"100\" Height=\"35\"/>
		</StackPanel>", "False", "False", "False", "BaseLight", "Blue")
plugin command("UltimateUI.dll", "UI Add Event", "nameTextBox", "KeyUp", "AlertKey")
define AlertKey(#_key) {
	alert(#_key)
}

This code will create a basic UI for us to use and then subscribe to the KeyUp event on the TextBox Control. UltimateUI will pass the Key as the first parameter to the command you wish to use. This is an experimental feature and is unique to the Key events and the drop event. So you will not be able to pass a parameter for the other event types at this time.

The command, in this case, takes in the _key parameter and then alerts the value of that.

Specific Control Events

Several Controls have commands to subscribe to events in UltimateUI. Let's now subscribe a Button's Click event in UltimateUI:

plugin command("UltimateUI.dll", "UI Load XAML", "<StackPanel>
			<TextBox x:Name=\"nameTextBox\" Text=\"Enter your name...\"/>
			<Button x:Name=\"sayHelloButton\" Content=\"Say Hello\" Width=\"100\" Height=\"35\"/>
		</StackPanel>", "False", "False", "False", "BaseLight", "Blue")
plugin command("UltimateUI.dll", "UI Add Button Event", "Click", "sayHelloButton", "SayHello")
define SayHello {
	alert("Hello {$plugin function("UltimateUI.dll", "$UI Get TextBox Property", "Text", "nameTextBox")}")
}

When you click on the Button the SayHello command will run and alert the value of the TextBox in this example.

Unsubscribing Events

In UltimateUI you can unsubscribe from all events using the command UI Unsubscribe Events. You can then resubscribe to any events that you need at that time.

⚠️ **GitHub.com Fallback** ⚠️