Colour accent on preset select, laf fix?
-
@Straticah said in Colour accent on preset select, laf fix?:
@d-healey sounds good is this broadcaster thing hard to do
Not for me, maybe for you ;) I posted the code in that other thread.
and do i need to build a newer version of hise for that?
You'll need a build from yesterday or today.
there another solution to have the red accent the same width
Can't you just use the same width for the rectangle?
Also this
var a = [obj.area[0], obj.area[1], obj.area[2], obj.area[3]];
can just bevar a = obj.area;
-
@Straticah said in Colour accent on preset select, laf fix?:
Hey there, i am trying to have a colour accent on the front of a selected preset tab. This styles my tabs inside the favourite window aswell which does not look great. Can the red offset be coded differently so it is always the same size independent from the tab length?
HiseSnippet 1769.3ocwX8taaajDeoiYfEaR6Uf7.rPn3fROEERJYKaGDTYYYUXTmDAqzzhywnXE4JoslZW0kqrstz.Tbu.2qPeTtGk6y2mt2fqyRRIRJSm35lfRCXwcmY182L67uk8jBOZXnPhLJ8x4SoHi6Y1eNWMd+wDFGcXGjwCL6IogTEtsTbQHUhOZutn1ymRBCo9HCi670ZNMJsNJ54+8UsIADtGMcJD5UBlG8H1DlJc1ds9FVPPWhO8krIY3tQqC8D78EAhY.ptioMZJw6LxH5yIZ1VyDYb2C7YJgruhnngHi0aK7m2er3BdL+uhExFDP0CbP8gEJd5th.eMh0yh1eLKvu2BsODAqRuTawchsEOv7YLe1x4SsI+kHB3TIxZOLVKO7tSN34jEd1YfWAPxHCjVOFRetYeOIapJkhFOeh4gbEUNj.l8rPIlWzZWtt49BfCtp1DxYztRXvRIprkscUbiMse3Srr.SenBOH9n9HxP7SwGvGw3zZdRJnOecfX.IHdcORHNaOteWJMnhV1TopIoiXgv52cF2SwD7Jk8kjKhcjR7iNBX3PEcR4p3gK3ZTUrXvO9Pq2XYUZTMf2t.PqT9EWNeDkCL5znlFkkNmHwD.Zm.bWi..6D6SiDMdfS1AtYGT+zSAwsJUBCOrg3JZJJ5kJ7SeJt7d99vx1lvOq7CS3Q+jxCtbeZ.0SAbEvFHIx4keRFFut0coPfW8rI72+huOXoGIJd00OkJYYY83G6ANO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i7Oak894U1iHCVprQum6j8KxqrZeGcpvEMsthxA0RtpxQzs8LIZquqotYFzPvgL9FdKcJoPFJxxaJoYHu0vsUd2VcwhlaAUESXVMWK6cgVNB7+cosYOZ+UYQZ68fKbEB4vhTgOT5aQZXdavsTe2Hu9d3D31zI5az6YOcwdY0W6VPGxI279uZ92280cfFx.OY+vWqSjiIWPCESnOJLJoWso7QqXM.mkUsFeIXMlNljLA90+q+6Wgt5EcgqXK7mEPT4u2s9iMjP.pRl6xt5KzBUQTyy9wH9fcY7aJD+bydLk23hw3ZEfQnK0OFXL4SXbeyCFNDtYSJ.W2r62+w46UffaRoSw8LhRx.OJSn1cevW0iB6NGRYp6+2XMcWWwis0i0Vf9Ttezf+O7jPzQO1HgnyBhnIDOo3G7hu0g9ijrQzL.l3QdokLeldL1AEcSDPNS6Z1nILe1O34oU+GAWdnXYbuExT+VHSiagLadKjYqagLMuExr86TF8mJauYJwj3vAXhdGD0SrgwAbctsHuPzuATTxmoF
yes this was my attempt to make them same size but the scrolling bar makes it different in size sometimes so i thought maybe there is a more elegant way to create the same effect. Like making it left aligned or something :D Its a bit strange because of the scrolling bar on the right.
Can i assign width to a rectangle? maybe this fixes the issue of different sizes on different sized columns if you have an idea let me know otherwise ill use "same" column sizes for now and dont use favourites tab. -
@Straticah thats with same size
-
You probably need to change the width in your paint routine.
g.fillRoundedRectangle([a[0], a[1], a[2] - 273, a[3]], {CornerSize: 2, Rounded:[1, 0, 1, 0]});
a[2] - 273
is the width. You'll want to change it depending on the state of the favourite button (probably).I like the accent idea. Can I steal it?
-
@d-healey haha sure! if you let me steal the image buttons soon? ^^ i guess you will make a video about that, you can also show how to make only selected corners round, ppl need to know :)
There are not many tutorials targeting the hise browser i think. Tx for your help, really apprechiated.
-
@Straticah Good deal. I'll post a video about loading images into look and feel on Saturday.
-
@Straticah I'm guessing this bit didn't work for you?
if (obj.text == "Add a Bank") obj.text = "Select a library"; if (obj.text == "Select a Column") obj.text = "Select a Category";
-
@DanH
Should do, that's the code I'm using :)Oh you're right, he's put it in the wrong place. It needs to be in thedrawPresetBrowserColumnBackground
function. -
@d-healey ah yes just seen in the docs too, thanks!
-
@d-healey so you're just using that? Mine goes blank, do you not have to specify colours, fonts etc?
-
@DanH Yes that's only a tiny bit of the code.
presetBrowser.registerFunction("drawPresetBrowserColumnBackground", function(g, obj) { var a = obj.area; if (obj.text == "Add a Bank") obj.text = "Select a Library"; if (obj.text == "Select a Column") obj.text = "Select a Category"; if (a[2] > 300 && obj.text != "") obj.text = "No Results"; g.setColour(style.presetBrowser.columnBg); g.fillRoundedRectangle([a[0], a[1], a[2], a[3]], 10); g.setColour(obj.textColour); g.setFont("bold", 20); g.drawAlignedText(obj.text, a, "centred"); });
-
@d-healey perfect, thanks!
-
@d-healey can width of the rectangle be written in % of the maximum length? For being responsive?
//colour accent g.setColour(0x99ED3237); g.fillRoundedRectangle([a[0], a[1], a[2] - 100, a[3]], {CornerSize: 2, Rounded:[1, 0, 1, 0]}); }
100 in this example
-
@Straticah Sure, just multiply a[2] by 0.5 for 50%, or 0.75 for 75%, etc.
-
@d-healey this finally fixed my issue the accent is now the same size on each tab, independent of tab length :) ty for your help. I have learned a lot in only a week.
-
@Straticah snippet!
-
@DanH haha i have too much going on in my project to share, maybe this will help? :)
//color preset select if(obj.selected) { g.setColour(0x99521F22); g.fillRoundedRectangle(obj.area, 3.0); //red accent g.setColour(0x99ED3237); g.fillRoundedRectangle([a[0], a[1], a[2] / 1000 + 3, a[3]], {CornerSize: 2, Rounded:[1, 0, 1, 0]}); }
did you mean that?
-
@Straticah yes, thanks!