How to close Dialog-Frame maually like Cancel button?

Posted by MiguelSaucedo on 15-Jul-2013 14:19

Hi guys

I have  a Dialog-Frame, no a C-Win AS WIDGET-HANDLE with two buttons "Cancel" and "Accept".

Wen i press the "Cancel" button the Dialog-Frame closes.

So i want try to replicate this event with code but i dont know how to do.

thanks in advance

All Replies

Posted by rohit.ramak on 16-Jul-2013 23:39

when do you want to trigger this event from you code?  you could try something like the below:[CODE]ON "" OF "" THENDO:    APPLY "CHOOSE" TO BUTTON Btn_Cancel IN FRAME Frame-Name.    RETURN NO-APPLY.END.[/CODE]

Posted by bootcomp on 29-Jul-2013 04:32

As an addition to the previous answer, if you want to close it using code in a different procedure, you need to be able to identify that button as a handle and apply CHOOSE to the handle.

There are several approaches to getting this handle, most based around the two programs knowing something about each other.  This may best be described by example (not syntax checked).  This example covers where a calling progarm would want to close the dialog.

Original program.

DEF VAR h_close_button AS HANDLE.

FUNCTION set_close_button_handle(INPUT h as HANDLE):

     h_close_button = h. /* this gets and remembers the handle */

END FUNCTION.

...

RUN .

...

ON DO:

    APPLY 'CHOOSE':U TO h_close_button.

END.

Program with dialog.

FUNCTION set_close_button RETURNS LOGICAL (INPUT h AS HANDLE) IN THIS-PROCEDURE:INSTANTIATING-PROCEDURE.

set_close_button(BUTTON Btn-Close:HANDLE)

For example, if the original program has a procedure that can be called by the second one to give it the handle, then the original program would be able to use this directy.  This would require th second program

This thread is closed