简体   繁体   English

如何避免 AppBuilder 删除代码片段

[英]How to avoid AppBuilder removing pieces of code

I'm working on a Progress-4GL programming environment, based on AppBuilder release 11.6.我正在开发基于 AppBuilder 11.6 版的 Progress-4GL 编程环境。

Until now I've been changing already existing *.w and *.p files, but now I wanted to created my *.w file from scratch.到目前为止,我一直在更改已经存在的 *.w 和 *.p 文件,但现在我想从头开始创建我的 *.w 文件。

I've created a window and I've put a browse, a fill-in field and a button.我创建了一个 window 并放置了一个浏览器、一个填写字段和一个按钮。 Now I would like to add an event to that button.现在我想向该按钮添加一个事件。 In order to do that, I add following lines to the *.w file:为此,我在 *.w 文件中添加了以下几行:

ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
    MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.

However, when I save the *.w file, re-open it in the AppBuilder and save the file there again, those lines of code get removed.但是,当我保存 *.w 文件时,在 AppBuilder 中重新打开它并再次将文件保存在那里,这些代码行将被删除。

I've already understood that, in order to avoid this, I need to "wrap" those lines of code by Scoped-define or Analyze:suspend/resume lines, something like this:我已经明白,为了避免这种情况,我需要通过Scoped-defineAnalyze:suspend/resume行“包装”这些代码行,如下所示:

&Scoped-define SELF-NAME btn-Start_Query
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-Start_Query C-Win
ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
    MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.
&ANALYZE-RESUME

However, this seems not to be working.但是,这似乎不起作用。

Can you explain me what exactly I have to do in order avoid my lines of code to be removed?你能解释一下我必须做什么才能避免我的代码行被删除吗?

By the way: I know that I'm working with extremely outdated technology, but I only work here for two weeks, so I don't have the authority to force my boss to change his development environment, just for me.顺便说一句:我知道我在使用非常过时的技术,但是我在这里只工作了两个星期,所以我没有权力强迫我的老板改变他的开发环境,只是为了我。

The recommended approach is to use the Wizards of the AppBuilder to create the trigger block with the required AppBuilder markup for you.推荐的方法是使用 AppBuilder 的向导为您创建带有所需 AppBuilder 标记的触发器块。

  • Add the button to the Window将按钮添加到 Window
  • Select the button on the design canvas Select 按键设计 canvas
  • Choose the "Edit code" button in the AppBuilder main window (the pencil)选择 AppBuilder 主 window 中的“编辑代码”按钮(铅笔)

在此处输入图像描述

This will create an empty default trigger block (in case of a button, that's the CHOOSE).这将创建一个空的默认触发块(如果是按钮,则为 CHOOSE)。 To create a different event, use the "New..." button in the section editor window.要创建不同的事件,请使用部分编辑器 window 中的“新建...”按钮。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM