• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. form in form problem

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 14532
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

form in form problem

Adrian Nistor
Adrian Nistor over 15 years ago

 Hello, I replicated one problem with a smaller test; Please see below:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
procedure
( testforms()
    let( (form)
        form = hiCreateAppForm(
            ?name 'firstForm
            ?formTitle "First Form"
            ?buttonLayout 'OKCancel
            ?fields list( 
               list
(
hiCreateButton(
                       ?name 'theTestButton

                       ?buttonText "Test Button"
                       ?callback "TestButtonCollback()")  230:10 140:30)
                 )

             )
        hiDisplayForm(form)
        printf("First form is finished; Ok button or Cancel button was pressed;")
    )
)

procedure( TestButtonCollback()
    let( (form2)
        form2 = hiCreateAppForm(
            ?name 'IfxERC_SecondForm
            ?formTitle "Second form"
            ?buttonLayout 'OKCancel
            ?fields list(  
                 list(hiCreateButton(
                        ?name 'uselessButton

                        ?buttonText "Useless button"
                        ?callback "UselessButtonCollback()")  10:100 140:30)
                 )

             )
        hiFormCancel(firstForm)
        hiDisplayForm(form2)
        hiDisplayForm(firstForm)
    )
)

procedure( UselessButtonCollback()
    let( ()
        printf("The useless button was pressed;\n");
    )
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In these example I want to open a form (first form), than , pressing a button in this first form (Test button), I want to hide the first form, and showa second form; When this second form is closed I want to show back the first form; But I have a problem; 

Please teste next 2 cases:

First case (non-problematic) :
1:  run testforms() => the "first form" appears;
2: close the form (Ok or Cancel Button) => the form is closed and in ICFB is printed "First form is finished; Ok button or Cancel button was pressed;" This is ok becasue the hiDisplayForm() is finished after Ok/Cancel was pressed;

Second case (problematic) :
1: run testforms() => the "first form" appears;
2: Press "Test Button" button =>"TestButtonCollback" procedure is called; Second form is created (form2); first form is closed ( "hiFormCancel(firstForm)" ) but the string from first procedure is NOT executed !!! ; Second form is displyed;
3: Close (or Ok) second form => second form is closed and first form is backon the screen;
4: Close (or Ok) the first form => the first form is closed;

 After this second case, in ICFB, doesn't appear: "First form is finished; Ok button or Cancel button was pressed;" string from the printf which is called after the first form is closed;  WHY ? 

Why the "hiFormCancel(firstForm)" from the TestButtonCollback() doesn't end the "hiDisplayForm(form)" from the "testforms()" ?

Where am I wrong ?

How can I hide the first form and than bring back again ?

I don't want to set the second form as modal, and I don't want to let both forms (modaless) on the screen;

 

Thank you,

Adi.

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Hi Adi,

    The fundamental problem is that forms are (by default) blocking. This means that when you display the form, the SKILL execution of the procedure which calls the hiDisplayForm blocks until the form is OK'd or cancelled. In your first example, the callback from the "Test Button" is blocking  execution. I think that procedurally calling hiFormCancel in a callback does not get the corresponding hiDisplayForm to continue execution. In fact in your second code, if you do:

    1. testforms()
    2. hit the "Test button"
    3. hit OK
    4. testforms()
    5. hit OK

    You'll see the printf message appears twice. Finally the forms got unblocked.

    In general, writing code that depends on the blocking behaviour of the forms is bad practice. The right way to interact with a form is to use the form callback (specified in the hiCreateAppForm() call) - this way you are completely isolated from the blocking nature of the form. You can also ensure that forms don't block by passing ?dontBlock t to hiCreateAppForm(). Note that you can have two callbacks for a form - one for OK and one for Cancel. The additional benefit of callbacks is that if you have an Apply button on your form, the callback would be triggered by that too.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Hi Adi,

    The fundamental problem is that forms are (by default) blocking. This means that when you display the form, the SKILL execution of the procedure which calls the hiDisplayForm blocks until the form is OK'd or cancelled. In your first example, the callback from the "Test Button" is blocking  execution. I think that procedurally calling hiFormCancel in a callback does not get the corresponding hiDisplayForm to continue execution. In fact in your second code, if you do:

    1. testforms()
    2. hit the "Test button"
    3. hit OK
    4. testforms()
    5. hit OK

    You'll see the printf message appears twice. Finally the forms got unblocked.

    In general, writing code that depends on the blocking behaviour of the forms is bad practice. The right way to interact with a form is to use the form callback (specified in the hiCreateAppForm() call) - this way you are completely isolated from the blocking nature of the form. You can also ensure that forms don't block by passing ?dontBlock t to hiCreateAppForm(). Note that you can have two callbacks for a form - one for OK and one for Cancel. The additional benefit of callbacks is that if you have an Apply button on your form, the callback would be triggered by that too.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information