Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listbox hovered not working #328

Closed
usernameiwantedwasalreadytaken opened this issue Jul 18, 2018 · 2 comments
Closed

Listbox hovered not working #328

usernameiwantedwasalreadytaken opened this issue Jul 18, 2018 · 2 comments

Comments

@usernameiwantedwasalreadytaken

Hi,

I've created an inline widget (for a checkbox) inside the listbox following the wiki. Everything works fine, except for the implementation of the mouse_move event of my checkbox (that should highlight the line of the table):

_box.events().mouse_move([this] {
      _indicator->hovered(_pos);
});

Instead of highlighting the current line, this code always highlights the first line of the table.

Looking at the code at listbox.cpp, I believe the problem has to do with the line auto offset = ess_->content_view->origin().y / ess_->item_height(); inside the method hovered:

void hovered(index_type /*pos*/) override
{
	auto offset = ess_->content_view->origin().y / ess_->item_height();

	if (ess_->pointer_where.first != parts::list || ess_->pointer_where.second != offset)
	{
		ess_->pointer_where.first = parts::list;
		ess_->pointer_where.second = offset;
		ess_->update();
	}
}

In this case, ess_->content_view->origin().y always return 0 for every selection (even though the pos variable is diferent).

Thanks in advance.

@cnjinhao
Copy link
Owner

Thank you for reporting this issue!

@usernameiwantedwasalreadytaken
Copy link
Author

Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants