OK and Cancel buttons callback

Discussion in 'Cadence' started by Hon Seng Phuah, Jun 11, 2004.

  1. I tried to find this newsgroup and Cadence reference softcopy
    reference books but I could not find examples dealing with OK and
    Cancel callback on a form.

    May someone give a simple example how I can detect a user clicks OK or
    Cancel button on a form?

    Thanks.
    -HS Phuah
     
    Hon Seng Phuah, Jun 11, 2004
    #1
  2. When you call hiCreateAppForm(), you can pass the ?callback argument.
    If you supply just a single symbol or string, that's the callback for the OK
    only. If you supply a list, then the first entry is the OK callback, and the
    second is the cancel callback. This is in the documentation (at least
    I think it is - I've not checked).

    So something like:

    ?callback list('MYokCallback 'MYcancelCallback)

    where each function is written to accept a single argument - the formId.

    Andrew.
     
    Andrew Beckett, Jun 11, 2004
    #2
  3. procedure( BFdisplayFeedbackForm( )

    unless( boundp( 'GBfeedbackForm ) && hiIsFormDisplayed( GBfeedbackForm )
    BFcreateFeedbackForm( )
    ) ;; close unless

    hiDisplayForm( GBfeedbackForm )

    ) ;; close procedure BFdisplayFeedbackForm


    procedure( BFcreateFeedbackForm( )
    let( ( r_labelField )

    r_labelField = hiCreateLabel(
    ?name 'r_labelField
    ?labelText "This is a feedbak box"
    )

    hiCreateAppForm(
    ?name 'GBfeedbackForm
    ?formTitle "Feedback Form"
    ?fields list( r_labelField )
    ?callback '(
    "printf( \"You hit OK!\n\" )"
    "printf( \"You hit Cancel!\n\" )"
    )
    )


    ) ;; close let

    ) ;; close procedure BFcreateFeedbackForm



    See also 'Cadence User Interface SKILL Functions Reference'

    Bernd
     
    Bernd Fischer, Jun 11, 2004
    #3
  4. Hon Seng Phuah

    Jim Newton Guest

    hi bernd, you don't really have to worry so much about backslashing all
    your strings like this... you can take advantage of th %L function
    feature of printf.
    ?callback (list (sprintf nil "%L" '(printf "You hit OK!n"))
    (sprintf nil "%L" '(printf "You hit Cancel!n") ))

    obviously you can write a SKILL function to make this easier to use

    (defun encap_string ( l_list)
    (sprintf nil "%L" l_list))

    ?callback (list (encap_string '(printf "You hit OK!\n"))
    (encap_string '(printf "You hit Cancel!\n")))
     
    Jim Newton, Jun 11, 2004
    #4
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.