Control trigger

gasomma

Member
Hello

I have another question:

I don’t understands why I cannot insert the code below in the CONTROL TRIGGERS.
In runtime the code work properly, but APPBUILDER reject it. May you help me?



/* ????????? INSERT INSERT INSERT ?????????? */
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
ON GO OF {&WINDOW-NAME} ANYWHERE DO:
APPLY "CHOOSE":U TO BUTTON-1 IN FRAME {&FRAME-NAME}.
RETURN.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

Thx
 

Attachments

  • c.w
    11.9 KB · Views: 5

RealHeavyDude

Well-Known Member
If you want to keep the possibility to edit the procedure with AppBuilder's section editor then never fiddle with the file with any other editor unless you are capable to insert the control sequences that are used by the AppBuilder yourself.

The reason for that is that the AppBuilder adds control code like &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win in order to structure the code so that it can be edited with the section editor. If this control code (which is not compiled) gets messed up then you can't open the file in the AppBuilder anymore. Nevertheless you can always open it in the procedure editor.

Heavy Regards, RealHeavyDude.
 

rzr

Member
how did you add the below lines of code to the program c.w ? did you use appbuiler to edit the program or use any other procedure editor?

Code:
/* ????????? INSERT INSERT INSERT ?????????? */
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
ON GO OF {&WINDOW-NAME} ANYWHERE DO:
APPLY "CHOOSE":U TO BUTTON-1 IN FRAME {&FRAME-NAME}.
RETURN.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
 

gasomma

Member
I inserted manualy this code (I don't know insert [ANYWHERE] For GO OR GET OR INSERT_MODE in the code using APPBUILDER)
 

RealHeavyDude

Well-Known Member
I assume you want to add a trigger to a widget.

Just click on the widget and click the section editor icon on the AppBuilder and the section editor will take care of that for you.

Heavy Regards, RealHeavyDude.
 

gasomma

Member
I will try. Thx. Another question: I have similar trigger code in many program. Theres a way for to insert them in an INCLUDE (file-name.i) and add this include in the control trigger?
 

RealHeavyDude

Well-Known Member
IMHO - the concept of putting control sequences into the source code in order to be able to edit it in a structured way is not perfect. As soon as the control sequences are corrupt you can't edit it anymore in the AppBuilder. But that's the way Progress has chosen for the AppBuilder to work. There are sections in the source that you can't access with the section editor and as soon as you put your custom code in such a location you break the section editor.

That were the bad news. The good news is that you can include files in every section that is accessible through the section editor or you can include it in the procedure settings which are accessible via the corresponding button in the AppBuilder.

Personally I don't like that concept too much because it makes the code intransparent and cluttered with "crap" ...

Heavy Regards, RealHeavyDude.
 

gasomma

Member
I imagined that. I will try a lot of things. In any case it's very strange and unintelligent way. I have many program and parts of code are similar. You think if I will have to change something only, for example, modify or add a trigger. Thx. Jca.
 

RealHeavyDude

Well-Known Member
Personally I don't put any code apart from a function invocation or a procedure call into a trigger code. That way the "real" code stays in a function or procedure which can be part of some library - be it an include or procedure library. You should be aware that using such include libraries to bring functionality into your procedures is somewhat old-fashioned. A much better solution would be providing these functionality with persistent procedures or even super procedures.

Heavy Regards, RealHeavyDude.
 

rick.souza

New Member
Gasomma,

It is possible to edit Progress Code files with "any" Editor. Therefore, you must know what you are doing. To include a trigger like that, you must issue one with the AppBuilder first and then, edit the code to identify the complete lines of the trigger block. Identifying that, you can copy and paste it "carefully" in other code, since:
- *You know exactly where to include the code;
- You are "very sure" the button you created in the window has the same name: BUTTON-1.

For example, imagine the trigger code below should be presente in many programs.

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ext_event_fp.cod_assunto_calc V-table-Win
ON LEAVE OF ext_event_fp.cod_assunto_calc IN FRAME f-main /* Assunto Cálculo */
DO:
{include/leave.i &tabela=es_assunto_calc
&atributo-ref=des_assunto_calc
&variavel-ref=c_des_assunto_calc
&where="es_assunto_calc.cod_assunto_calc = input frame {&frame-name} ext_event_fp.cod_assunto_calc"}
find es_assunto_calc where
es_assunto_calc.cod_assunto_calc = input frame {&frame-name} ext_event_fp.cod_assunto_calc no-lock no-error.
if not available es_assunto_calc then
do:
run utp/ut-msgs.p (input "show",
input 15825,
input 'Crítica Assunto Cálculo - [V01ESFP0020A.W].' + '~~' +
'O Assunto de Cálculo informado Não Existe.' + chr(10) +
'Favor Corrigir!').
APPLY "entry":u TO self.
RETURN NO-APPLY.
end.
END.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


So... If you have to include a trigger code like this, you must include it between the lines
&ANALYZE-RESUME

===>>> Exactly here <<<===

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL

in the "Control Triggers" block.

Hope this can help you ...
 

gasomma

Member
Thx for your reply.
I know and I'm using similar code. But my question was: if is it possibile insert all parts of trigger code in a include or there is another way. f.ex.

{trigger.i}
&Scoped-define SELF-NAME DEFAULT-FRAME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL DEFAULT-FRAME C-Win
ON GO OF FRAME DEFAULT-FRAME
DO:
APPLY "CHOOSE":U TO BUTTON-1 IN FRAME {&FRAME-NAME}.
RETURN.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&Scoped-define SELF-NAME BUTTON-1
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BUTTON-1 C-Win
ON CHOOSE OF BUTTON-1 IN FRAME DEFAULT-FRAME /* Button 1 */
DO:
MESSAGE "BUTTON-1" VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
 

RealHeavyDude

Well-Known Member
Yes you can.
No you can't.

The question is way to generic to give a definite answer ...
In general - when you work with the widget names (static) and the widgets do have the same names in all your programs then you could.

Otherwise one would need to think about a design, eventually using handle based objects.


Heavy Regards, RealHeavyDude.
 
Top