linux - Motif:如何在没有用户干预的情况下自动移动滚动条

标签 linux xlib motif

我的应用程序中有一个滚动窗口,我在其中创建了一个绘图区域小部件。在绘图区,我放置了多张图片。当用户在搜索框中输入有关图像的信息时,相应的图像会突出显示。

我的问题是如何在用户不使用滚动条的情况下让应用程序自动滚动到突出显示的图像框。滚动窗口应自动移动 View 区域,以显示突出显示的图像所在的区域。

滚动窗口使用的滚动策略是XmAUTOMATIC。

如有任何指点,我们将不胜感激。在此先致谢。

最佳答案

尝试 XmScrollVisible() 如果这不起作用,那么您将需要:

1. Find out the size of the work area.
2. Find out the size and position of the clip window.
3. Find out the max/ min values for the horizontal scrollbar.
4. Use XmScrollBarGetValues() for the horizontal scrollbar to get its position within the max/min values.
5. Do some math magic to determine how much to move the horizontal scrollbar to get the work area to show through the clip window.
6. Call XmScrollBarSetValues() with Notify = True.
7. Repeat for the Vertical scrollbar.

HTH

关于linux - Motif:如何在没有用户干预的情况下自动移动滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25915628/

相关文章:

mysql - Bash 脚本 : Save into mysql database

c++ - XQueryPointer 掩码返回值中的位代表什么键?

x11 - 检测 X11 窗口是否有装饰

ruby-on-rails - 无法在 Ubuntu 15.04 上安装 Ruby 2.2.3

c - 处理系统时间变化

c++ - 如何使用 X11 避免图形绘图中的闪烁

c - 有没有比我正在做的更有效的方式来隐藏用户的 X11 session ? (C\XLib)

c++ - Motif主窗口没有系统菜单,如何最小化和最大化框? (C++)

在屏幕中运行的 Java 应用程序不会因屏幕退出而终止