Trying to understand this combobox

This commit is contained in:
Malcolm Roberts 2024-02-07 11:12:52 -06:00
parent 8ef47d79ff
commit 59c496305a
5 changed files with 239 additions and 498 deletions

View File

@ -26,15 +26,11 @@
"margin": [5, 5, 5, 5] "margin": [5, 5, 5, 5]
}, },
"mr.quest_writer.run_path_properties.quest_item": { "mr.quest_writer.run_path_properties.quest_item": {
"type": "itemview",
"content": {
"type": "stackpanel",
"children": [
{
"type": "textblock", "type": "textblock",
"text": "test" "padding": 2,
} "textBinding": {
] "pullFormat": "${_CONTEXTITEMDATA_.Get[name]}",
"pullReplaceNull": ""
} }
} }
}, },
@ -194,28 +190,30 @@
{ {
"type": "stackpanel", "type": "stackpanel",
"orientation": "horizontal", "orientation": "horizontal",
"widthFactor": 1,
"children": [ "children": [
{ {
"type": "combobox", "type": "combobox",
"widthFactor": 0.8,
"margin": [0, 0, 5, 0],
"itemViewGenerators": { "itemViewGenerators": {
"default": { "default": {
"type": "template", "type": "template",
"template": "mr.quest_writer.run_path_properties.quest_item" "template": "mr.quest_writer.run_path_properties.quest_item"
} }
}, },
"itemsBinding": { "items": [
"pullFormat": "${MRKillMobsPropertiesController.QuestList}", {
"pullReplaceNull": "", "name": "abc"
"autoPull": "false", },
{
"pushFormat": [ "name": "123"
"MRKillMobsPropertiesController.SelectedQuest:Set[", },
"]" {
] "name": "def"
},
{
"name": "456"
} }
]
}, },
{ {
"type": "button", "type": "button",
@ -234,6 +232,7 @@
}, },
{ {
"type": "combobox", "type": "combobox",
"itemsBinding": { "itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestStepList}", "pullFormat": "${MRKillMobsPropertiesController.QuestStepList}",
"pullReplaceNull": "", "pullReplaceNull": "",

View File

@ -86,6 +86,7 @@ objectdef MRBotApi
echo "waiting for path to complete ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${location.X},${location.Y},${location.Z}]}" echo "waiting for path to complete ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${location.X},${location.Y},${location.Z}]}"
wait 5 wait 5
} }
}
function ActivateSpecial(string ActorName, float X, float Y, float Z) function ActivateSpecial(string ActorName, float X, float Y, float Z)
{ {
@ -250,8 +251,6 @@ function get_Archetype(string ToonClass)
} }
;=================================================================================== ;===================================================================================
}
} }

View File

@ -1,268 +0,0 @@
{
"$schema": "http://www.lavishsoft.com/schema/lgui2Skin.json",
"type": "skin",
"name": "mr.dark",
"brushes": {
"background": {
"color": [0.15, 0.15, 0.15]
},
"controlBackground": {
"color": [0.3, 0.3, 0.3]
},
"selectedBackgroundBrush": {
"color": [0.5, 0.5, 0.5]
},
"titleBarBackground": {
"color": [0.1, 0.1, 0.1]
},
"text": {
"color": [0.9, 0.9, 0.9]
},
"border": {
"color": [0.5, 0.5, 0.5]
},
"titleBarCloseTexture": {
"color": [1.0, 1.0, 1.0],
"opacity": 0.7,
"imageFile": "${LavishScript.HomeDirectory}/Scripts/mr/ui/icons/close_button_3.png"
},
"titleBarMinimizeTexture": {
"color": [1.0, 1.0, 1.0],
"opacity": 0.7,
"imageFile": "${LavishScript.HomeDirectory}/Scripts/mr/ui/icons/minimize_button_3.png"
}
},
"templates": {
"window": {
"backgroundBrush": "background",
"titleBar": {
"jsonTemplate": "window.titleBar"
}
},
"window.titleBar": {
"backgroundBrush": "titleBarBackground",
"font": {
"face": "Tahoma",
"height": 16,
"bold": true
},
"children": [
{
"type": "button",
"jsonTemplate": "button",
"_dock": "right",
"borderThickness": 0,
"borderColor": [0],
"content": {
"type": "imagebox",
"margin": [0],
"width": 20,
"imageBrush": "titleBarCloseTexture"
},
"padding": 0,
"eventHandlers": {
"onMouse1Release": {
"type": "forward",
"elementType": "window",
"event": "onCloseButtonClick"
}
}
},
{
"type": "button",
"jsonTemplate": "button",
"_dock": "right",
"borderThickness": 0,
"borderColor": [0],
"content": {
"type": "imagebox",
"margin": [0],
"width": 20,
"imageBrush": "titleBarMinimizeTexture"
},
"padding": 0,
"eventHandlers": {
"onMouse1Release": {
"type": "forward",
"elementType": "window",
"event": "onShadeButtonClick"
}
}
}
]
},
"textblock": {
"color": "text",
"font": {
"face": "Tahoma",
"height": 14,
"bold": false
}
},
"button": {
"type": "button",
"backgroundBrush": "controlBackground",
"borderRounding": 0.3,
"color": "text",
"opacity": 0.8,
"styles": {
"gotMouseOver": {
"opacity": 1.0
},
"lostMouseOver": {
"opacity": 0.8
},
"onPress": {
"opacity": 0.8
},
"onRelease": {
"opacity": 1.0
}
}
},
"itemview": {
"type": "itemview",
"acceptsKeyboardFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
},
"padding": [2, 2, 2, 2],
"margin": [1, 1, 1, 1],
"backgroundBrush": "controlBackground",
"styles": {
"onSelected": {
"backgroundBrush": "selectedBackgroundBrush"
},
"onDeselected": {
"backgroundBrush": "controlBackground"
}
}
},
"listboxitem.gotMouseOver": {
"font": {
"bold": true
},
"opacity": 1.0
},
"listboxitem.lostMouseOver": {
"font": {
"bold": false
},
"opacity": 0.8
},
"listboxitem": {
"jsonTemplate": "itemview",
"padding": [1, 125, 1, 125],
"styles": {
"gotMouseOver": {
"jsonTemplate": "listboxitem.gotMouseOver"
},
"lostMouseOver": {
"jsonTemplate": "listboxitem.lostMouseOver"
}
}
},
"listbox.contentContainer": {
"jsonTemplate": "scrollviewer",
"type": "scrollviewer",
"acceptsMouseFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
}
},
"listbox.contentContainerFitWidth": {
"jsonTemplate": "listbox.contentContainer",
"horizontalScroll": "fit"
},
"listbox.content": {
"type": "stackpanel",
"uniform": true,
"backgroundBrush": "background"
},
"listbox": {
"defaultItemViewTemplate": "listboxitem",
"acceptsKeyboardFocus": true,
"borderThickness": 1,
"borderBrush": "border",
"contentContainer": {
"jsonTemplate": "listbox.contentContainer"
},
"content": {
"jsonTemplate": "listbox.content"
}
},
"comboboxselection": {
"jsonTemplate": "itemview",
"padding": [2, 2, 2, 2],
"margin": [1, 1, 1, 1],
"horizontalAlignment": "left",
"verticalAlignment": "center",
"eventHandlers": {}
},
"popup.panel": {
"type": "panel",
"borderBrush": "border",
"backgroundBrush": "controlBackground"
},
"popup": {
"type": "popup",
"strata": 1.1,
"acceptsMouseFocus": false,
"backgroundBrush": "controlBackground",
"contentContainer": {
"jsonTemplate": "popup.panel"
}
},
"combobox.popup.content": {
"jsonTemplate": "listbox",
"type": "listbox",
"borderThickness": 0
},
"combobox.popup": {
"type": "popup",
"jsonTemplate": "popup",
"backgroundBrush": "controlBackground",
"contentContainer": {
"jsonTemplate": "popup.panel",
"type": "anchor",
"anchorToElement": {
"elementType": "combobox",
"elementTree": "logical",
"flags": "ancestor"
},
"clipToParent": false,
"anchorLocationFactor": [0.0, 1.0]
},
"content": {
"jsonTemplate": "combobox.popup.content"
}
},
"combobox": {
"type": "combobox",
"backgroundBrush": "controlBackground",
"borderBrush": "border",
"borderRounding": 0.3,
"padding": [5, 3, 5, 3],
"acceptsKeyboardFocus": true,
"minSize": [40, 0],
"fitContentContainer": false,
"headerContainer": {
"type": "border",
"verticalAlignment": "center"
},
"selectedItemViewTemplate": "comboboxselection",
"popup": {
"jsonTemplate": "combobox.popup"
},
"contentContainer": {
"type": "panel"
}
}
}
}

