我的应用程序中有一个滚动窗口,我在其中创建了一个绘图区域小部件。在绘图区,我放置了多张图片。当用户在搜索框中输入有关图像的信息时,相应的图像会突出显示。
我的问题是如何在用户不使用滚动条的情况下让应用程序自动滚动到突出显示的图像框。滚动窗口应自动移动 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/