Forum
    • Categories
    • Register
    • Login

    Adding floating tile colours to LAF

    Scheduled Pinned Locked Moved C++ Development
    11 Posts 3 Posters 1.5k 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 @David Healey
      last edited by

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

      Hise made me an F5 dude, browser just suffers...

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @ustk
        last edited by

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

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @David Healey
          last edited by

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

          Hise made me an F5 dude, browser just suffers...

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @ustk
            last edited by

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

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @David Healey
              last edited by ustk

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

              Hise made me an F5 dude, browser just suffers...

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @ustk
                last edited by

                @ustk Yup

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @David Healey
                  last edited by

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

                  Hise made me an F5 dude, browser just suffers...

                  David HealeyD 1 Reply Last reply Reply Quote 4
                  • David HealeyD
                    David Healey @ustk
                    last edited by David 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

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    Christoph HartC 1 Reply Last reply Reply Quote 1
                    • Christoph HartC
                      Christoph Hart @David 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.

                      David HealeyD 1 Reply Last reply Reply Quote 2
                      • David HealeyD
                        David 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.

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

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

                        25

                        Online

                        2.1k

                        Users

                        13.0k

                        Topics

                        112.6k

                        Posts