Can a label be clickable?
-
Is it possible to make a label clickable? E.g. to open a website, if it's an URL
I'm trying to make a simple version check showing update availability and
on click directing the user to the download pageconst VersionLabel = Content.getComponent("VersionLabel"); VersionLabel.set("text", "version "+Engine.getVersion()); Server.setBaseURL("https://www.morphoice.com"); const var versioncheck = {"plugin": "MorphDrum"}; Server.callWithGET("downloads/version-morphdrum.json", versioncheck, function(status, response) { Console.print("heres back from the server:" + trace(response)); if (response["version"]!=Engine.getVersion()) Content.getComponent("VersionLabel").set("text", "version "+Engine.getVersion()+ " (Update available)"); });
-
@Morphoice Use a button
-
@d-healey I was hoping to avoid another custom laf lol
-
@Morphoice Why?
-
@d-healey pure lazyness ;) But if it's a button I could include the update check into the laf routine and color it red to point the user to the update or something
-
-
@d-healey said in Can a label be clickable?:
https://forum.hise.audio/topic/11196/snippet-clickable-url-display-that-opens-the-displayed-url
thanks. one thing I always wondered, is ther ea way to view those snippets without having to quit the entire project and reopening it again later?
-
@Morphoice use the snippet browser, it‘s a separate HISE instance.
-
@Christoph-Hart said in Can a label be clickable?:
use the snippet browser, it‘s a separate HISE instance
I can open multiple instances of HISE anyway, is that not possible on other systems?
-
@d-healey nope I always wondered why not, because it happened once when I had different versions compiled... and was very useful
-
@Christoph-Hart got it! thanks
-
@Morphoice said in Can a label be clickable?:
I always wondered why not
Inferior operating system :p
-
@d-healey ;-))) I'm sure there is a setting somewhere
this is what I did now, according to your example snippet,... it's not opening the site though. Does that only work outside of HISE?
const VersionControl = Content.getComponent("VersionControl"); // // Check for latest version // Server.setBaseURL("https://www.morphoice.com"); Server.callWithGET("downloads/version-morphdrum.json", {"plugin":"MorphDrum"}, function(status, response) { if (response["version"]!=Engine.getVersion()) var version_latest = response["version"]; }); // // Paint Version Control Panel // VersionControl.setPaintRoutine(function(g) { var a = this.getLocalBounds(0); var version = Engine.getVersion()==latest_version ? "Version " + Engine.getVersion() : "Version " + Engine.getVersion() + " (update available)"; g.setFont("Oxygen", 13.0); g.setColour(Colours.white); g.drawAlignedText(version, [a[0], a[1], a[2], 13], "right"); g.drawAlignedText("www.morphoice.com", [a[0], 5, a[2], a[3]], "right"); }); VersionControl.setMouseCallback(function(event) { if (event.clicked) Engine.openWebsite("https://www.morphoice.com/plugins"); });
-
@Morphoice said in Can a label be clickable?:
it's not opening the site though
Did you enable allow mouse callbacks for the panel?
-
@Morphoice I've encapsulated it in its own .js script so I can include it in my other plugins and just have to put a VersionControl panel in the bottom right corner
-
@d-healey of course I did not LOL
-
@Morphoice said in Can a label be clickable?:
@Morphoice I've encapsulated it in its own .js script so I can include it in my other plugins and just have to put a VersionControl panel in the bottom right corner
so I can include it in my other plugins and just have to put a VersionControl panel AND ALLOW MOUSE CALLBACKS in the bottom right corner
-
@Morphoice said in Can a label be clickable?:
AND ALLOW MOUSE CALLBACKS
You could do it from your script then you don't have to remember to do it manually - or you can use a button instead of a panel.
-
@d-healey I was just wondering if it is possible to create an entire panel from script and not in the UI editor
-
I suppose it's
const var panel = Content.addPanel("Panel", 0, 0);
but getting the coordinates right will probably be a pain