【问题标题】:ON CTRL-D how to use it?ON CTRL-D 怎么用呢?
【发布时间】:2016-05-20 10:35:57
【问题描述】:

在这个程序中,如果您选择项目代码,它将显示 3 个字段并要求更新,如果您更新它将更新记录。到这个程序为止都很好。

如果用户按下 Ctrl+D,我添加了一个条件,它要求删除问题是或否,是的,您更新的字段应该为空白,否则执行什么都没试过,但我做不到。

/*Sample Item master Maintenance Program*/                                      
/* DISPLAY TITLE */   
{us/mf/mfdtitle.i "3+ "}
def var l_qad like pt__qad13.
def var l_draw like pt_draw.
def var l_group like pt_group.
def var ans as logical no-undo. 
form
    pt_part colon 25
    with frame a side-labels width 80.
/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

form
   "Enter the Value of" l_qad colon 30 skip(1)
   "Enter the Value of" l_draw   colon 30 skip(1)
   "Enter the Value of" l_group  colon 30 skip(1)
    with frame b side-labels width 80.
setFrameLabels(frame b:handle).
view frame a.                                                                   
repeat with frame a:                                                            
      prompt-for pt_part                                                           
       editing:                                                                  
      /* FIND NEXT/PREVIOUS RECORD */                                     
        {us/mf/mfnp.i pt_mstr pt_part "pt_mstr.pt_domain = global_domain and pt_part" pt_part pt_part pt_part }                            
        if recno <> ? then                                                        
             do:                                                                   
              display pt_part.  
          end.
        end.
        for first pt_mstr exclusive-lock where pt_domain = global_domain and pt_part = input pt_part:
        assign l_qad= pt__qad13
              l_draw= pt_draw
            l_group= pt_group.
        disp l_qad l_draw l_group with frame b.
        update l_qad l_draw l_group with frame b.
            assign pt__qad13 = input l_qad
                   pt_draw = input l_draw
                   pt_group = input l_group.

        end.
        hide frame b.
        on CTRL-D ANYWHERE
        do:
        message "Please confirm delete" view-as alert-box question buttons yes-no update ans as logical.
        if ans= true then 
            message "yes".
            assign pt__qad13 = ""
                   pt_draw = ""
                   pt_group = "".

        else
            message "no".
        end.    
end.

【问题讨论】:

    标签: progress-4gl openedge 4gl


    【解决方案1】:

    您的触发器需要放在代码的前面。

    看看这个基本的例子,你可以尝试注释/取消注释这两个触发器,看看会发生什么:

    DEFINE VARIABLE cUpdate AS CHARACTER   NO-UNDO.
    
    /* Placing the trigger here works! */
    ON 'ctrl-d':U ANYWHERE DO:
        MESSAGE "You rang sir?" VIEW-AS ALERT-BOX INFORMATION TITLE "Early trigger".
        RETURN.
    END.
    
    
    UPDATE cUpdate.
    
    /* Placing the trigger here wont work! */
    /*
    ON 'ctrl-d':U ANYWHERE DO:
        MESSAGE "You rang sir?" VIEW-AS ALERT-BOX INFORMATION TITLE "Late trigger".    
        RETURN.
    END.
    */
    

    Progress 在编译时只传递一次代码。因此,它永远不会知道您现在所处位置的任何“前方”(FUNCTIONS 声明为 FORWARD 是一个例外)。

    【讨论】:

      猜你喜欢
      • 2014-02-03
      • 2015-04-07
      • 1970-01-01
      • 1970-01-01
      • 2012-02-01
      • 1970-01-01
      • 2014-08-05
      • 1970-01-01
      • 2013-03-17
      相关资源
      最近更新 更多