PictureTab
Posted: Thu Mar 19, 2020 3:27 pm
The new crafting gui uses a new kind of tab, which the style inspector identifies as "class PictureTab".
Is there any chance we could use these in custom GUIs?
You can fake them to an extent by using a regular tab and then specifying a rich text img tag, with a specific font size scaled to your intended sprite size, as the caption. This works for most things - except that in the crafting gui, a disabled PictureTab has the picture rendered in greyscale, and there is no way I know of to achieve that with rich text (or sprites for that matter) short of generating actual duplicate monochrome versions of the desired sprites as a resource and then setting them as the caption ... I suppose you could do that with rich text but it'd be a faff. You also couldn't do it that way if your mod provides tabs of, e.g. item groups, because you can't prepare monochrome versions of every modded item group on the portal.
I had a look at the style defined for the crafting gui tabs (filter_group_tab) and it's a regular type tab_style definition, but there is no way to instance a PictureTab in the current API that I'm aware of.
Is there any chance we could use these in custom GUIs?
You can fake them to an extent by using a regular tab and then specifying a rich text img tag, with a specific font size scaled to your intended sprite size, as the caption. This works for most things - except that in the crafting gui, a disabled PictureTab has the picture rendered in greyscale, and there is no way I know of to achieve that with rich text (or sprites for that matter) short of generating actual duplicate monochrome versions of the desired sprites as a resource and then setting them as the caption ... I suppose you could do that with rich text but it'd be a faff. You also couldn't do it that way if your mod provides tabs of, e.g. item groups, because you can't prepare monochrome versions of every modded item group on the portal.
I had a look at the style defined for the crafting gui tabs (filter_group_tab) and it's a regular type tab_style definition, but there is no way to instance a PictureTab in the current API that I'm aware of.