How do I add buttons to a UI window like the ones in Routing Curve?
How do I add buttons to a UI window like the ones in Routing Curve?
I tried to look at the code, but it links to something that I cant seem to access.
Best Answer
-
I'll send you one example, and clean it up to share for the rest of the forum… But for now:
In the predicate for the feature you can create a button type like:
annotation { "Name" : "My Button" } isButton(definition.doSomething);Also you need to include a new parameter in your editing logic function, so the function definition looks something like this:
export function myEditLogic(context is Context, id is Id, oldDefinition is map, definition is map, isCreating is boolean, specifiedParameters is map, hiddenQueries is Query, clickedButton is string) returns map { //do stuff // … if (clickedButton == "doSomething") { definition.count = oldDefinition.count + 1; return anotherFunctionPerhaps(context, id, definition); } //… return definition; }When you "do stuff" you'll need to check for clickedButton (remember it will be a string) then… do something!
4
Answers
-
I'll send you one example, and clean it up to share for the rest of the forum… But for now:
In the predicate for the feature you can create a button type like:
annotation { "Name" : "My Button" } isButton(definition.doSomething);Also you need to include a new parameter in your editing logic function, so the function definition looks something like this:
export function myEditLogic(context is Context, id is Id, oldDefinition is map, definition is map, isCreating is boolean, specifiedParameters is map, hiddenQueries is Query, clickedButton is string) returns map { //do stuff // … if (clickedButton == "doSomething") { definition.count = oldDefinition.count + 1; return anotherFunctionPerhaps(context, id, definition); } //… return definition; }When you "do stuff" you'll need to check for clickedButton (remember it will be a string) then… do something!
4 -
Thank you, this can be a solution for a few different UI needs...
Now if only my real work would slow down enough for me to just sit and code for a while
1 -
YEEEHAAAW thanks for this legend!
1


