HISE Logo Forum
    • Categories
    • Register
    • Login

    setMouseCursor consistency

    Scheduled Pinned Locked Moved Scripting
    17 Posts 3 Posters 863 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.
    • d.healeyD
      d.healey @tomekslesicki
      last edited by

      @tomekslesicki Not working for me with or without. Does the cursor set on the panel pass through to the child components?

      A broadcaster is probably better than a timer. https://docs.hise.dev/scripting/scripting-api/broadcaster/index.html#attachtocomponentmouseevents

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

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

        You don't need to query the current mouse position, you can just call this in the onInit callback:

        ScriptPanel1.setMouseCursor("PointingHandCursor", Colours.white, [0, 0]);
        

        It will then automatically switch to the cursor when you enter the component (or one of its subcomponents).

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

          @Christoph-Hart I think he only wants it to switch on the sub components

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

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

            @d-healey then just call it for every sub component you need it to change.

            Nope that's wrong. I forgot only the ScriptPanel has the setMouseCursor method. Maybe it’s better to spend my time improving my skills. That way, I'll be more useful to the community.

            T 1 Reply Last reply Reply Quote 4
            • T
              tomekslesicki @Christoph Hart
              last edited by

              @Christoph-Hart I saw that comment, I loved it! That being said, if you COULD lend some of those improved skills to allow custom cursors on non-panel components, I wouldn’t have to hack around like this! ;-)

              @d-healey Yeah, I want to set the cursor per component. I can get it to work as I described in the first post, but it’s not a real workable solution unfortunately. It’s strange, though, because I can get other functions to work - the Console prints just fine with the timer and sub-components nested in that panel, it’s just the mouse cursor that doesn’t like me.

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @tomekslesicki
                last edited by

                @tomekslesicki so I went back and improved my skills and here is a possible solution that is moderately hacky:

                HiseSnippet 971.3ocsVslaabCDlTVzvZSSPCPO.K7ujBDLzSGEDTDEKaWKzJGgJ2fVXDDPsKkWBuhbAWtwVnn.8bze0SPNQ8PzaPxv8gzpZUYYk18GK37hy2Lb3LbnR5vBCkJD15hYALD9qHilIzd87nbAp+wH7SHCngZlxNg0QyBnggLWDFuy2YXfKUDE+82u5HpOU3vVvBgdqj6v9A9TtdA2gc+dtu+oTW1E7o4ztU29NRQOouLBvyNjZn.py0zqXmSMpUffNiF5gvOibXswMqwZ0jViMYxyaVuUqFzwcNrcm1cZzg17Eiosa2dLsCBu6ItbsTMRS0rPXSOR5Najm7FQhCdKOjO1mYHpiFAdNgMpmG22cXVxIDgvEGtHUsSRp5aHC3t747Wjx95XA1KrHeRCWXcPp9C.R3bPpXBjdJYjihGnWHwfmGQ5KfSvIT3rIOTRzEU3OwjdRPCg9fozqYmp.h4VT9vZ0pZC+p7RKK37ITa+ApxNPxEZt3JOpvMfJX9g1eq8kYayULcO4z.o.HJu+Pi7l6Wopk887sF6arek2AHXhTUNvlKVA.pXUJ3fPldfLJj0KRAgOXapZmApkva+p1I0XgGbiGWypZeIDf0dWkWNIR3n4RgsTbtTydinbEqe0pj0uYY+OEMYxJkYvuR56yTqTrodWsNCKKhlNlopBoX+H1bEgy2kKZ1cyJZbRRm4TTJ5K352DvRoOU56ZJFLquaIFJ87.J11IEgvJcbo1SRK0NJRqkBDG1jRjDh5nX3muO.5AXdiuLyatBy+o9GS0TyclzHBhx.lRyMIS7wrO.coRtAUhbLK7ZsLHV2zRPHgm31Gmc+xTvE608HwqqitctC+8K6Nag2un6MbWMz1hf+CLB4w3W4oMTeDmjVm6Cx83iFFePv9vlNyrPAKBnJv1baxb7rD72aCNytMeFaVdh+Mmz.kFZYp9KcyBuLN86pY2ZnIwWDYJyQ4FGwMSh3+JKhKh+OLharEQbyuzHd2Mn7MNlkYw7YqMlS70iHmKm6s6NU.lGIci7o5kGRYFemJ.ZBszjAS2eQHWOK+38GvjqZqcx0lBwmRFx0NdqFiEVAFgKT+efwz48OlbxjILG8B.Vjb5OusC2uG2+ixHyXqATshaJHNOZ5HXlkCC7tvLsyTaTvzYLgtlg1jAFwDtwDeB9REV2PiSEVOSHZJ0QIeuSRqUyKJ1KlCfIQ7KtJAO8CnsWQ+7ovCbduiyxa0cLrw1ZXys0vVaqgs2VCObaM74aqgcteCMu+70QZ4zjqMHzfgmDOADiOQPgJv3pUzmQ1L0nO
                

                So basically you just have to put your components into a small panel with the same size, then set the mouse cursor for these small panels. If you have a lot of UI elements it might be cumbersome to setup but you should be able to write a script function that does this for you (adding a panel, setting it to the same dimensions as the UI element and set its cursor).

                T 1 Reply Last reply Reply Quote 0
                • T
                  tomekslesicki @Christoph Hart
                  last edited by

                  @Christoph-Hart thank you, I could do it this way, but I have a ton of controls to nest like this, and editing such a project wouldn’t be very effective in the long run.

                  Would it be possible to either enable setting the mouse cursor for other components, or to fix whatever is causing the current implementation not to work consistently?

                  The script I posted in the first post works and the logic seems correct (I guess?) but I need to edit it (as described in the first post) and compile it a couple of times for HISE to register the mouse change properly.

                  Thank you!

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @tomekslesicki
                    last edited by

                    @tomekslesicki Is it just buttons that you want to change?

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tomekslesicki @Christoph Hart
                      last edited by

                      @Christoph-Hart yup!

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @tomekslesicki
                        last edited by

                        @tomekslesicki Alright, I've added a script property to the button to set a standard cursor type.

                        BTW, you can also change the cursor type using CSS, which is available for all components:

                        const var laf = Content.createLocalLookAndFeel();
                        
                        laf.setInlineStyleSheet("
                        
                        button
                        {
                        	cursor: pointer;
                        }
                        
                        label
                        {
                        	background: #444;
                        	text-align: center;
                        	cursor: text;
                        }
                        
                        ");
                        
                        Content.getComponent("Button2").setLocalLookAndFeel(laf);
                        Content.getComponent("Label1").setLocalLookAndFeel(laf);
                        
                        T 1 Reply Last reply Reply Quote 2
                        • T
                          tomekslesicki @Christoph Hart
                          last edited by

                          @Christoph-Hart Epic, thank you! Your skills benefit the community <3

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            tomekslesicki @tomekslesicki
                            last edited by tomekslesicki

                            @Christoph-Hart actually, the script property method works great if the buttons are not nested in panels, but doesn't work when they are. The same applies to the CSS method. Here is a minimal snippet:

                            HiseSnippet 851.3ocsV0sSaCCE1tPPP2fMj1CPTuBlPnz0zBSno00BLp1.pVYncGx0wkXQhcThCPEZR6QXOR6QYOB6MX63jz1DnCXUZ8hpd9+yG+cNtcCkTVTjLDgKexv.FB+TidCEJ21tDt.0YWDdEiCIQJVnYppVCCHQQLGDFO260JvKMOJ4yudaKhGQPYSTgPmJ4T1G49b0Dsca9Atm29DG1Ib+bda2rCUJZK8jw.dlyvBEPnWPNmcDQ6VICzAjHWD9kFMnuttUelU85aaWaaa6F1MpaMvp1f9a2vtessrq4XWuJsFBuvdNbkLrmhnXQH77sjNC64JuRjVfS4Q79dLsPUTOnxop2W54nOhZsn1tbOmtiZTQHHKcmz1lKss8BiC4N7w5mz9ddhAyIQjuAhKUDdyU.dU+avaJPBmCRymBoUM5QC4ApIVz34IFcDvs4.BbOkGJo9hJsC1nsD7Pn1zmbAa+PPXbDq0vxZCS3q02obY3tJRYdIIzLM1VwJkTT07MliRv4LUaoefT.BqUofWUzYnflMiXfS9x3HV63P.tU1vrRWIWn3hyOfHbxzt9NChETEWJLkhijJ1wh0Vu7MkWp7WKadaSCFLUaZ.FJ87XgS0rlVFdeAtlH1uOKbC3z6EyF6Hz5Kdetvi69jl1ux4nTzQvUGGvxjueBIJqgq4AYHDbUkvBVwHeWFwgj7rBpphRND4GZQetytDEYT5fLCUKfEp35CEdW1kvPcJIaIicYQWnjAI9lcWCG7zhu7HJHQv7Rp8J40TEcMBaf0Ub3nebE2Q4NFL+7xltL94tS1d78aZVnRK9nOlWONGeizb3XgezuYVMMvNf7n5kJEPBgxjqd25.jiupWBbW9Jrt6NSlvNAoSrGQUbQgdcZlAfsUX5TOAJh3pg4W29Or8v5d2d7Xg3pFc4Jp6zwXoofQfA8+.iY6bW1XuACXT0D.Nuw9eYVWv9.k+SxX8E6gDUHWyZOJ1uG7NEkAUW.TgHMiojdVLU1ZDgtGS3jH7a3SlwpZYblwpiLh7IzP4YzzIX8V8ESz.XRj7B3RvSwfr4TFY8gGYNiRKlp6D3ql0.qMqAZOqAVeVCrwrF3VyZfa+vAp+O.uKVI8SGaPnC6tWxJVLdOAAXfIrUze.3Aph1.
                            

                            Could you please take a look at this? Thank you!

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              tomekslesicki @tomekslesicki
                              last edited by

                              I'm giving this a friendly bump.

                              T 1 Reply Last reply Reply Quote 0
                              • T
                                tomekslesicki @tomekslesicki
                                last edited by

                                @Christoph-Hart I checked the latest commit, that solves it! Thank you!

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  tomekslesicki @tomekslesicki
                                  last edited by

                                  Dear @Christoph-Hart would it also be possible to add the cursor type property to sliders as well?

                                  T 1 Reply Last reply Reply Quote 1
                                  • T
                                    tomekslesicki @tomekslesicki
                                    last edited by

                                    @Christoph-Hart ? :-)

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

                                    26

                                    Online

                                    1.8k

                                    Users

                                    12.1k

                                    Topics

                                    105.6k

                                    Posts