Adding floating tile colours to LAF
-
@d-healey Why don't you just use
c
instead of creatingft
? -
@ustk I tried that first,
c
doesn't contain the colour data, I need the parent floating tile. -
@d-healey I see... And what about
&ft
? -
@ustk
error: cannot convert ‘juce::Component*’ to ‘juce::Component&’
-
@d-healey Have you tried
auto& ft = c.getParentComponent();
or evenauto& ft = getParentComponent();
Just guessing... -
@ustk Yup
-
@d-healey The more I learn C++, the less I understand C++...
-
@ustk I found part of the solution. I have to dereference the pointer:
auto& ft = *c.findParentComponentOfClass<FloatingTile>();
However this now returns all the colours are
0
-
@d-healey It's better to dereference the pointer in the function calls as habit. If you forget to add the
&
-operator, it will create a copy of the object the pointer was targeting and this can be only detected on runtime. It's one of the more annoying things in C++auto ft = c.getParentComponent(); setColourOrBlack(obj, "bgColour", *ft, HiseColourScheme::ComponentOutlineColourId);
In this special case there are some mechanism in place that prevent copying the FloatingTile object, but this is not true for more lightweight objects that just hold some data.
-
@Christoph-Hart Thanks for the tip! Still all the colours are coming through as
0
. I assume I'm misunderstanding where the floating tile's colour data is stored.