取消布局管理器滚动 [英] Cancel scrolling in Layout Manager

查看:149
本文介绍了取消布局管理器滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到如下问题的解决方案。我有自定义列表场,重叠其布局管理器的边界。列表区域消费导航事件从管理强调当前所选行用特殊颜色。布局管理器被配置为支持滚动。当我滚动拨轮,布局管理器调用滚动,然后通过导航事件到其子,列表字段。它导致inproper滚动,因为经理滚动整个列表到顶部,包括选定行其底部隐藏列表行。

I can't find solution for the following problem. I have custom list field, which overlaps the boundaries of its layout manager. List field consumes navigation events from manager to highlight currently selected row with special color. Layout manager is configured to support scrolling. When I scroll trackwheel down, layout manager invokes scrolling and then passes navigation event to its child, the list field. It results in inproper scrolling, because manager scrolls the whole list down to its bottom hiding list rows on the top including the selected row.

我要的是忽略滚动,而当前选择的列表行仍然可见,使用它,否则。

What I want is to ignore scrolling while currently selected list row is still visible and employ it otherwise.

我使用JDE 4.2.1

I'm using JDE 4.2.1

推荐答案

所有这里的,帮助我解决。通过在这种特殊的方式覆盖moveFocus我设法修改布局管理器滚动的默认行为 - 它跳过列表字段的第一个项目,让他们留在上面。

all here's the solution that helped me. By overriding moveFocus in such specific way I managed to modify default behavior of scrolling in layout manager - it skips first items of list field allowing them to stay on top.

public int moveFocus(int amount, int status, int time) {
	invalidate(getSelectedIndex());

	int unused = super.moveFocus(amount, status, time);
	return Math.abs(unused) + 1;
}

这篇关于取消布局管理器滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