processEvents
Process mouse position events to find the hovered row.
- scroll_info must be the same as pass to the GriwWidget init_option.
Parameters
- self:*HoveredRow
- *HoveredRow
- grid:*GridWidget
- *GridWidget
Source
Implementation
pub fn processEvents(self: *HoveredRow, grid: *GridWidget) void {
// Check if a row is being hovered.
const evts = dvui.events();
self.highlighted_row = row: {
for (evts) |*e| {
if (e.evt == .mouse and
e.evt.mouse.action == .position)
{
// Translate mouse screen position to a logical position relative to the top-left of the grid body.
if (grid.pointToCell(e.evt.mouse.p)) |cell| {
break :row cell.row_num;
}
}
}
break :row null;
};
}