#Using `collection_index` in Form Buttons?
1 messages · Page 1 of 1 (latest)
Did u find the solution?
{
"a": {
"type": "stack_panel",
"orientation": "horizontal",
"size": ["100%", "100%"],
"collection_name": "form_buttons",
"layer": 0,
"controls": [{
"a@server_form.button": {
"collection_index": 0
}
}]
}
}
Oh can I also see the enherited namespace
yeah but idk where to put this collection in
here
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"anchor_from": "bottom_middle",
"anchor_to": "bottom_middle",
"factory": {
"name": "buttons",
"control_name": "server_form.custom_dynamic_button"
},
"collection_name": "form_buttons",
"bindings": [
{
"binding_name": "#form_button_length",
"binding_name_override": "#collection_length"
}
]
}
}```
or
1st one
alr i tried this but it didnt work
{
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"anchor_from": "bottom_middle",
"anchor_to": "bottom_middle",
"factory": {
"name": "buttons",
"control_name": "server_form.custom_dynamic_button"
},
"collection_name": "form_buttons",
"bindings": [
{
"binding_name": "#form_button_length",
"binding_name_override": "#collection_length"
}
],
"controls":[
{
"a@server_form.custom_dynamic_button": {
"size": ["40%", 1],
"collection_index": 0
}
}
]
}
}```
{
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"orientation": "vertical"
"collection_name": "form_buttons",
],
"controls":[
{
"a@server_form.custom_dynamic_button": {
"size": ["40%", 1],
"collection_index": 0
}
}
]
}
}
thank you but somehow the size works but not the offset
offset does not work on stack panels
is there an alternative?
uhh no
then how do i move buttons
like this?
{
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"controls":[
{
"a": {
"type": "panel",
"offset": ["5%", "0%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls":[
{
"a@server_form.custom_dynamic_button": {
"collection_index": 0
}
}
]
}
},
{
"b": {
"type": "panel",
"offset": ["10%", "0%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls":[
{
"b@server_form.custom_dynamic_button": {
"collection_index": 1
}
}
]
}
}
]
}
}```
truee
i need the collection name since the index is inside the panel inside the long controls
uhh, try playing with the values and properties
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | ----------------------------------------------------
Unknown properties found in def[a] from namespace[common]
- Unknown property [collection_name]
----------------------------------------------------
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | UI Control: b | ----------------------------------------------------
Unknown properties found in def[b] from namespace[server_form]
- Unknown property [collection_index]
----------------------------------------------------
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | ----------------------------------------------------
Unknown properties found in def[b] from namespace[common]
- Unknown property [collection_name]
----------------------------------------------------```
this is whats it says after i remove the orientation and collection_name
hmmm unparent the childs ig
how
don't cross posting.
remove the "types": "panel"
Like this or
{
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"controls":[
{
"a": {
"type": "panel",
"offset": ["5%", "0%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls":[
{
"a@server_form.custom_dynamic_button": {
"collection_index": 0
}
}
]
}
},
{
"b": {
"type": "panel",
"offset": ["10%", "0%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls":[
{
"b@server_form.custom_dynamic_button": {
"collection_index": 1
}
}
]
}
}
]
}
}```
if they dont then why does the offset on the "long_form_dynamic_buttons_panel" work
ok found the solution
and for all the people who use the search bar, this allows you to change specific/certain form buttons using collection_index
{
"buttons": {
"type": "panel",
"controls": [
{
"<": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls": [
{
"<@server_form.custom_dynamic_button": {
"collection_index": 0
}
}
]
}
},
{
">": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["85%", "80%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls": [
{
">@server_form.custom_dynamic_button": {
"collection_index": 1
}
}
]
}
}
]
}
}```
i said offset doesn't work on elements of a stackpanel
this is working because you have split the 2 buttons into it's other stacak
i had to bc i didnt find a another way to make it work
great if it works 👍🏻
afaik, you can only add offset if the element is inside a panel inside of a stack
like:
"stack"
"panel1"
"button1": offset
"panel2"
"button2": offset
like this
{
"long_form_dynamic_buttons_panel": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"orientation": "horizontal",
"collection_name": "form_buttons",
"controls": [
{
"a": {
"type": "panel",
"controls": [
{
"a@server_form.custom_dynamic_button": {
"offset": ["5%", "80%"],
"collection_index": 0
}
}
]
}
},
{
"b": {
"type": "panel",
"controls": [
{
"b@server_form.custom_dynamic_button": {
"offset": ["85%", "80%"],
"collection_index": 1
}
}
]
}
}
]
}
}```
im getting these errors
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | UI Control: a | ----------------------------------------------------
Unknown properties found in def[a] from namespace[server_form]
- Unknown property [collection_index]
----------------------------------------------------
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | ----------------------------------------------------
Unknown properties found in def[a] from namespace[common]
- Unknown property [collection_name]
- Unknown property [orientation]
----------------------------------------------------
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | UI Control: b | ----------------------------------------------------
Unknown properties found in def[b] from namespace[server_form]
- Unknown property [collection_index]
----------------------------------------------------
[UI][error]-UI Control: long_form | UI Control: page1 | UI Control: second | UI Control: long_form_dynamic_buttons_panel | ----------------------------------------------------
Unknown properties found in def[b] from namespace[common]
- Unknown property [collection_name]
- Unknown property [orientation]
----------------------------------------------------```
Wait.. i also tell you that this doesn't work in collection stacks
try changing the panels to stack panels and add the collection name + orientation
but it is same as this xd
XD
it's alright tho i will use that
another question how do i how do i make a server form fit the entire screen
and all screens also gui scale modifications
100%, 100%
Which element
well the issue is that i have a conditional rendering which shows screen if it's name is E and if i use the size 100% it doesnt work for some reason
"long_form": {
"controls": [
{
"default@common_dialogs.main_panel_no_buttons": {
"$title_panel": "common_dialogs.standard_title_label",
"$title_size": ["100% - 14px", 10],
"size": [225, 200],
"$text_name": "#title_text",
"$title_text_binding_type": "none",
"$child_control": "server_form.long_form_panel",
"layer": 2,
"bindings": [
{
"binding_type": "global",
"binding_name": "#title_text",
"binding_name_override": "#text"
},
{
"binding_type": "view",
"source_property_name": "(not (#text = 'E'))",
"target_property_name": "#visible"
}
]
}
},
{
"page1@server_form.test": {
"bindings": [
{
"binding_type": "global",
"binding_name": "#title_text",
"binding_name_override": "#text"
},
{
"binding_type": "view",
"source_property_name": "(#text = 'E')",
"target_property_name": "#visible"
}
]
}
}
]
},```
try changing the size of main_screen_content
to 100%?
yeah you can definitely try
^
change the size of main_screen_content to 100% and long form/page1 to 100%
sure
it got smaller
hmm
yep
any idea?
idk kinda busy sorry
alright
I think it should be this one, to make it change size
Sadly it's just the default form since I'm using a conditional rendering
If the form page name is not E then it will show the default one
have you tried adding "size": [nums, nums] to the test panel
Those are fixed numbers tho
My objective is to make the GUI work with all gui scale modifications
should be able to use percentage values
Tried but with no results
Depending on the use case, a lot of times its easier to just wrap all the stack child elements in a panel with 0 size, then you can manually offset their controls.
Would you mind showing me an example cuz I tried doing it and it didn't work
Maybe I did something wrong
I can tomorrow. Basically it would just be a panel with size [ 0, 0 ] and then you put the element you want to display in its controls
I think shane means this..
oh I missed that. Yea exactly
Check if I made any mistakes cuz I tried it
@granite marsh
You didn't set panel size to 0
true
the child panels?
Just make the panel size to 0 and try..
sure
If that doesn't work, you can stick with this ^
what about these errors @granite marsh
i think this is enough
"test": {
"type": "panel",
"layer": 3,
"anchor_from": "center",
"anchor_to": "center",
"controls": [
{
"[email protected]_image_border_white": {
"controls": [
{
"background": {
"type": "image",
"visible": false,
"texture": "textures/Black",
"size": ["100%", "100%"],
"alpha": 0.5,
"keep_ratio": false
}
},
{
"back_button@close_button": {
"anchor_from": "top_right",
"anchor_to": "top_right",
"offset": [-5, 5]
}
},
{
"buttons": {
"type": "panel",
"controls": [
{
"<@server_form.button":{"$button":0,"offset": ["5%", "80%"]}
},
{
"<@server_form.button":{"$button":1,"offset": ["85%", "80%"]}
}
]
}
}
]
}
}
]
},
"button": {
"type": "stack_panel",
"size": ["100% - 4px", "100%"],
"offset": ["5%", "80%"],
"orientation": "horizontal",
"$button":0,
"collection_name": "form_buttons",
"controls": [
{
"button@server_form.custom_dynamic_button": {
"collection_index": "$button"
}
}
]
},```
do you have it rn?
I cannot today, sorry
@acoustic ferry dm