【问题标题】:How to change active application in progress?如何更改正在进行的活动应用程序?
【发布时间】:2014-09-04 09:44:05
【问题描述】:

In Progress 11.3.2 (Developer Studio 3.7 - Eclipse 3.8.2),根本不使用点网:

如何将焦点切换到另一个窗口/应用程序/w 文件?

在 Windows 7/8 中,被聚焦的窗口的顺序与以前略有不同,并且并不总是显示您希望在所有其他应用程序中拥有的窗口。

如果您打开了 3 个窗口,然后关闭了第 3 个窗口并希望将焦点放在第二个最小化的窗口上,则第一个窗口将获得焦点。

您使用 WINDOW-STATE = WINDOW-NORMAL 将其设置为正常。但是如何也专注于它呢?

【问题讨论】:

    标签: progress-4gl openedge


    【解决方案1】:

    如果您持久运行辅助窗口,您可以执行以下操作:

    在调用窗口中:

    /* In definitions */
    DEFINE VARIABLE ghSecondWindow AS HANDLE      NO-UNDO.
    
    /* In a trigger */
    RUN secondWindow.w PERSISTENT SET ghSecondWindow.
    
    /* Whenever you want to shift focus */
    RUN setFocus IN ghSecondWindow.
    

    在“第二个窗口”中:

    PROCEDURE setFocus:
      /* Replace FILL-IN-1 with any widget that can gain focus */
      APPLY "ENTRY" TO FILL-IN-1 IN FRAME {&FRAME-NAME}. 
    END PROCEDURE.
    

    如果您没有运行持久窗口,您仍然可以通过遍历小部件树来实现此目的,首先是当前窗口,然后是第二个窗口(一旦您将其本地化)。

    快速而丑陋的代码可以放在调用窗口中您希望焦点转移的任何位置。这可能不完全适合您的需求,因此可能需要进行一些重写。此外,这里几乎没有错误检查,并且在没有错误检查的情况下处理可能的永恒循环并不是真正的最佳实践:

    DEFINE VARIABLE hWin    AS HANDLE      NO-UNDO.
    DEFINE VARIABLE hWidget AS HANDLE      NO-UNDO.
    
    /* Get the first child (widget) of the session */
    ASSIGN 
        hWin  = SESSION:FIRST-CHILD.
    
    /* Loop through all widgets in the session */
    loop:
    DO WHILE VALID-HANDLE(hWin):
    
        /* We've identified the correct Window! */
        IF hWin:TYPE = "WINDOW" AND hWin:TITLE = "Secondary Window" THEN DO:
    
            /* ** Very Ugly** this could use better error checking etc! */
            /* Get the second field-group of the window */
            /* This will depend on your layout with different frames etc */
            /* What we really have is WINDOW:DEFAULT-FRAME:FIELD-GROUP:FIELD-GROUP */
            /* Field groups are really only present in the widget tree - they lack visual */
            /* representation */
            /* Read about field-groups in the online help! */
            ASSIGN 
                hWidget = hWin:FIRST-CHILD:FIRST-CHILD:FIRST-CHILD.
    
            /* Loop through all widgets of the field-group */
            DO WHILE VALID-HANDLE(hWidget).
    
                /* We've found the correct fill-in, give it focus */
                IF hWidget:TYPE = "FILL-IN" AND hWidget:LABEL = "Fill 1" THEN DO:
                    APPLY "ENTRY" TO hWidget.
                    LEAVE loop.
                END.
    
                /* Next window of the correct window */
                hWidget = hWidget:NEXT-SIBLING.
    
            END.
        END.
        /* Next widget of the session */
        hWin = hWin:NEXT-SIBLING.
    END.
    

    如果您愿意,也可以递归地执行“widget tree walk”!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多