• 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. Customising Forms

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 144
  • Views 18486
  • 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

Customising Forms

netbug
netbug over 9 years ago

Dear all,

I would like to know if, on a form, it is possible to verify the information entered in a text box as the user is writing ?

Eg.

I have a text box (I am sorry if this is not the name in SKILL) that asks the user to enter the directory where he wants to save the files. I would like to check that the directory is valid without waiting for the user to press the "OK" button.

I would like as well to know, if it is possible to customise the buttons on a form and force the buttons to use my own functions?

Thanks in advance,

José

  • Cancel
  • psill000
    psill000 over 9 years ago

    Have you tried the function ddsFileBrowseCB.

    The function pops up a file browser fro you to select a file.

    Ex how I use

    hiCreateFormButton(
            ?name 'browseBtn
            ?buttonText "Browse..."
            ?callback "ddsFileBrowseCB( hiGetCurrentForm() 'cdlPath)")

    Paul

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 9 years ago

    Hi,

    Also you can try using a File Selector field which combines the type in string with a "..." browser button, here's a simple example:

    file = hiCreateFileSelectorField(?name 'file ?prompt "File")
    file->hiFileDialogCaption = "File for my thing"
    file->hiSimplifyFilename  = t
    file->hiFileDialogMode    = 'anyFile
    file->hiFileDialogFilter  = "My Thing file (myThing*);;All Files (*)"

    Yes you can customize the buttons, here's a brief example that shows you how using the ?buttonLayout argument to hiCreateAppForm():

    
      form = hiCreateAppForm(?name 'MyThingForm ?fields list(file)
         ?formTitle    "My Thing Form"
         ?buttonLayout '(Empty (MyThing MyThingCB)
                               (Undo MyUndoThingCB)
                               (Close hiFormClose))
      )

    I hope this helps,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 9 years ago

    Hi,

    Thanks to both of you for your inputs.

    Actually I already use a fileSelector, but the goal isn't only to browse to the path and select a directory, but to make sure that the user enters a valid address, if he decides to enter it manually.

    One way is to verify everything when the user presses OK, but I would like to do that verification before closing the form.

    Imagine that, as you enter manually the path, you'll have a label that says "invalid directory" and as you continue typing it will eventually say "Valid Directory !".

    In other languages there are events which are triggered whenever the user writes, clicks, etc.

    Please find below my code, and make any suggestions you like on it.

    Thanks in advance,

    José

    ;==============================================================================
    ;===================== Building the form "createMainForm" ======================
    ;==============================================================================

    procedure(createMainForm()
    let((myLabel myDataPathSelector myRadio1 myRadio2 sep1 mytoggle)

    ; Create the top label
    myLabel=hiCreateLabel(
    ?name 'myLabelText
    ?labelText "Settings"
    ?justification 'center
    )

    ; Create Separator
    sep1=hiCreateSeparatorField(?name 'sep1)

    ; Create Separator
    ;sep2=hiCreateSeparatorField(?name 'sep2)

    ; Allows user to select the config file
    /*myFileSelector = hiCreateFileSelectorField(
    ?name 'fileSelector
    ?mode 'anyFile
    ?prompt "Path to config file: "
    ?value "Insert the path to your config file here !"
    ?defValue "~/Desktop/config.txt"
    )*/

    ; Directory Select allows user to select the directory where to save the files
    myDataPathSelector = hiCreateFileSelectorField(
    ?name 'dataPath
    ?mode 'directoryOnly
    ?prompt "Path to saved images: "
    ?value "Insert the path to your images here !"
    ?defValue "~/Desktop/"
    )

    ;Radio Buttons
    myRadio1 = hiCreateRadioField(
    ?name 'radio1
    ?prompt "Always reload this form"
    ?defValue "No"
    ?callback list( "RadioBtnCB()")
    ?choices list("Yes" "No")
    )

    ;Radio Buttons auto naming of pictures
    myRadio2 = hiCreateRadioField(
    ?name 'radio2
    ?prompt "Image's Naming"
    ?defValue "Auto"
    ; ?callback '("dispMessage("\nConfigFilest Radio button callback\n")" "")
    ?choices list("Auto" "Manual")
    )

    mytoggle = hiCreateToggleField(
    ?name 'overwrite
    ?prompt ""
    ?choices list('(temp "Overwrite config File ?"))
    ?value '(t)
    ?numSelect 1
    ?callback list( "RadioBtnCB()")
    )

    hiCreateAppForm(
    ?name 'settingsForm
    ?formTitle "Script Configuration"
    ?callback "";
    ?fields list(myLabel sep1 myDataPathSelector myRadio1 myRadio2 mytoggle)
    ?buttonLayout `OKCancelDef
    )

    ) ; End let statment
    hiDisplayForm(settingsForm)
    ) ; End Procedure createMainForm

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • psill000
    psill000 over 9 years ago

    What kind action do you want the field to do as it checks when a wrong entry is input?

    What granularity, per character or full string?

    Paul

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago
    Sounds like you want to use the ?modifyCallback in your type-in field.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 9 years ago

    Ok, let's do it another way.

    When the user presses the ok button, how can I prevent the form from closing if there are errors, and issue error messages ?

    Cheers,

    José

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

    José,

    Use the ?unmapAfterCB t argument when creating the form, and then call hiSetCallbackStatus() within the form callback to determine whether the form may be unmapped or not.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 9 years ago

    Thanks Andrew, that solved the problem :-).

    I would like to ask one more thing: is there a way to get the value of a bind key ?

    In my case I have a script with several functions. The main function calls all the others and I would like to execute a part of the main function if key1 is pressed, and other part if key2 is pressed. Is this possible ?

    Best regards,

    José

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

    José,

    I'm not sure what you're trying to achieve here. hiGetBindKey() would get a bind key definition, but I'm not sure that's what you want.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 9 years ago

    Hi Andrew,

    My program saves a plot on ADE-XL when a bindkey is pressed, let's say "s". The first time it runs a menu will pop-up so the user can enter some data. This information is stored into a text file, and the menu won't pop again, unless the user wants to change something. In this case he/she should press a bindkey, let's say ("j"). For this case I would like to invoke the menu again, but executing only the function that displays the menu and writes the config file.

    I thought of a way to solve this that is not the most elegant one but it should work. I could create a new function that only runs that two functions that I need, when "j" is pressed.

    Thanks,

    José

    • 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