• 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. Modal Dialog Boxes from within a Skill++ file.

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 15893
  • 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

Modal Dialog Boxes from within a Skill++ file.

Curtisma
Curtisma over 8 years ago

I am trying to create a modal dialog box using a procedure loaded from a SKILL++ (.ils) file, but it doesn't seem to be modal and the simulation continues to execute before the user makes a selection.  inSkill does not seem to make it modal either.  Can I not have a modal dialog box in SKILL++?  Edit: I also moved it to a Skill (.il) file withourt the inSkill function and it still is not giving me a modal box.  It shows a box both ways but it is not interactive until the rest of the script is complete.

The procedure is:

;dbSkyOpenAdexl
; Opens an Adexl setup database in a new session. If the adexl cellview already exists it is opened in append mode and all elements except history are removed.
; If it does not exist, a new one is created.
;
; USAGE
; dbSkyOpenAdexl(S_libName S_cellName S_viewName)
; INPUTS
; S_libName - library name (string)
; S_cellName - cell name (string)
; S_viewName - view name (string) Usually set to "adexl"
; RETURNS
; A list whose first element is the adxel setup database and the second element is the session. Returns nil if the adexl database cannot be opened.
inSkill(
procedure( ssOpenAdexl(libName cellName viewName "SSS")
let((obj dBoxReplace output ans)
obj=ddGetObj(libName cellName viewName "data.sdb" nil "r")
if(ddIsId(obj) ; == nil
then
importSkillVar( hicQuestionDialog )
ans = hiDisplayAppDBox(?name gensym('dBoxReplace)
?dboxBanner sprintf(nil "Replace %s %s?" cellName viewName)
?dboxText sprintf(nil "Do you you want to update the following ADEXL cellview: \nLibrary: %s\nCell Name: %s\nCell View: %s\n\nYes: The Adexl setup will be updated but simulation history will remain.\n No: The current Adexl cellview will not be changed." libName cellName viewName)
?dialogType hicQuestionDialog
?dialogStyle 'modal
?buttonLayout 'YesNo)
case(ans
((nil) dbClose(obj)
nil)
((t) dbClose(obj)
output=ssOpenAdexlDatabase(libName cellName viewName)))
axlRemoveAll(car(output)) ; Removes all elements except history from the existing database.
else
;dbClose(obj)
; Create a new object since one does not exist
obj=ddGetObj(libName cellName viewName "data.sdb" nil "w")
;dbClose(obj)
ssOpenAdexlDatabase(libName cellName viewName)
); if
) ; let
) ; procedure
) ;inSkill

I am using ic6.1.7 isr12

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Not sure what you're saying here. I took out the inSkill (that wouldn't make it modal anyway - not sure why you thought it would affect this) - and the dialog box blocks the code execution until I hit "Yes" or "No". Once I've hit that the code continues (and fails in my case because I don't have ssOpenAdexlDatabase defined, of course, but actually because the dbClose calls don't make sense). That failure doesn't happen until Yes or No is pressed though.

    *Error* dbClose: argument #1 should be a database object (type template = "d") - dd:0x21527070

    By the way, the dbClose calls are wrong, because they are attempting to close a dd object rather than a db object - so not sure what you're trying to achieve here. I replaced these with ddReleaseObj (not strictly necessary) and then it either fails because of the missing ssOpenAdexlDatabase or the (oddly named, since it isn't a Cadence function, axlRemoveAll).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 8 years ago

    Hey Andrew:

    I tried this again and even running the example modal dialog box is not actually modal.  For example I ran the following code and the nil evaluates before anything is selected in the dialog box.  See the example picture below showing the box still open and the nil has already been evaluated.  

    I tried isSkill because when the code is run from a skill++ script the "importSkillVar( hicQuestionDialog )" call is required before hicQuestionDialog can be called to define the dialogType.  However as you noted it doesn't make a difference, which I tried to capture in my edit which I tried to make as I was rushing out the door on Friday.  

    Any idea how to make these dialog boxes modal?

    Code:

    hiDisplayAppDBox(
    ?name gensym( 'trExampleDialogBox )
    ?dboxBanner "Example"
    ?dboxText sprintf( nil "%L Dialog Type" "hicQuestionDialog")
    ?dialogType hicQuestionDialog
    ?dialogStyle 'modal
    )
    nil

    Example:

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

    Pasting the code into the CIW doesn't really reflect the modality of the dialog box. The issue is that the event loop hasn't kicked in yet so each statement is sent to the evaluator independently.

    If you were to paste:

    {
    hiDisplayAppDBox(
    ?name gensym( 'trExampleDialogBox )
    ?dboxBanner "Example"
    ?dboxText sprintf( nil "%L Dialog Type" "hicQuestionDialog")
    ?dialogType hicQuestionDialog
    ?dialogStyle 'modal
    )
    1234
    }

    into the CIW, then the 1234 won't be evaluated until the dialog box has been interacted with.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 8 years ago
    Hey Andrew:
    Ok, yeah, that worked as expected. Now is this same issue causing it not to be modal when I load my script? Can you explain or point me to a resource that explains the " event loop" and when it runs?
    Do I just need to enclose the whole script in "{}" brackets?
    -Curtis
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 8 years ago
    Andrew:
    Hmm, I seem to have it working now. I changed the way I was doing the case statement with the dialog box call. I'd still be interested in information about the event loop. I did a quick search in the documentation but I couldn't find anything.


    Here is the updated code:
    ;dbSkyOpenAdexl
    ; Opens an Adexl setup database in a new session. If the adexl cellview already exists it is opened in append mode and all elements except history are removed.
    ; If it does not exist, a new one is created.
    ;
    ; USAGE
    ; dbSkyOpenAdexl(S_libName S_cellName S_viewName)
    ; INPUTS
    ; S_libName - library name (string)
    ; S_cellName - cell name (string)
    ; S_viewName - view name (string) Usually set to "adexl"
    ; RETURNS
    ; A list whose first element is the adxel setup database and the second element is the session. Returns nil if the adexl database cannot be opened.
    procedure( ssOpenAdexl(libName cellName viewName "SSS")
    let((obj dBoxReplace output)
    obj=ddGetObj(libName cellName viewName "data.sdb" nil "r")
    if(ddIsId(obj) ; == nil
    then
    importSkillVar( hicQuestionDialog )
    case(hiDisplayAppDBox(?name gensym('dBoxReplace)
    ?dboxBanner sprintf(nil "Replace %s %s?" cellName viewName)
    ?dboxText sprintf(nil "Do you you want to update the following ADEXL cellview: \nLibrary: %s\nCell Name: %s\nCell View: %s\n\nYes: The Adexl setup will be updated but simulation history will remain.\n No: The current Adexl cellview will not be changed." libName cellName viewName)
    ?dialogType hicQuestionDialog
    ?dialogStyle 'modal
    ?buttonLayout 'YesNo)
    ((nil) nil)
    ((t) output=ssOpenAdexlDatabase(libName cellName viewName))
    axlRemoveAll(car(output)) ; Removes all elements except history from the existing database.
    (t (error "Expected t or nil")))
    else
    ;dbClose(obj)
    ; Create a new object since one does not exist
    obj=ddGetObj(libName cellName viewName "data.sdb" nil "w")
    ;dbClose(obj)
    ssOpenAdexlDatabase(libName cellName viewName)
    ); if
    ) ; let
    ) ; procedure

    procedure( ssOpenAdexlDatabase(libName cellName viewName "SSS")
    let((sdb axlSession sessionName)
    sessionName = strcat("myAdexlSession" (sprintf nil "%d" random()))
    axlSession = axlCreateSession(sessionName)

    sdb = axlSetMainSetupDBLCV( axlSession libName cellName viewName)
    ; unless(axlSDBHp(sdb)
    ; printf("The adexl view cannot be opened, attempting to close and reopen it.")
    ; axlCloseSetupDB( sdb )
    ; sdb = axlSetMainSetupDBLCV( axlSession libName cellName viewName)
    unless(axlSDBHp(sdb)
    axlCloseSession(axlSession)
    error("The adexl cellview could not be opened. Please make sure the cellview is closed. If it still does not open, restart cadence and try STC2SIM again."))
    list(sdb axlSession)
    ) ; let
    ) ; procedure
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 8 years ago
    Also, note that I had to enclose the top-level script in "{}" brackets to get it to run as I wanted. Otherwise when I call ssOpenAdexl from the top-level script, I have the same problem as seen in the command window.

    -Curtis
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    Hi Curtis,

    There is a sort-of allusion to this in the documentation for the modal option for hiDisplayAppDBox. It says:

    Note: The 'modal dialog box cannot be displayed before the initialization--which includes reading the .cdsinit file or other SKILL files--is complete. To delay displaying of the 'modal dialog box until initialization is complete, use hiEnqueueCmd.

    The load() function documentation explains that it repeatedly calls lineread() - which will repeatedly read a complete SKILL form (by form, I mean an "s-expression" rather than a UI form) and then call the evaluator. Any UI function which would otherwise block doesn't cause the evaluator to block - it just is that bit of code that is blocked. The UI itself doesn't block until the load has finished and the UI is responding.

    It's a bit complicated to describe, but the general approach if you want to directly launch a blocking UI within a "script" - i.e. at the top level of a file which you load - is to either use hiEnqueueCmd to defer launching the form until the end, or to surround all the code you're calling in some kind of grouping function - such as {}, let() or prog() and so on. That way it's then a single SKILL form (s-expression) and hence it only calls the evaluator once.

    Whilst SKILL isn't multi-threaded, you can sort-of think of this as being a bit like each call to the evaluator as a file is read causing the code to be evaluated to the point where there is a blocking UI displayed, or to the end of the code if there's no blocking UI. So if you had this in your file being loaded:

    procedure(doodah()
      hiDisplayAppDBox(
        ?name gensym( 'trExampleDialogBox )
        ?dboxBanner "Example"
        ?dboxText sprintf( nil "%L Dialog Type" "hicQuestionDialog")
        ?dialogType hicQuestionDialog
        ?dialogStyle 'modal
      )
      println(6789)
    )

    doodah()
    doodah()
    doodah()
    println(1234)

    If you do that, you'll get three dialog boxes and 1234 when you load the file. Then when you OK or cancel each dialog box, it will print 6789. 

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 8 years ago
    Andrew:
    Thanks! I appreciate the explanation. It should be helpful in other situations also.
    -Curtis
    • 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