How to disable viewport table row selection?
-
I have a viewport setup as a table, one column contains buttons, the other a label showing what the button is for. I have no need for the user to be able to select a row, how can I disable this?
-
@d-healey I've tinkered with the viewport recently. I don't it's possible to disable row selection, but maybe you could cheat using laf? i.e. So each row has the same 'design' no matter if it's clicked or not, so the user has no clue the rows are selectable?
-
@Matt_SF said in How to disable viewport table row selection?:
but maybe you could cheat using laf?
Good idea. I'll do that.
-
D d.healey marked this topic as a question
-
D d.healey has marked this topic as solved
-
@Christoph-Hart Slightly related question. For buttons the row index in the laf
obj
is speltRowIndex
but for text columns it isrowIndex
is that intentional? -
Can you do this with CSS?
for styling the items in the list, use the HTML tag selector for table rows tr . It supports :hover , :active and :checked pseudo states with the same concept as the Buttons
-
@dannytaurus said in How to disable viewport table row selection?:
Can you do this with CSS?
I'm avoiding CSS until it can be used in combination with laf. But laf was able to do the job here.
-
- allow CSS & scripted LAF within same component · christophhart/HISE@e459f0b
The open source framework for sample based instruments - - allow CSS & scripted LAF within same component · christophhart/HISE@e459f0b
GitHub (github.com)
Long overdue, but it seems that this was really holding people back from CSS...
These are the rules:
- you can now use local LAF objects with mixed CSS & script functions
- global look and feels can still be only script or CSS but that should be fine as you can always use a local LAF if you need both
- script functions have the precedence, so if a draw function was registered it will always supercede the CSS definition
- the exception is popup menu styling - as soon as you combine script functions & CSS, the popup menu will always be styled with the CSS.
Combobox with scripted draw function & CSS styled popupmenu:
const var laf = Content.createLocalLookAndFeel(); // Combobox is styled by a function laf.registerFunction("drawComboBox", function(g, obj) { g.setColour(obj.bgColour); g.fillRect(obj.area); g.setFont("Comic Sans MS", 21); g.setColour(Colours.blue); g.drawAlignedText(obj.text, obj.area, "centred"); }); // Popup menu is styled by CSS laf.setInlineStyleSheet(" .popup { background: #333; } .popup-item { background: transparent; color: #999; padding: 10px; } .popup-item:hover { background: rgba(255,255,255, 0.2); } .popup-item:active { color: white; font-weight: bold; } "); Content.getComponent("ComboBox1").setLocalLookAndFeel(laf);
-
@Christoph-Hart Oh nice! I have no excuse now :)