preset text is hidden
-
@d-healey I don't know how to do this. I would be grateful if you could help me.
-
@xsaad Add an
else
to your if statement and useg.drawText()
to draw the text for the other items. You'll probably also want to add background and mouse hover/click actions too so time to dig deep into LAF stuff. I have a LAF playlist on my YouTube channel that explores a lot of this stuff. -
This post is deleted! -
@d-healey can you show me where to add the edit because i'm still a biginner? I tried to do that but i didn't succed. thank you for your time
Content.makeFrontInterface(600, 400); const laf = Content.createLocalLookAndFeel(); loadExpansionImagesIntoLaf(laf); //fltPresetBrowser const var fltPresetBrowser = Content.getComponent("fltPresetBrowser"); fltPresetBrowser.setLocalLookAndFeel(laf); laf.registerFunction("drawPresetBrowserListItem", function(g, obj) { var a = obj.area; if (obj.columnIndex == -1) { g.setColour(Colours.withAlpha(Colours.white, obj.hover ? 1.0 : 0.8)); g.drawImage(obj.text, a, 0, 0); } }); inline function loadExpansionImagesIntoLaf(obj) { local expHandler = Engine.createExpansionHandler(); for (e in expHandler.getExpansionList()) { local img = e.getWildcardReference("Icon.png"); if (isDefined(img)) { obj.loadImage(img, e.getProperties().Name); } } }
-
@xsaad said in preset text is hidden:
laf.registerFunction("drawPresetBrowserListItem", function(g, obj) { var a = obj.area; if (obj.columnIndex == -1) { g.setColour(Colours.withAlpha(Colours.white, obj.hover ? 1.0 : 0.8)); g.drawImage(obj.text, a, 0, 0); } });
This is the code you are using to draw the preset browser list items. Your if statement is checking if the column index is -1 (for expansions). Add an else clause to the if statement and that is the code which will run for all the other columns. Within the else clause you can add your code for drawing the list items.
If none of this makes sense you need to go back to basics with LAF and paint routines.
-
@d-healey I tried, but I think I didn't succeed. Thank you for your time.
laf.registerFunction("drawPresetBrowserListItem", function(g, obj) { var a = obj.area; if (obj.columnIndex == -1) { g.setColour(Colours.withAlpha(Colours.white, obj.hover ? 1.0 : 0.8)); g.drawImage(obj.text, a, 0, 0); } else if (obj.columnIndex == 1 || obj.columnIndex == 2) { g.drawText(obj.text, a, Justification.left, true); } });
-
@xsaad You don't need an
else if
, just anelse
.Justification.left
Where did you get this from? -
@d-healey My friend suggested this
Can you correct it for me pleaselaf.registerFunction("drawPresetBrowserListItem", function(g, obj) { var a = obj.area; if (obj.columnIndex == -1) { g.setColour(Colours.withAlpha(Colours.white, obj.hover ? 1.0 : 0.8)); g.drawImage(obj.text, a, 0, 0); } else (obj.columnIndex == 1 || obj.columnIndex == 2) { g.drawText(obj.text, a, Justification.left, true); } });
-
@xsaad said in preset text is hidden:
My friend suggested this
Is your friend called chat GPT? :face_savoring_food:
@xsaad said in preset text is hidden:
Can you correct it for me please
You need to learn how to do it. This is basic stuff. If I correct it then you'll just come back with another problem that you can't solve. I have lots of videos that covers this kind of thing. Here's a good one to start with:
-
@d-healey It seems that GBT T knows nothing :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes: I appreciate your advice. I will start learning from your YouTube channel. Thank you