Jump to content

[Feature Request] UserInterface from String or Span


photo

Recommended Posts

I asked about this, it's not supported.

With String Literals released now in C#, I'd like to make this a feature request.;

This would be a powerful addition and would make dynamic UIs easier. 

Using Concept. Not code...

List<(string WidgetXml, WidgetHandler handler)> widgetParts = new(init());
// WidgetParts are combinations of WidgetXml and a C# support objects.  
// For example, a group of buttons (xml) and event listeners(C#).
// They can be used to create libraries or "sub-components".

List used = widgetParts.Select(the ones I want...
WidgetContainer vBox = new();
WidgetController wc = new();
                               
// Build the XML
string NotAFile = $$"""
<?xml version="1.0" encoding="utf-8"?>
<ui version="1.0">
    {{ foreach used.Widget add XML }}
</ui>
    """;
                               
// Build the "Driver"              
GroupController GuiPort = new();
foreach used.Widget(){ GuiPort.add(widgetHandler) }

// Deploy and Bind
var ui = UserInterface(NotAFile);
GuiPort.Bind(ui);

GuiPort.UsedWidget1.Read;
GuiPort.UsedWidget1.Write;
                               

A use example is an object inspector pop-up. A World Object or Node can have any number of dynamically added Components. I want to R-Click to get details.
I can design my components with "Gui Fragments" - some XML and (optionally) backing code. One fragment could be a "pop-up Line" of XML.
This can be templated against Component fields.

Clicking an object walks through the components and joins the "pop-up lines" into an XML string - "MountedComponentStates".

Building and displaying a dynamic pop-up is a few short steps away if I can: UserInterface ui = new(MountedComponentStates).

UD: An advantage of dynamic builds is that current values can be baked into the XML, saving some build/populate cycles.

Edited by Tessalator
Link to comment
  • 8 months later...

Any progress on this? The XML support in node data lets me build/cache `.ui` widget elements from within my sim. But to use them I need to do two trips to the hardware.
Any chance of getting this moved up on the priorities?

Link to comment
×
×
  • Create New...