Is it possible to react to both single and double clicks on DataTable rows while keeping header non-interactive? #6511
Replies: 1 comment 2 replies
-
|
I got it working finally BUT, the thing is, it will now only Lots of gross code there, I know. I wanted to do this without AI, but with the requisite help from StackOverflow/Google, so my methods are based on both this very GitHub repo examples and help forum and SO logic. If I'm doing something monumentally stupid, please correct. EDIT: This is with: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a MVE, but I feel like this must be a quick yes or no based on the parts of DataTable that are/aren't exposed public. I am new to both python and textual. Over a couple days I have come at this from numerous approaches, mainly centered around
event.chaindetection and trying to do one thing with a single click and custom thing when==2. What I want to accomplish:Differentiating between a single and double click in order to keep the built-in
on_data_table_row_selectedhandler for the ability to perform an action (add row to a list for example), but have double-click handle a `push_screen_wait' to a ModalScreen (launches subprocess).Also a DataTable with "reactive header row", which I have working with some jank and running a
refresh()on it inon_mount:But that's secondary to:
Making header row either ignore double-click or completely non-interactive while maintaining that functionality on the rest of the table rows (index > -1). Right now, I am throwing the kitchen sink at making the header not crash everything when it gets double-clicked. Single-click on header is fine and does nothing, as expected. Overriding my subclassed DataTable
on_clickwith a check to to see if the mouse/cursor/coordinate was actually on a row and not header is hitting this Traceback every time:There must be something silly I'm not considering here. My
localsfrom Textual console looks like:I am almost certain I tried getting around that
is_header_clickbool, but there's no setter. Also, the traceback here has thechainat 1, but a single-click and nothing else does work, which makes me wonder if this is a "click timing" or message order handling/timing problem.Beta Was this translation helpful? Give feedback.
All reactions