hiCreateAppForm ?callback

Discussion in 'Cadence' started by SS, Apr 19, 2006.

  1. SS

    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
     
    SS, Apr 19, 2006
    #1
  2. SS

    Fergus_S Guest

    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_S, Apr 20, 2006
    #2
  3. SS

    SS Guest

    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
     
    SS, Apr 20, 2006
    #3
  4. SS

    Guest Guest

    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
    ()

    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
     
    Guest, Apr 20, 2006
    #4
  5. SS

    Fergus_S Guest

    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
     
    Fergus_S, Apr 20, 2006
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.