Solved Help me make a better box combo box
-
I'm trying to improve the LAF of my combo box but at the moment I don't get a nice aesthetic
Mine:
how I would like it:
here is my code:
laf.registerFunction("drawComboBox", function(g, obj) { // Draw the background with rounded corners g.setColour(obj.itemColour1); g.fillRoundedRectangle([obj.area[0] + 1, obj.area[1] + 1, obj.area[2] - 2, obj.area[3] - 2], 20.0); // Draw the border with rounded corners g.setColour(obj.itemColour2); g.drawRoundedRectangle(obj.area, 20.0, 2.0); // Draw the text with alpha depending on the enabled and active state g.setColour(Colours.withAlpha(obj.textColour, (obj.enabled && obj.active) ? 1.0 : 0.2)); g.setFont("SimpleFont", 20.0); // Adjust the text area to accommodate the rounded corners var a = obj.area; g.drawAlignedText(obj.text, [a[0] + 10, a[1], a[2] - 20, a[3]], "left"); // Draw the drop-down triangle g.setColour(obj.textColour); var h = a[3]; g.fillTriangle([a[0] + a[2] - h / 3 - 10, a[1] + h / 3, h / 3, h / 3], Math.PI); });
-
@Mighty23 i would say reduce the corner radius from 20 to 5 or 10?
// Draw the background with rounded corners g.setColour(obj.itemColour1); g.fillRoundedRectangle([obj.area[0] + 1, obj.area[1] + 1, obj.area[2] - 2, obj.area[3] - 2], 5.0);
-
@Straticah Yes, of course this helps a lot, the combobox box remains very ungraded. The right and left ends are crushed and the corners are not so rounded.
-
@Mighty23 you need to reduce the width and height by the stroke thickness
-
@Mighty23 id use a panel and give that the border radius, plus it has a cleaner stroke outline
HiseSnippet 1138.3ocsV0uaZbDDeOvWjg1TkH0GfU7GQfJ4LfSSqZTULeXpP03fJtQUxxJZ4tEtM9tcOs2hsQUQpO.8+5KUeb5aP6L2GvQLIsB0bRvcy2+lYmc1chV4xiiUZhUkKVEwIVet8zURieeelPRFMfX8E1iYwFtllxp2pHVbL2iXYU9GPFVUNfj77WurGKfIc4aXQHuVIb4mIBElMbmbxOJBBFx73WHBKn8yNYjqR1WEnVB3orcKRDy8Z1B94LTsR1DqGbpmvnzSMLCOlXcPOk2po9pako5+ZQrXV.GIZSlBNJk8P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3VaqR3lvT5V4sSSgyrRH9a3ISXaj1JSX6bgjPlqV8F2zst3UCNLgCfIYxshp.WOCnose+8rDRHbSk235tsqtmgc1WCOdeM7Y6qge89Z3y2WC+l80vu8e2P7hjcWZTgoaaHjwSNMYFqk0ooW5.6VI+CKmfN5C
-
@Straticah I would never have been able to find this solution alone, Wow. Using a panel is the most immediate, brilliant solution, thanks
-
-