PDA

View Full Version : Options: Collapse All



mattekure
February 19th, 2024, 16:16
Forge: https://forge.fantasygrounds.com/shop/items/1627/view

An extension which adds 2 buttons to the options window. Expand all groups and Collapse all groups.

Should work in all Core based rulesets.

Requires FG 4.5.0 so currently still in test only. I will release to production once 4.5.0 is released.

https://imgur.com/1u0oHX6

nephranka
February 19th, 2024, 17:35
Man, is this a god send! Thank you.

DrakePD
February 19th, 2024, 20:42
Nice!

nephranka
February 19th, 2024, 20:50
Not seeing it in the vault or on the ext list.

mattekure
February 19th, 2024, 21:07
Not seeing it in the vault or on the ext list.

At the moment, this is only available in the test channel. I built it using the 4.5.0 code currently in the test channel and does not work with the current Live version of FG. It should download to your extensions folder if you have switched to the test channel. the current version in test should be released in a few weeks, I think the target was sometime in early March.

nephranka
February 19th, 2024, 22:05
At the moment, this is only available in the test channel. I built it using the 4.5.0 code currently in the test channel and does not work with the current Live version of FG. It should download to your extensions folder if you have switched to the test channel. the current version in test should be released in a few weeks, I think the target was sometime in early March.

Thanks for the info.

johnecc
February 20th, 2024, 04:39
Hi Mattekure, that looks great, don’t know why it isn’t standard. One question, I assume the GM has to enable it, does it then work for players as well?

Zacchaeus
February 20th, 2024, 09:02
Hi Mattekure, that looks great, don’t know why it isn’t standard. One question, I assume the GM has to enable it, does it then work for players as well?

Players only have about 5 options. Is a collapsing thing needed for that?

mattekure
February 20th, 2024, 16:04
Hi Mattekure, that looks great, don’t know why it isn’t standard. One question, I assume the GM has to enable it, does it then work for players as well?

Yes, the GM has to enable the extension. Once enabled, the buttons will appear for both players and GM.

mattekure
February 20th, 2024, 16:05
Players only have about 5 options. Is a collapsing thing needed for that?

In my experience, most players dont really touch the options, so likely they will never even notice. For some GMs that run a lot of extensions, there may be more options that players interact with. From a coding perspective, its easier to just have it apply to both rather than try to separate them out.

deer_buster
February 20th, 2024, 22:57
Nice QoL improvement @mattekure! Not sure why something like this isn't part of the base build to begin with.

Zacchaeus
February 21st, 2024, 09:37
Nice QoL improvement @mattekure! Not sure why something like this isn't part of the base build to begin with.

It has just been added into the test build.

nephranka
February 21st, 2024, 10:42
Bam! Just like that. It is in!

mattekure
February 21st, 2024, 12:35
The functionality is now built into Core so this extension is no longer needed. I have delisted it on the forge.

MrDDT
February 21st, 2024, 16:57
Dang, that's record time!

Moon Wizard
February 21st, 2024, 16:59
It was a good idea; and actually something that had been on my list but low priority for a while. Thanks to @mattekure for bumping it. With the new UI changes we've been making, it was easier to add them before.

Regards,
JPG

mattekure
February 21st, 2024, 18:02
It was a good idea; and actually something that had been on my list but low priority for a while. Thanks to @mattekure for bumping it. With the new UI changes we've been making, it was easier to add them before.

Regards,
JPG

The new menubar system was really easy to add new buttons to. I was surprised at just how easy. The hardest part was trying to figure out how all the parts worked. For any developers who want to add buttons to the menubar, here is how I did it.

Create a windowclass to merge into the one you want to add menubars. In this case its the options windowclass. Then add something like the following on the windowmenubar_utilitybox. This adds a separator first and then adds my two buttons. You could probably do it entirely in the xml now that I think about it, but this was my initial solution



<root>
<windowclass merge="join" name="options">
<sheetdata>
<windowmenubar_utilitybox name="menubar">
<script>
function onInit()
if super and super.onInit then
super.onInit()
end
ToolbarManager.addSeparator(subwindow, "right");
ToolbarManager.addButton(subwindow, "collapse", "right");
ToolbarManager.addButton(subwindow, "expandall", "right");
end
</script>
</windowmenubar_utilitybox>
</sheetdata>
</windowclass>
</root>


the second part is to register the buttons and define the script that will run when pressed. I did this in a lua file.


function onTabletopInit()
ToolbarManager.registerButton("collapse",
{
sType = "action",
sIcon = "button_collapse",
sTooltipRes = "tooltip_collapse",
fnActivate = collapseOptions,
});
ToolbarManager.registerButton("expandall",
{
sType = "action",
sIcon = "button_expand",
sTooltipRes = "tooltip_expand",
fnActivate = expandOptions,
});
end

function collapseOptions()
--whatever
end

function expandOptions()
--whatever
end