New Feature (Probably?) Adds Full Component Access in LAF
-
There's didn't seem a way (that I can see) to access a component's properties directly when referenced in an LAF function—you can only use LAF-specific ones (which differ for each component). Solution is to add a widget.id to the available member variables. Adding the C++ to do that was simple enough (and works), but only gives me a string with the name of the component—how do I, in Javascript create a reference with the name of a string? (And this assuming it's all a good idea.)
-
-
What is the end result you're going for?
-
@clevername27 Thank you for your response - you always seem to have time to help. The lines of text with the green check mark work. The ones in red don't—they are the things I am trying to do. Essentially, I'm not understanding why the eval code doesn't execute as I expect (hope) it to.
-
From my experience with
eval()
in HISE script it's mainly useful for evaluating mathematical strings. I don't think it can be used for running functions as in your example.Not sure if you've seen my video about
eval
so I'll post it here:https://www.youtube.com/watch?v=-Q7nzezbgAY
Also for buttons the enabled property is available in LAF functions.
obj.enabled
I think is the one.I just noticed also the construction of your laf function registration is not using standard parameter names. This might make a difference to the auto complete. Also conceptually
obj
is not the same aswidget
.It should be:
laf.registerFunction("drawToggleButton", function(g, obj) { });
-
@d-healey Thanks again for your feedback, Dave. A better way to describe what I'm trying to do—I want to access all of a components properties from its LAF. I've done the hard bit of changing the C++ code so I can get the component's ID from within the LAF. But I need to turn that name into a reference of the same name so I can use the GET and SET methods.
I guess I could write C++ wrappers for the specific component properties I want to access from the LAF, but it's not an elegant solution. Thanks again for your thoughts.
-
But I need to turn that name into a reference of the same name so I can use the GET and SET methods.
Get the reference in
on init
and stick it in an object, using the ID of the component as the key. -
@d-healey Thy art a genius, thank you. I will post my addition to my LAF tutorial, and upload. Specifically, the modification allows you to have contextual tooltips (i.e. separate tooltips for enabled and disabled states) by specifying both (with '|' as the delimiter in the object's property editor. Basically, a drop in replacement for tooltips.
-
-
@d-healey I guess I upload the new source code file as well, or is it better for me to tell people what code to add, where (to the C++)?
-
@clevername27 Make a pull request if you think it should be part of the codebase.
-
@d-healey I spoke too soon - I've only been able to get this to work when using quotes – could you please show me an example?
-
-
@clevername27 I can't give an example because I don't have your additions. Maybe you could post the code that isn't working and I'll see if I can spot any issues. BTW I think it's already possible to create tooltips in the way you describe for enabled/disabled components. Without using laf.
-
@clevername27 this is an example with custom made tooltip panel, and LAF knob with different tooltip.
Maybe it's not a good idea to get a reference to the component inside the laf, I remember Christoph talked about not using outside references and I don't know if that has changed?Anyway, you can accomplish to have separate tooltips for enabled/disabled (this is actually not disabling the component, because if you do, you'll get not response from the obj at all, no obj.hover)
What I did was in the Knobs callback, check if it's "text" property has a "1" or not.
A bit cumbersam yeah I know but...HiseSnippet 1455.3ocsW0maaaCEWJIJnRacncXG.B8Wx.dt1ccsCsHq9yTXD2DiZuhALrVvHQYwEYRMI5jZrVfgcU1QXWfcA1cXGgcC1djTxRtwwMM.SHHVjuO3u268ijOMNk6Sxx3oFl1SWlPLL+TqIKYhndQXJyXXe4Dw3PAmGKnIFcWlfyxHAFll69LoFl16Ynd9mm1EGiY9jxoLLdIm5SFQmSEkyNt8Qz33CwAjoz4Uz9AsG5yY83w7E.Z10poQB1+L7LxwXoZ6XYXt+f.pfmNQfEjLPmt7fkSh3Wvz5+RZF8zXhbPKiIfizSazKhFGLtHRyLLL2abYbuqNt+BqmSCnqluL9uiR.pzhp4.yc1FjZ8Q.IyJPZOMjtq0D+TZhnThDOeh0PlfjFhgTcUnn00Xm+XeqdbPClnwb7YjCSgAqrv6gMaVGA+q1Sbbfzcl.cNNEcDieJ5.TgcyHhd74IbFLvyUJzEzuTcodo73XRvVMbc0V2ESAB0TZxUZatboQN4u2HiHFCUEwK3KDTFwKbAyWP4LuY0b9EG6YREz7GO8OYMtHhJHfO.gAo3K5DSmwHASIuQ3IhnYMBvBbibxccjZJ.Gi3933t7ErfLul0pibiIgBITdWYZ6H1oivgUvueJA3.JSGw4m0gEbHgD6IsPqaiTxLZFTHNr.2tRL8Bt.mtbRLMfj5VGUFT0Q7S+IUjISX33jHL.QZBDMN126dH+Hh+YHZHhvv.GK.wSQAzL060QPt.QEHr.hJBxuHylgDPviRvovtJ.KZmW3gCjKYCkFGb.xskK5oHQ5BB5wnPbbFIe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MvlGdCr4Q2.a9lsZi76X6rPvmq2N.SLdf5lBSS8IWJVnw+wXSdYL
-
I remember Christoph talked about not using outside references and I don't know if that has changed
It seems to not cause any issues. But I still avoid it generally, unless there is no alternative. In the case of tooltips I don't see any reason to involve laf, it can all be done with panels/timers/broadcasters already.
-
@d-healey thank you David, do you have Broadcaster example that listen to MouseEvents, hover?
-
@ulrik See the last post in this thread (with the link to Christoph's example) - https://forum.hise.audio/topic/6104/tooltip-panel-is-not-working-on-the-project-i-m-working-on/18
-
Thank you, @d-healey for your many comments. Thank you, @ulrik, for taking the time to write this code - an elegant solution. There's simply too many widgets in my script for me to alter the meaning of enabling, though. I must be the last person to learn that, while disabled states are passed to LAF functions, mouse-overs are only passed if the component is enabled. So, while I've got access to a component's tooltip within the LAF function, it's ultimately not useful. I think what I'm trying to do (separated tooltips for enabled and disabled states, by writing only a single function) just isn't what the built-in functions are for.
-
I think what I'm trying to do (separated tooltips for enabled and disabled states, by writing only a single function) just isn't what the built-in functions are for.
You can achieve this with other (non laf) functions.Oh I just reread what you said about the mouse events not triggering for disabled components. Seems this is also the case for broadcasters so indeed it won't work! -
@d-healey said in New Feature (Probably?) Adds Full Component Access in LAF:
Oh I just reread what you said about the mouse events not triggering for disabled components. Seems this is also the case for broadcasters so indeed it won't work!
Actually the broadcaster will work also for deactivated components.
HiseSnippet 1712.3ocsXstaSbDEd2jro3sEJHQ6um3ePWWBF6xkVAMPH2PQPRbqCTpPonw6N16TVOi0NyFGWDR7bzGi9DzGIdCZOmYu30WRTZTwJJwyYlyY9N2OSZEK8YJkL1xtxgiFvrr+Bm1iD5vMCobg0taYY+UNaDKoA9TklESNTJiz7AVaLZ.UoXAV11K9T7n1UVxx74iOdCZDU3yFSxx5kRtO6479b8XpsV+Y7nncnArC48Kc56t9t9RwlxHYB.qEcZXMf5+VZO19T7XK3XYu71AbsLtslpYJK6k1PFLpcnbnH87ujq3chX3hlVsAAkRdGYT.hXjp0lg7nfV4puxBjRqwFiESMFW2YOd.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