• 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. Prompt Error Message on ciw when fields is empty

Stats

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

Prompt Error Message on ciw when fields is empty

saurabh96
saurabh96 over 4 years ago

Hey there,

How can i display/prompt a error message on cadence virtuoso CIW when fields(*) which is empty or if wrong file format is given ;something like sanity check..here is below skill code am using..

Regards,

SRV

procedure(LayForm()
let((field1Label field1Entry field2Label field2Entry extraParams browse_file_Entry
paramLabel minLabel stepLabel maxLabel
paramEntry minEntry stepEntry maxEntry
gridLayout)
field1Label=hiCreateLabel(
?name 'field1Label
?labelText "block test1*"
?justification 'right
)
field1Entry=hiCreateStringField(
?name 'field1Entry
)
field2Label=hiCreateLabel(
?name 'field2Label
?labelText "block test2*"
?justification 'right
)
field2Entry=hiCreateStringField(
?name 'field2Entry)


browse_file_Entry=hiCreateButton(
?name 'browse_file_Entry
?buttonText "Browse"
?callback "ddsFileBrowseCB(hiGetCurrentForm() 'field2Entry \"*.tvf\")")

extraParams=hiCreateDisclosureTriangle(
?name 'extraParams
?labelText "Extra Parameters"
?onFields
list(
'paramLabel 'minLabel 'stepLabel 'maxLabel
'paramEntry 'minEntry 'stepEntry 'maxEntry
)
)
paramLabel=hiCreateLabel(
?name 'paramLabel
?labelText "<b>Parameter</b>"
)
minLabel=hiCreateLabel(
?name 'minLabel
?labelText "<b>Minimum</b>"
)
stepLabel=hiCreateLabel(
?name 'stepLabel
?labelText "<b>Step</b>"
)
maxLabel=hiCreateLabel(
?name 'maxLabel
?labelText "<b>Maximum</b>"
)
paramEntry=hiCreateStringField(
?name 'paramEntry
)
minEntry=hiCreateStringField(
?name 'minEntry
)
stepEntry=hiCreateStringField(
?name 'stepEntry
)
maxEntry=hiCreateStringField(
?name 'maxEntry
)
gridLayout=hiCreateGridLayout(
'gridLayout
?items list(
list(field1Label 'horiz_align 'right 'row 0 'col 0)
list(field1Entry 'horiz_align 'right 'row 0 'col 1 'col_span -1)
list(extraParams 'horiz_align 'left 'row 1 'col 0)
list(paramLabel 'horiz_align 'left 'row 2 'col 0)
list(minLabel 'horiz_align 'left 'row 2 'col 1)
list(stepLabel 'horiz_align 'left 'row 2 'col 2)
list(maxLabel 'horiz_align 'left 'row 2 'col 3)
list(paramEntry 'horiz_align 'left 'row 3 'col 0)
list(minEntry 'horiz_align 'left 'row 3 'col 1)
list(stepEntry 'horiz_align 'left 'row 3 'col 2)
list(maxEntry 'horiz_align 'left 'row 3 'col 3)
list(field2Label 'horiz_align 'right 'row 4 'col 0)
list(field2Entry 'horiz_align 'right 'row 4 'col 1 'col_span -1)
list(browse_file_Entry 'horiz_align 'right 'row 4 'col 8 )
list('col_stretch 0 1)
list('col_stretch 1 1)
list('col_stretch 2 1)
list('col_stretch 3 1)
)
)
hiCreateLayoutForm(
'LayForm
"PARAM"

hiCreateVerticalBoxLayout(
'vbox
?items list(
gridLayout
list('stretch_item 1)
)
)
)
LayForm
)
hiDisplayForm(LayForm)
)

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

    You'd probably have a callback on the form (specified via ?callback in the hiCreateLayoutForm) which checked the values of the fields in question and ensured they are correct. You could use blankstrp() to check if they are empty, or whatever logic you need to determine whether they are valid or not. Then print a message in the CIW (using printf - I'm assuming I don't need to explain how to print information). You could also use hiDisplayAppDBox (or one of the other DBox functions) to display a dialog box.

    Another strategy (still using the callback to check) would be to use ?unmapAfterCB on the hiCreateLayoutForm and then hiSetCallbackStatus within the callback to either allow or veto the closure of the form. Typically you might then raise a dialog box, print in the CIW, or use hiHilightField to draw attention to the field in question. This approach is used in examples in the SKILL Language Programming training class on Cadence Online Support that I have referred you to before.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 4 years ago in reply to Andrew Beckett

    Thanks, Andrew..I have written below skill code its working fine as expected...
    Few are my questions..
    Here is an issue,when * marked field is empty error prompt is opens but the parent window and the if any value in parent window given gets disappears...i want that When the error window prompts...the parent window will remain so that the user can edit or modify it.

    procedure(LayForm()
    let((field1Label field1Entry field2Label field2Entry extraParams browse_file_Entry
    paramLabel minLabel stepLabel maxLabel
    paramEntry minEntry stepEntry maxEntry
    gridLayout)
    field1Label=hiCreateLabel(
    ?name 'field1Label
    ?labelText "block test1*"
    ?justification 'right
    )
    field1Entry=hiCreateStringField(
    ?name 'field1Entry
    )
    field2Label=hiCreateLabel(
    ?name 'field2Label
    ?labelText "block test2*"
    ?justification 'right
    )
    field2Entry=hiCreateStringField(
    ?name 'field2Entry)


    browse_file_Entry=hiCreateButton(
    ?name 'browse_file_Entry
    ?buttonText "Browse"
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'field2Entry \"*.tvf\")")

    extraParams=hiCreateDisclosureTriangle(
    ?name 'extraParams
    ?labelText "Extra Parameters"
    ?onFields
    list(
    'paramLabel 'minLabel 'stepLabel 'maxLabel
    'paramEntry 'minEntry 'stepEntry 'maxEntry
    )
    )
    paramLabel=hiCreateLabel(
    ?name 'paramLabel
    ?labelText "<b>Parameter</b>"
    )
    minLabel=hiCreateLabel(
    ?name 'minLabel
    ?labelText "<b>Minimum</b>"
    )
    stepLabel=hiCreateLabel(
    ?name 'stepLabel
    ?labelText "<b>Step</b>"
    )
    maxLabel=hiCreateLabel(
    ?name 'maxLabel
    ?labelText "<b>Maximum</b>"
    )
    paramEntry=hiCreateStringField(
    ?name 'paramEntry
    )
    minEntry=hiCreateStringField(
    ?name 'minEntry
    )
    stepEntry=hiCreateStringField(
    ?name 'stepEntry
    )
    maxEntry=hiCreateStringField(
    ?name 'maxEntry
    )
    gridLayout=hiCreateGridLayout(
    'gridLayout
    ?items list(
    list(field1Label 'horiz_align 'right 'row 0 'col 0)
    list(field1Entry 'horiz_align 'right 'row 0 'col 1 'col_span -1)
    list(extraParams 'horiz_align 'left 'row 1 'col 0)
    list(paramLabel 'horiz_align 'left 'row 2 'col 0)
    list(minLabel 'horiz_align 'left 'row 2 'col 1)
    list(stepLabel 'horiz_align 'left 'row 2 'col 2)
    list(maxLabel 'horiz_align 'left 'row 2 'col 3)
    list(paramEntry 'horiz_align 'left 'row 3 'col 0)
    list(minEntry 'horiz_align 'left 'row 3 'col 1)
    list(stepEntry 'horiz_align 'left 'row 3 'col 2)
    list(maxEntry 'horiz_align 'left 'row 3 'col 3)
    list(field2Label 'horiz_align 'right 'row 4 'col 0)
    list(field2Entry 'horiz_align 'right 'row 4 'col 1 'col_span -1)
    list(browse_file_Entry 'horiz_align 'right 'row 4 'col 8 )
    list('col_stretch 0 1)
    list('col_stretch 1 1)
    list('col_stretch 2 1)
    list('col_stretch 3 1)
    )
    )
    hiCreateLayoutForm(
    'LayForm
    "PARAM"

    ;--------------------------------------------------------
    ; Surrounding vertical box layout is to have a stretchable
    ; item below the layout to absorb all the stretchiness!
    ;--------------------------------------------------------
    hiCreateVerticalBoxLayout(
    'vbox
    ?items list(
    gridLayout
    list('stretch_item 1)
    )
    )
    ?callback '(firstForm)
    )
    LayForm
    )
    hiDisplayForm(LayForm)
    )
    procedure( firstForm(form)
    let((Sel cellName)
    Sel='()
    foreach(var '(field1Entry field2Entry )
    set(var getq(get(form var) value))
    );foreach
    ddsEndSyncWithForm()
    if(forall(lib list(field1Entry field2Entry ) !blankstrp(lib)) then
    hiSetCallbackStatus(form t)
    Sel=append1(Sel field1Entry )
    Sel=append1(Sel field2Entry )
    cellName = outfile("./cellname" "w")
    fprintf(cellName "%L " field1Entry)
    fprintf(cellName "%L " field2Entry)
    close(cellName)
    hiSetCallbackStatus(form t)
    else
    hiSetCallbackStatus(form nil)
    hiDisplayAppDBox( ?name 'errorbox2 ?dboxBanner "ERROR" ?dboxText "Enter Cell Name and View name \n" ?buttonLayout 'Close ?buttons 'Cancel)
    ); if

    );let
    );procedure

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to saurabh96

    You didn't add ?unmapAfterCB to the hiCreateLayoutForm call as I suggested before. If you add this, then it solves your problem, For example:

    ?callback '(firstForm)
    ?unmapAfterCB t

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 4 years ago in reply to Andrew Beckett

    Thanks a lot, Andrew; it worked perfectly...
    Andrew, for the below skill code...I have two queries.
    1) for the radio button, which is dependent on text string on/off...If a text box is disabled using the radio button.. error window is still poping...how can I fix that error window  only pops for enabled field?


    2)blankstrp() - this is used to check blank string...is there any alternative to the same check for the list box?


    Regards,
    SRV

    Entry=hiCreateListBoxField(
    ?name 'Entry
    ?prompt "entry_all"
    ?multipleSelect t
    ?choices (list "1" "2" "3" "4" "5" ))

    net= hiCreateStringField(
    ?name 'net
    ?prompt "Enter Netlist Path"
    ?value ""
    )

    button_net_data = hiCreateButton(
    ?name 'button_net_data
    ?buttonText "Browse"
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'net \"\" 'fileOnly)"
    )

    libNameField = hiCreateStringField(
    ?name 'libName
    ?prompt "library_name"
    ?value ""
    )

    browseSourceButton = hiCreateButton(
    ?name 'browseSource
    ?callback "dmbSyncWithForm(AppForm 'browse 'libName 'CycField)"
    ?buttonText "Browse"
    )
    netlists=hiCreateRadioField(
    ?name 'netlists
    ?prompt ""
    ?choices list("Netlist Path" "Cell View")
    ?value "Cell View"
    ?enabled t
    ; no idea how this was supposed to work - it's a random set of values!
    ;?callback list("(hiSetFieldEnabled() 'netlists 'net '(t nil ) ;;)"
    ?callback list("MyEnableFields(hiGetCurrentForm())")
    )

    procedure(MyEnableFields(form)
    let((netEnabled)
    case(form->netlists->value
    ("Cell View"
    netEnabled=nil
    )
    ("Netlist Path"
    netEnabled=t
    )
    )
    hiSetFieldEnabled(form->net netEnabled)
    hiSetFieldEnabled(form->button_net_data netEnabled)
    hiSetFieldEnabled(form->libName !netEnabled)
    hiSetFieldEnabled(form->browseSource !netEnabled)
    )
    )

    hiCreateAppForm(?name 'forum86 ?fields ?callback '(firstForm) list(Entry net button_net_data libNameField browseSourceButton netlists)
    ?unmapAfterCB t)
    MyEnableFields(forum86)
    hiDisplayForm(forum86)

    procedure(firstForm(form)
    let((Sel cellName)
    Sel='()
    foreach(var '(net libname Entry )
    set(var getq(get(form var) value))
    );foreach
    ddsEndSyncWithForm()
    if(forall(lib list(net libname Entry ) !blankstrp(lib)) then
    hiSetCallbackStatus(form t)
    Sel=append1(Sel net )
    Sel=append1(Sel libname )
    Sel=append1(Sel Entry )
    cellName = outfile("./cellname" "w")
    fprintf(cellName "%L " net)
    fprintf(cellName "%L " libname)
    fprintf(cellName "%L " Entry)
    close(cellName)
    hiSetCallbackStatus(form t)
    else
    hiSetCallbackStatus(form nil)
    hiDisplayAppDBox( ?name 'errorbox2 ?dboxBanner "ERROR" ?dboxText "Enter Cell Name and View name \n" ?buttonLayout 'Close ?buttons 'Cancel)
    ); if

    );let
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to saurabh96

    It's really hard debugging your code when there's no indentation. I'm assuming this is being lost when you've pasted it, but it ought to be possible to paste into the browser with the indentation (I do this all the time, as do many others). Without that I have to re-indent the code to understand it.

    For the first question, this is presumably just a matter of using either the value of form->netlists->value to determine which fields are valid to check, or form->libName->enabled etc to determine whether the field is enabled. I'll let you determine the logic to use because currently your code is writing all the field values out into a file - presumably that doesn't make sense if not all the fields are valid?

    I don't really understand what you mean by an equivalent of blankstrp for list boxes. Presumably you just check form->Entry->value - if it's nil, then nothing is selected. If one or more lines are selected, the ->value is the list of selected items.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to saurabh96

    It's really hard debugging your code when there's no indentation. I'm assuming this is being lost when you've pasted it, but it ought to be possible to paste into the browser with the indentation (I do this all the time, as do many others). Without that I have to re-indent the code to understand it.

    For the first question, this is presumably just a matter of using either the value of form->netlists->value to determine which fields are valid to check, or form->libName->enabled etc to determine whether the field is enabled. I'll let you determine the logic to use because currently your code is writing all the field values out into a file - presumably that doesn't make sense if not all the fields are valid?

    I don't really understand what you mean by an equivalent of blankstrp for list boxes. Presumably you just check form->Entry->value - if it's nil, then nothing is selected. If one or more lines are selected, the ->value is the list of selected items.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • saurabh96
    saurabh96 over 4 years ago in reply to Andrew Beckett

    Hey Andrew,

    am getting this error -- *Error* blankstrp: argument #1 should be a string (type template = "t") - nil

    procedure(forum86()
    let((Entry net button_net_data libNameField browseSourceButton netlists)
    Entry=hiCreateListBoxField(
    ?name 'Entry
    ?prompt "entry_all"
    ?multipleSelect t
    ?choices (list "1" "2" "3" "4" "5" ))

    net= hiCreateStringField(
    ?name 'net
    ?prompt "Enter Netlist Path"
    ?value ""
    )

    button_net_data = hiCreateButton(
    ?name 'button_net_data
    ?buttonText "Browse"
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'net \"\" 'fileOnly)"
    )

    libNameField = hiCreateStringField(
    ?name 'libName
    ?prompt "library_name"
    ?value ""
    )

    browseSourceButton = hiCreateButton(
    ?name 'browseSource
    ?callback "dmbSyncWithForm(AppForm 'browse 'libName 'CycField)"
    ?buttonText "Browse"
    )
    netlists=hiCreateRadioField(
    ?name 'netlists
    ?prompt ""
    ?choices list("Netlist Path" "Cell View")
    ?value "Cell View"
    ?enabled t
    ; no idea how this was supposed to work - it's a random set of values!
    ?callback list("MyEnableFields(hiGetCurrentForm())")
    )

    procedure(MyEnableFields(form)
    let((netEnabled)
    case(form->netlists->value
    ("Cell View"
    netEnabled=nil
    )
    ("Netlist Path"
    netEnabled=t
    )
    )
    hiSetFieldEnabled(form->net netEnabled)
    hiSetFieldEnabled(form->button_net_data netEnabled)
    hiSetFieldEnabled(form->libName !netEnabled)
    hiSetFieldEnabled(form->browseSource !netEnabled)
    )
    )

    hiCreateAppForm(?name 'forum86 ?fields ?callback '(firstForm secondForm) list(Entry net button_net_data libNameField browseSourceButton netlists)
    ?unmapAfterCB t)
    MyEnableFields(forum86)
    hiDisplayForm(forum86)
    )
    )

    procedure(firstForm(form)
    if(blankstrp(form->Entry->value) then
    warn("Entry is empty, please check and try again\n") ;; issue a warning message
    hiHighlightField(form 'Entry 'error) ;; hilight the string field
    hiSetCallbackStatus(form nil) ;; prevent the form from unmapping from the screen
    else
    hiHighlightField(form 'Entry 'background)
    ;; do the desired form action...
    ); if
    )

    procedure(secondForm(form)
    if(blankstrp(form->netlists->value) then
    warn("String filed is empty, please check and try again\n") ;; issue a warning message
    hiHighlightField(form 'netlists 'error) ;; hilight the string field
    hiSetCallbackStatus(form nil) ;; prevent the form from unmapping from the screen
    else
    hiHighlightField(form 'netlists 'background)
    ); if
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to saurabh96

    Please, please, please take the SKILL Programming class! You need to understand the basics of how there are various different types of data (strings, lists, integers, etc) in the language, and how functions are designed to work with particular types of data. 

    form->Entry->value is going to return a list. blankstrp is expecting a string, so clearly that's never going to work if you pass a list to a function expecting a string. You do not need to use blankstrp here - you're not trying to see if a string is blank, so why would you use it?

    It should be sufficient to do this (remember that in SKILL, nil means false, and anything else means true).

    if(form->Entry->value then
       ; some value was selected - do whatever you want here
    else
       ; nothing was selected - display the error
    )

    Also, you have specified the ?callback for hiCreateAppForm as a list of two callback functions. If you do that (if you read the documentation, you'll see this) then the first is the OK callback and the second is the Cancel callback. So that means that secondForm is only called if you hit Cancel, which I assume is not what you wanted.

    Andrew

    • 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