HISE Logo Forum
    • Categories
    • Register
    • Login

    Adding floating tile colours to LAF

    Scheduled Pinned Locked Moved C++ Development
    11 Posts 3 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk @d.healey
      last edited by

      @d-healey Why don't you just use c instead of creating ft ?

      Can't help pressing F5 in the forum...

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @ustk
        last edited by

        @ustk I tried that first, c doesn't contain the colour data, I need the parent floating tile.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @d.healey
          last edited by

          @d-healey I see... And what about &ft ?

          Can't help pressing F5 in the forum...

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @ustk
            last edited by

            @ustk
            error: cannot convert ‘juce::Component*’ to ‘juce::Component&’

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @d.healey
              last edited by ustk

              @d-healey Have you tried auto& ft = c.getParentComponent(); or even auto& ft = getParentComponent();
              Just guessing...

              Can't help pressing F5 in the forum...

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @ustk
                last edited by

                @ustk Yup

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @d.healey
                  last edited by

                  @d-healey The more I learn C++, the less I understand C++... 😆

                  Can't help pressing F5 in the forum...

                  d.healeyD 1 Reply Last reply Reply Quote 4
                  • d.healeyD
                    d.healey @ustk
                    last edited by d.healey

                    @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

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    Christoph HartC 1 Reply Last reply Reply Quote 1
                    • Christoph HartC
                      Christoph Hart @d.healey
                      last edited by Christoph Hart

                      @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.

                      d.healeyD 1 Reply Last reply Reply Quote 2
                      • d.healeyD
                        d.healey @Christoph Hart
                        last edited by

                        @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.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        33

                        Online

                        1.8k

                        Users

                        12.1k

                        Topics

                        105.0k

                        Posts