【问题标题】:Motif: How to move Scroll Bar automatically without user intervention主题:如何在没有用户干预的情况下自动移动滚动条
【发布时间】:2014-09-18 14:36:04
【问题描述】:

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

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

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

任何指针将不胜感激。在此先感谢。

【问题讨论】:

    标签: linux xlib motif


    【解决方案1】:

    如果这不起作用,请尝试 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

    【讨论】:

    • 我认为,XmScrollVisible() 不能使用,因为工作窗口的内容不是小部件。所以我将尝试实现其他解决方案。感谢您的回复。
    猜你喜欢
    • 2013-12-11
    • 1970-01-01
    • 2022-12-17
    • 1970-01-01
    • 1970-01-01
    • 2016-04-16
    • 1970-01-01
    • 1970-01-01
    • 2017-07-02
    相关资源
    最近更新 更多