hiCreateAppForm ?callback

S

SS

Guest
I am calling a procedure to display a form(OKCancelDef) from my main
code. If I click on OK I want to complete the execution of the main
code accepting values from the form fields and If I click on cancel I
want the main code to exit. What should I set the ok_callback and
cancel_callback to ??


thanks,
Sriram
 
Hi Sriram,

Are you trying to have a procedure display the form, then wait for the
user to click OK or Cancel before resuming execution of the procedure?

If so, it is possible to do this by looking at the return value of
'hiDisplayForm' (OK-t/Cancel-nil, you don't need any callbacks on the
form), but it's not really recommended to work that way.

It's cleaner to write a procedure to create and display the form, then
write another procedure to use as the form callback. If you need to
pass variables from the first procedure to the callback you can do so
using global variables or, better, by saving them as properties on the
form.

Hope that helps,

fergus
 
Fergus,
My procedure formcreatedisplay() creates and displays the
form. I call this procedure from my main code. I have two callbacks
erOKCB() and erCancelCB(). These are the callbacks for the form in
formcreatedisplay procedure.

I check for the value of hiIsInFieldCancel() in erCancelCB() and pass
it to a global variable. However for some reason it always returns nil.
Otherwise I can check for the value of this global variable and exit
from the main code accordingly.

thanks,
Sriram
 
In article <1145546336.132077.195310@i40g2000cwc.googlegroups.com> "SS" <ssriramiyer@gmail.com> writes:
Fergus,
My procedure formcreatedisplay() creates and displays the
form. I call this procedure from my main code. I have two callbacks
erOKCB() and erCancelCB(). These are the callbacks for the form in
formcreatedisplay procedure.

I check for the value of hiIsInFieldCancel() in erCancelCB() and pass
it to a global variable. However for some reason it always returns nil.
Otherwise I can check for the value of this global variable and exit
from the main code accordingly.
The hiIsInFieldCancel() function is for field callbacks so they know if
the value is changing due to a form cancel operation.

The fact that your cancel callback was called indicates that the form was
cancelled, so there is no need to call hiIsInFieldCancel() there -- especially
since as you found out it doesn't return a correct value in that case.

-Pete Zakel
(phz@seeheader.nospam)

If A equals success, then the formula is:
A = X + Y + Z
X is work. Y is play. Z is keep your mouth shut.

-Albert Einstein
 
Hi Sriram,

You just need to have formcreatedisplay() pass the return value of
hiDisplayForm(), - the easiest way to do that is to make it the last
statement inside a 'let':

procedure( formcreatedisplay(args)
let(()
;; Create the form
hiCreateAppForm( .... )

;; Display the form
hiDisplayForm( myform )
); let
); procedure formcreatedisplay

then you can just check the return value of formcreatedisplay(), no
callbacks required.

fergus
 

Welcome to EDABoard.com

Sponsor

Back
Top