View File

@ -3,6 +3,11 @@ objectdef MRTestController
method Initialize() method Initialize()
{ {
LGUI2:LoadPackageFile["window.json"] LGUI2:LoadPackageFile["window.json"]
variable jsonvalue editor_ui
editor_ui:ParseFile["${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/kill_mobs_properties/editor_ui.json"]
; LGUI2.Element["mr.test.test_panel"]:AddChild[editor_ui]
} }
method Shutdown() method Shutdown()
@ -21,13 +26,10 @@ variable(global) MRTestController TestController
function main() function main()
{ {
LGUI2:LoadSkinFile["${LavishScript.HomeDirectory}/Scripts/mr/ui/mr.dark.skin.json"] LGUI2:LoadSkinFile["${LavishScript.HomeDirectory}/Scripts/mr/ui/mr.dark.skin.json"]
LGUI2:PushSkin["mr.dark"]
while 1 while 1
{ {
wait 5 wait 5
} }
LGUI2:PopSkin
} }

View File

@ -1,69 +1,78 @@
{ {
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json", "$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"templates": {
"mr.templates.combobox_item": {
"jsonTemplate": "listboxitem",
"padding": 2,
"content": {
"type": "textblock",
"textBinding": {
"pullFormat": "${_CONTEXTITEMDATA_.Get[name]}",
"pullReplaceNull": ""
}
}
}
},
"elements": [ "elements": [
{ {
"type": "window", "type": "window",
"title": "Test", "title": "Test",
"name": "mr.test.window", "name": "mr.test.window",
"hideOnClose": false, "hideOnClose": false,
"minSize": { "minSize": {
"width": 650, "width": 500,
"height": 350 "height": 500
},
"maxSize": {
"width": 950,
"height": 650
}, },
"eventHandlers": { "eventHandlers": {
"onCloseButtonClick": ["method", "TestController", "OnClose"] "onCloseButtonClick": ["method", "TestController", "OnClose"]
}, },
"content": { "content": {
"type": "stackpanel",
"orientation": "vertical",
"children": [
{
"type": "stackpanel",
"name": "mr.test.test_panel",
"orientation": "vertical",
"children": [
{
"type": "stackpanel", "type": "stackpanel",
"orientation": "horizontal", "orientation": "horizontal",
"children": [ "children": [
{
"type": "stackpanel",
"orientation": "vertical",
"margin": [0, 0, 15, 0],
"children": [
{
"type": "textblock",
"text": "Test Window",
"margin": [0, 0, 0, 15]
},
{
"type": "button",
"content": "Click me",
"margin": [0, 0, 0, 15]
},
{ {
"type": "combobox", "type": "combobox",
"minSize": { "itemViewGenerators": {
"width": 100 "default": {
}, "type": "template",
"items": ["Item 1", "Item 2", "Item 3"], "template": "mr.templates.combobox_item"
"margin": [0, 0, 0, 15]
} }
]
},
{
"type": "stackpanel",
"orientation": "vertical",
"children": [
{
"type": "listbox",
"minSize": {
"width": 100
}, },
"items": [ "items": [
"Item 1111111111111111111111111111111111111111111111111111111111111111111111111111111", {
"Item 2", "name": "abc"
"Item 3" },
{
"name": "123"
},
{
"name": "def"
},
{
"name": "456"
}
] ]
} }
] ]
},
{
"type": "textblock",
"text": "Test Text"
}
]
} }
] ]
} }