Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
805 views
in Technique[技术] by (71.8m points)

editor - How to avoid AppBuilder removing pieces of code

I'm working on a Progress-4GL programming environment, based on AppBuilder release 11.6.

Until now I've been changing already existing *.w and *.p files, but now I wanted to created my *.w file from scratch.

I've created a window and I've put a browse, a fill-in field and a button. Now I would like to add an event to that button. In order to do that, I add following lines to the *.w file:

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.

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-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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The recommended approach is to use the Wizards of the AppBuilder to create the trigger block with the required AppBuilder markup for you.

  • Add the button to the Window
  • Select the button on the design canvas
  • Choose the "Edit code" button in the AppBuilder main window (the pencil)

enter image description here

This will create an empty default trigger block (in case of a button, that's the CHOOSE). To create a different event, use the "New..." button in the section editor window.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...