• 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. Block execution in SKILL file while a form is on the sc...

Stats

  • Locked Locked
  • Replies 12
  • Subscribers 144
  • Views 18639
  • 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

Block execution in SKILL file while a form is on the screen

HTC060
HTC060 over 11 years ago

Dear SKILL experts

I tried to write a SKILL function that shows a form created by hiCreateAppForm() on the screen and blocks execution until the form is removed from the screen by the user with a OK or Cancel.

In the form I have a listBoxField. The user selects ONE item in the listBox. When OK is pressed the SKILL function that showed the form returns the selected item, when Cancel was selected the function returns nil.

I tried the argument: ?dialogStyle 'modal but the form does not block the execution.

The code is in one SKILL file that I load but the execution of the SKILL statements in the file is not blocked while the form is on the screen.

Here is the code:

file listBox.il:


      ; Create the application form
      hiCreateAppForm(

        ?name 'VARselectListForm
        ?formTitle "Title"
        ?dialogStyle 'modal
        ?initialSize t
        ?buttonLayout 'OKCancel
        ?fields list(
          list(

            hiCreateListBoxField(
                ?name 'VARselectListFormListBox
                ?choices nil
                ?value nil
                ?prompt "Nodes"
            ) ; hiCreateListBoxField

            list(0 0)
            list(150 400)
            50
          ) ; list
        ) ; list

      ) ; hiCreateAppForm

 procedure(SHOWselectListBoxForm(title choices)

    when(and(boundp('VARselectListForm)
             hiIsForm(VARselectListForm))

        VARselectListForm->title = title
        VARselectListForm->VARselectListFormListBox->choices=choices

        hiDisplayForm(VARselectListForm)

        VARselectListForm->VARselectListFormListBox->value

    ) ; when

) ; SHOWselectListBoxForm

And the the file that uses this:

load("listBox.il")

choices = '("aaa" "bbb" "ccc" "ddd" "eee")
title   = "Form title"

printf("Before the box\n")
choice = SHOWselectListBoxForm(title choices)

printf("After the box: %L\n" choice) 

The message After the box............. already appears while the form is on the screen.
I want a blocking solution. The dialog style systemModal is gone.

 Of course I can make a wait loop with global variables, but is there a better way?

Hans Kok

 

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hi Hans,

    This is because if you have UI functionality in a file being loaded, it is effectively reading a SKILL form (an expression, rather than the UI thing) at a time, and sending it to the SKILL evaluator. It's not reading the entire file in and then evaluating it in a block. So it ends up not blocking if you do this. If you change the second file to:


        load("listBox.il")

    let((choices title choice)
        choices = '("aaa" "bbb" "ccc" "ddd" "eee")
        title   = "Form title"

        printf("Before the box\n")
        choice = SHOWselectListBoxForm(title choices)

        printf("After the box: %L\n" choice)
    )

    (The local variables in the let aren't key to this - I just did this for good measure). If you do this, it then works - because it will read the entire let form in, and then evaluate it - and hence it will block within the let. Because your form is modal, you won't be able to type in the CIW or do anything else either - until the form is blocked. So that's what you want, I think.

    Equally I could have done:

    load("listBox.il")

    {
        choices = '("aaa" "bbb" "ccc" "ddd" "eee")
        title   = "Form title"

        printf("Before the box\n")
        choice = SHOWselectListBoxForm(title choices)

        printf("After the box: %L\n" choice)
    }

    And that would work too.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • HTC060
    HTC060 over 11 years ago

    Hello Andrew

    This indeed works. I had the idea I already had this code in a let(() and later I removed the let((). Maybe the form was not deleted from first creation.

    Thanks for the support.  

    Do you now how I can change my forum name HTC060 to other name ??

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GiuseppeGreco
    GiuseppeGreco over 11 years ago

    Hello Andrew,

    just a simple question, sometime, when I try to modify CDF parameters by skill,  I have device callbacks that unleash modal popup and block the execution of the code. Is there a way to bypass this modal behaviour and apply a function such as hiDBoxOK to go on?

    Regards,

    Giuseppe

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hi Giuseppe,

    The way you'd handle this is to use hiRegTimer() to schedule the function to call when the UI event loop returns - provided you do this before the blocking form appears, it will work:

    procedure(CCFblock()
      hiDisplayAppDBox(
        ?name 'CCFblockIt
        ?dialogStyle 'modal
        ?dboxText "Hello World"
      )
    )

    procedure(CCFtestBlock()
      hiRegTimer("hiDBoxOK(CCFblockIt)" 0)
      CCFblock()
    )

    So if you call CCFtestBlock() - you'll see what I mean. Comment out the hiRegTimer() call, and you'd see the dialog box appear.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GiuseppeGreco
    GiuseppeGreco over 11 years ago

    Thank you Andrew,

    just a problem, the function hiDBoxOK need to have the form name, but if the form is launched by a device callback (and I did not know the code)  I need to retrieve this form name but I did not find any way to get it. If I write:

    hiGetCurrentForm()~>name

    it returns nil.

     Is there a solution to this issue?

    Giuseppe

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hi Giuseppe,

    The easiest way is to use Options->Log Filter and turn on the "Accelerated Input" option. Then interact with the dialog box and see what it records in the CIW. Or you could look in the CDS.log file and see what it has output when interacting with that dialog box.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GiuseppeGreco
    GiuseppeGreco over 11 years ago

    It would seems strange to you... but the form uses the function gensym() in the ?name field... so...  it has a different name each run... :-(

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Hi Giuseppe,

    In that case you should give the person who wrote the callback a strong talking to. It's bad enough making a callback with a popup (because this will cause various tools to break - particularly ADE XL if you use the parameterization flow, as it will attempt to run the callbacks for affected devices, and if you have a dialog box displayed in a non-graphical environment, nobody is there to press the button), but doing it with gensym is even worse. It's completely pointless for a modal dialog box since you can never have more than one of them open simultaneously.

    Unfortunately there's no "Get Current Dialog Box" function. Mainly because there's never really a need for one...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GiuseppeGreco
    GiuseppeGreco over 11 years ago

    Thank you Andrew! Very clear the point!

    P.S. I had also opened another post few days ago, I hope to have a feedback also on it! :-) 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GiuseppeGreco
    GiuseppeGreco over 11 years ago
    Dear Andrew,

    sorry to take this discussion again but I tried to find an alternative way to close these damn forms! I found the function hiFormList() that should return all defined forms but in the list I do not recognize my form. Is it possible that any alternative could be used to close this or similar forms?

    Thank you,

    Giusppe
    • 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