• 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 14526
  • 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
  • Prabhu The ICL
    Prabhu The ICL over 15 years ago

     Hi, Adi!
                 I may not an expert to give a conclusion for your problem.
                 With the 'SKILL' I have I tried to solve your problem. This too will have a disadvantage, check it out in the end of this message.
    The answer for " WHY? " in your post is as follows ...
    Since your " printf "  statement is in testforms(And you are calling it only once) this will not be displayed again & again.
    I made few modifications to your code ...
    /******************starts here**************************

    ******************
    procedure( testforms()
        let( (form)
            form = hiCreateAppForm(
                ?name 'firstForm
                ?formTitle "First Form"
                ?buttonLayout 'OKCancel
            ?callback "printf(\"First form is finished; Ok button or Cancel button was pressed;\")"
                ?fields list(
                   list(hiCreateButton(
                           ?name 'theTestButton
                           ?buttonText "Test Button"
                           ?callback "TestButtonCollback()")  230:10 140:30)
                     )
                 )
            hiDisplayForm(form)

        )
    )

    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)
                     )
                 )
            hiFormClose(firstForm)
            hiDisplayForm(form2)
            hiDisplayForm(firstForm)

        )
    )

    procedure( UselessButtonCollback()
        let( ()
            printf("The useless button was pressed;\n");
        )
    )
    ****************************ends here*********************************/
    The problem is testforms() procedure is not ending.... means it is not returning anything, this might give a probelm in the future.

    I hope someone will give you best solution on this ....

    Regards.....

    Prabhakar. K --- The ICL Engineer
    SoCtronics
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Adrian Nistor
    Adrian Nistor over 15 years ago

     Thank you for your answer and your sugestions; I will try to resolve the problem with a solution based also on the callback of the form; 

    Doing more tests I succeded to simplify theexample which causes my problem:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

            hiDisplayForm(firstForm)
        )
    )

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I call the procedure testforms(), the form "firstform" appears, I press the button, the form is canceled and immediately displayed, then I close the form and ... no string is printed (from the printf) ...

    Probably is the way Cadecne handles the forms; But .. is there any method to resolve this? I think that no matter what I would do in the form "firstForm", when it's finished (closed with OK or Cancel button), it should return to it's coresponding hiDisplayForm() and to next instructions placed after;

     

    Best Regards,

    Adi.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • 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
  • Adrian Nistor
    Adrian Nistor over 15 years ago

     Hy Andrew,

    Thank you for the explanation, I understand your sugestion. I will try to avoid this kind of code (like in my examples) and use only the callbacks. Like you said seems that everything is acting normally, but one little stream of ideea remains in my head regarding the missing reson of the strange relation between each hiDisplayForm and it's coresponding hiDisplayCallback; 

     

    Thank you,

    Best Regards,

    Adi.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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