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
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]
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.
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 */
APPLY 'CHOOSE':U TO h_close_button.
Program with dialog.
FUNCTION set_close_button RETURNS LOGICAL (INPUT h AS HANDLE) IN THIS-PROCEDURE:INSTANTIATING-PROCEDURE.
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