How to code the OK and CANCEL buttons for a form 
Author Message
 How to code the OK and CANCEL buttons for a form

OK, this is a pretty dumb question, but since I am new to C5, I wanted
to ask to make sure that I am doing things correctly.

I have a report, in the init function I call a form to get the report
criteria.  I am not sure how I should:

A.  Code the OK and CANCEL buttons on the form window.

I have the OK button setting the GlobalResponse to RequestCompleted and
then trigger the close window event.

I have the CANCEL button setting the GlobalResponse to RequestCanceled
and trigger the close window event.

B.  I have the report looking at the GlobalResponse to determine if
the user hit the OK or CANCEL button based on GlobalResponse, but this
does seem to be working ie. the GlobalResponse is not set the
RequestCompleted when I the OK button is pressed on the criteria form.

Thanks for any suggestions,

Mike Earl



Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
If this is c5ABC instead of setting the globalresponse set self.response to
requestcompleted or RequestCancelled.   I believe the window class will
properly set the globalresponse variable for you exit if you do that.  Also
i use 'return level:fatal' to exit the form from a button push typically.
Not sure if your method (triggering the event) or mine is optimal.

joe


Quote:
>OK, this is a pretty dumb question, but since I am new to C5, I wanted
>to ask to make sure that I am doing things correctly.

>I have a report, in the init function I call a form to get the report
>criteria.  I am not sure how I should:

>A.  Code the OK and CANCEL buttons on the form window.

>I have the OK button setting the GlobalResponse to RequestCompleted and
>then trigger the close window event.

>I have the CANCEL button setting the GlobalResponse to RequestCanceled
>and trigger the close window event.

>B.  I have the report looking at the GlobalResponse to determine if
>the user hit the OK or CANCEL button based on GlobalResponse, but this
>does seem to be working ie. the GlobalResponse is not set the
>RequestCompleted when I the OK button is pressed on the criteria form.

>Thanks for any suggestions,

>Mike Earl




Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
Hi Michael,

On Wed, 10 Feb 1999 20:18:02 -0800, Michael Earl

Quote:

>I have a report, in the init function I call a form to get the report
>criteria.  I am not sure how I should:
...
>B.  I have the report looking at the GlobalResponse to determine if
>the user hit the OK or CANCEL button based on GlobalResponse, but this
>does seem to be working ie. the GlobalResponse is not set the
>RequestCompleted when I the OK button is pressed on the criteria form.

How do you call the form?  If you use Start(FormProc,25000) or
something like that, it won't work as the GlobalResponse is threaded.
Call the form directly with:

 FormProcedure

and it should work.  

Best regards,

Arnor Baldvinsson        
[Team Topspeed - Internet Connect]
Allerup Edb
Denmark

Check out Icetips and Icetips Knowledgebase
http://www.icetips.com
UIN nr.: 2428601



Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
Some hint: Local response, global response and
Procedure Return doesn't exist with ABC template.

Look in help to see how i's implemented.

RETURN LEVEL:Bening
RETURN LEVEL:FATAL
THISWINDOW.kill

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form

Quote:
>If this is c5ABC instead of setting the globalresponse set self.response to

You can use the .SetResponse() method for that

HTH
Juanro



Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
Juanro,

I tried your approach and it worked perfectly.  Muchas Gracias Amigo!!!!

I would like to thank everyone else for their suggestions.  All I had to do was:

?OK ---> SELF.SetResponse(RequestCompleted)
?CANCEL ----> SELF.SetResponse(RequestCancelled)

I removed the setting of the GlobalResponse and posting the close window event.

Best regards,

Michael Earl

Quote:


> >If this is c5ABC instead of setting the globalresponse set self.response to

> You can use the .SetResponse() method for that

> HTH
> Juanro



Sun, 29 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
Michael and Adrien Earl escribi en mensaje

Quote:
>Muchas Gracias Amigo!!!!

De nada, Miguelito!!!   :-)           (You're welcome, Michael)

Juanro



Mon, 30 Jul 2001 03:00:00 GMT  
 How to code the OK and CANCEL buttons for a form
Hi Mike,

Quote:

>   I have a report, in the init function I call a form to get the report
>   criteria.  I am not sure how I should:

>   A.  Code the OK and CANCEL buttons on the form window.

>   I have the OK button setting the GlobalResponse to RequestCompleted and
>   then trigger the close window event.

>   I have the CANCEL button setting the GlobalResponse to RequestCanceled
>   and trigger the close window event.

>   B.  I have the report looking at the GlobalResponse to determine if
>   the user hit the OK or CANCEL button based on GlobalResponse, but this
>   does seem to be working ie. the GlobalResponse is not set the
>   RequestCompleted when I the OK button is pressed on the criteria form.

A. If you use ABC then for the Ok and Cancel buttons:
   select Embeds ->  Control Event Handling -> Accepted, press Insert button,
then select Code Templates -> Call ABC Method. In the window fill the fields:
         Object Name: ThisWindow
      Method to Call: SetResponse()
   Passed Parameters: (RequestCompleted) or (RequestCancelled)

This Method set GlobalResponse and correctly close your procedure. Also you
can write as Source:
   ThisWindow.SetResponse(RequestCompleted)

B. 1) Be sure that you check GlobalResponse AFTER the call to your criteria
      form.
   2) GlobalRequest and GlobalResponse are threaded vars., so don't use
      threads to call your form.

Regards,

Anton Novikov



Tue, 31 Jul 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. C4 : OK and Cancel button

2. OK and Cancel button

3. how to use OK and cancel buttons to set the outputs of a message

4. C4: Confirm Delete on Cancel button on Form

5. Cancel Button on form

6. Update Form, Validate fields before OK button?

7. I need help With OK Button on an Update Form

8. Cancel a form with a memo field - how stop cancel message

9. cancel form with confirm canceling

10. Cancel a Procedure through the Cancel Button

11. Buttons: Mac OK, Windows not OK

12. Cancel button on 2 button dialog to stop execution of vi

 

 
Powered by phpBB® Forum Software