Where can i learn to build gui with SKILL

Discussion in 'Cadence' started by Reotaro Hashemoto, Apr 15, 2008.

  1. Hi,

    What are the prerequisites that I have to be aware and what are the
    resources that i need to quickly learn building GUI with Skill (i have
    time frame of about 2 weeks)

    Please guide me through your experience by providing sample self-
    training plan.

    Thanks a lot in advance,
    Best regards,
    Ahmad
     
    Reotaro Hashemoto, Apr 15, 2008
    #1
  2. Reotaro Hashemoto

    Riad KACED Guest

    Hi Ahmad,

    The Cadence documentation is the best ever solution for you :
    Cadence® User Interface SKILL Functions Reference.
    This doc is at the following location in your Cadence stream :
    $CDSHOME/doc/skuiref/skuiref.pdf

    This is a very quick example :

    procedure( sayHelloToAhmad()
    let( (myMessage)
    myMessage = "Hello Ahmad\nWlecome to the wonderful Skill
    World :)"
    hiDisplayAppDBox(
    ?name gensym( 'trWelcomeDialogBox ) ; unique variable
    ?dboxBanner "Hello Ahmad"
    ?dboxText myMessage
    ?dialogType hicWarningDialog
    ?dialogStyle 'modeless
    ?buttonLayout 'Close
    ); hiDisplayAppDBox
    ); let
    ); procedure

    Put it in a file, load it into your CIW ann then type in
    sayHelloToAhmad().

    Good luck !
    Riad.

    PS :
    I would advice to go through the documentation before lunch time and
    then
    run the examples/labs in the afternoon ;-)
     
    Riad KACED, Apr 16, 2008
    #2
  3. Thank you very much for the advice

    Best regards,
    Ahmad
     
    Reotaro Hashemoto, Apr 16, 2008
    #3
  4. Reotaro Hashemoto

    DReynolds Guest

    Ahmad, you can ask your local AE about some code that used to be
    floating around that had an example of each kind of form... as I
    recall it was formFields.il or something similar


    Good luck

    David
     
    DReynolds, Apr 19, 2008
    #4
  5. DReynolds wrote, on 04/19/08 15:02:
    Here's a little example I usually give to people who want a simple starting
    point. The prefix is "ofer" because I wrote it originally as an example for
    somebody called Ofer back in 1999... In particular it has some callbacks, and a
    browse button, and so on...

    /* oferExample.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Feb 09, 1999
    Modified Mar 02, 1999
    By A.D.Beckett

    Example code to demonstrate how to use various form functions,
    use of loading and saving templates, dynamic field addition, etc.

    Note that the templates don't include the values of the
    dynamic fields - that's an exercise for the reader!

    ***************************************************

    SCCS Info: @(#) oferExample.il 03/02/99.14:02:59 1.2

    */

    /***************************************************************
    * *
    * oferCreateForm() *
    * *
    * Create the main form *
    * *
    ***************************************************************/

    procedure(oferCreateForm()
    let((libName cellName viewName browse userData templateFile templateLoad
    templateSave
    sep1 sep2 sep3 radio optionTwo optionThree)
    ; template loading and saving
    templateFile=hiCreateStringField(
    ?name 'templateFile
    ?prompt "Template File"
    )
    templateLoad=hiCreateButton(
    ?name 'templateLoad
    ?buttonText "Load"
    ?callback "oferLoadTemplate()"
    )
    templateSave=hiCreateButton(
    ?name 'templateSave
    ?buttonText "Save"
    ?callback "oferSaveTemplate()"
    )
    ; cellView specification
    sep1=hiCreateSeparatorField(?name 'sep1)
    libName=hiCreateStringField(
    ?name 'libName
    ?prompt "Library Name"
    ?callback "ddsUpdateSyncWithForm()"
    )
    cellName=hiCreateStringField(
    ?name 'cellName
    ?prompt "Cell Name"
    ?callback "ddsUpdateSyncWithForm()"
    )
    viewName=hiCreateStringField(
    ?name 'viewName
    ?prompt "View Name"
    ?callback "ddsUpdateSyncWithForm()"
    )
    browse=hiCreateButton(
    ?name 'browse
    ?buttonText "Browse"
    ?callback "oferSyncBrowser()"
    )
    sep2=hiCreateSeparatorField(?name 'sep2)
    ; example radio button
    radio=hiCreateRadioField(
    ?name 'radio
    ?prompt "Radio"
    ?choices list("One" "Two" "Three")
    ?value "One"
    ?callback list("oferRadioButtonCB()")
    )
    ; extra entries for radio button options two and three
    ; these won't be mapped to start off with.
    optionTwo=hiCreateStringField(
    ?name 'optionTwo
    ?prompt "Option for Two"
    )
    optionThree=hiCreateStringField(
    ?name 'optionThree
    ?prompt "Option for Three"
    )
    ; the user data button
    sep3=hiCreateSeparatorField(?name 'sep3)
    userData=hiCreateButton(
    ?name 'userData
    ?buttonText "User Data"
    ?callback "oferDisplayUserDataForm()"
    )
    hiCreateAppForm(
    ?name 'oferExampleForm
    ?formTitle "Ofer's example form"
    ?fields
    list(
    list(templateFile 0:0 600:30 200)
    list(templateLoad 100:5 45:20)
    list(templateSave 150:5 45:20)
    list(sep1 0:35 600:0)
    list(libName 0:40 600:30 200)
    list(cellName 0:70 600:30 200)
    list(viewName 0:100 600:30 200)
    list(browse 200:130 100:25)
    list(sep2 0:165 600:0)
    list(radio 0:190 600:0 200)
    list(sep3 0:205 600:0)
    list(userData 200:220 100:25)
    )
    )
    ; store the extra fields on the form, ready for later
    oferExampleForm->extraFields=
    list(nil 'optionTwo optionTwo
    'optionThree optionThree)
    oferExampleForm
    )
    )

    /***************************************************************
    * *
    * oferCreateUserDataForm() *
    * *
    * Creates the user data form *
    * *
    ***************************************************************/

    procedure(oferCreateUserDataForm()
    let((userFilename userRadio)
    userFilename=hiCreateStringField(
    ?name 'userFilename
    ?prompt "Filename"
    )
    userRadio=hiCreateRadioField(
    ?name 'userRadio
    ?choices list("a" "b" "c" "d")
    ?value "a"
    ?prompt "Another Radio"
    )
    ; example - don't bother filling
    hiCreateAppForm(
    ?name 'oferUserDataForm
    ?formTitle "Ofer's User Data"
    ?fields list(
    userFilename
    userRadio
    )
    )
    )
    )

    /***************************************************************
    * *
    * oferSaveTemplate() *
    * *
    * Callback code to save the template *
    * *
    ***************************************************************/

    procedure(oferSaveTemplate()
    let( (fileName fport)
    fileName=oferExampleForm->templateFile->value
    when(fileName==""
    error("Must specify template filename")
    )
    fport=outfile(fileName)
    unless(fport
    error("Could not write to template file %s" fileName)
    )
    fprintf(fport "oferKeys='(nil\n")
    ; output all of the main form keys
    foreach(key '(libName cellName viewName radio)
    fprintf(fport " %s %L\n" key get(oferExampleForm key)->value)
    )
    ; output all of the user data form keys
    foreach(key '(userFilename userRadio)
    fprintf(fport " %s %L\n" key get(oferUserDataForm key)->value)
    )
    ; end of the file
    fprintf(fport ")\n")
    close(fport)
    )
    )


    /***************************************************************
    * *
    * oferLoadTemplate() *
    * *
    * Callback code to load the template *
    * *
    ***************************************************************/

    procedure(oferLoadTemplate()
    let( (fileName fport)
    fileName=oferExampleForm->templateFile->value
    when(fileName==""
    error("Must specify template filename")
    )
    ; load it, and trap any errors. The file is just skill
    ; code, so can be loaded.
    errset(load(fileName) t)
    ; the keys are all in a disembodied property list called oferKeys
    ; input all of the main form keys
    ; use get(), because oferKeys->key won't work, because the key variable
    ; needs to be evaluated.
    foreach(key '(libName cellName viewName radio)
    when(get(oferKeys key)
    get(oferExampleForm key)->value=get(oferKeys key)
    )
    )
    ; output all of the user data form keys
    foreach(key '(userFilename userRadio)
    when(get(oferKeys key)
    get(oferUserDataForm key)->value=get(oferKeys key)
    )
    )
    )
    )

    /***************************************************************
    * *
    * oferSyncBrowser() *
    * *
    * Synchronise with the browser *
    * *
    ***************************************************************/

    procedure(oferSyncBrowser()
    ddsSyncWithForm(
    oferExampleForm
    'browse
    'libName
    'cellName
    'viewName
    )
    )

    /****************************************************************
    * *
    * oferRadioButtonCB() *
    * *
    * Callback for the radio button on the form - this adds or *
    * subtracts the dynamic fields. The dynamic fields *
    * are created at startup, and stored in a disembodied property *
    * list on the form, and the form positions are calculated based *
    * on the current positions of fields on the form. *
    * *
    ****************************************************************/

    procedure(oferRadioButtonCB()
    let((radioVal newOffset newPosition oldPosition
    (currentOffset 0) (fieldHeight 30) newYcoord)
    ; determine the offset of the bottom fields at the moment
    when(oferExampleForm->optionTwo
    currentOffset=currentOffset+fieldHeight
    )
    when(oferExampleForm->optionThree
    currentOffset=currentOffset+fieldHeight
    )
    ; determine the offset that we want, based on the radio
    ; button value
    radioVal=oferExampleForm->radio->value
    newOffset=case(radioVal
    ("Two" fieldHeight)
    ("Three" fieldHeight*2)
    (t 0)
    )
    ; shift the two bottom fields by the appropriate amount
    foreach(field '(sep3 userData)
    ; calculate the new position from the old, offset accordingly
    oldPosition=car(hiGetFieldInfo(oferExampleForm field))
    newPosition=xCoord(oldPosition):yCoord(oldPosition)
    +newOffset-currentOffset
    hiMoveField(
    oferExampleForm
    field
    newPosition
    )
    )
    ; delete form fields if they're not needed
    when(radioVal=="One" && oferExampleForm->optionTwo
    hiDeleteField(oferExampleForm 'optionTwo))
    when(radioVal!="Three" && oferExampleForm->optionThree
    hiDeleteField(oferExampleForm 'optionThree))
    ; determine where the extra fields will be placed
    newYcoord=yCoord(car(hiGetFieldInfo(oferExampleForm 'radio)))+10
    ; add the two fields if they're needed and not there already
    when(radioVal=="Two" || radioVal=="Three"
    unless(oferExampleForm->optionTwo
    hiAddField(oferExampleForm
    list(oferExampleForm->extraFields->optionTwo
    0:newYcoord 600:30 200))
    )
    )
    when(radioVal=="Three"
    unless(oferExampleForm->optionThree
    hiAddField(oferExampleForm
    list(oferExampleForm->extraFields->optionThree
    0:newYcoord+fieldHeight 600:30 200))
    )
    )
    ))


    /***************************************************************
    * *
    * oferDisplayUserDataForm() *
    * *
    * Display the user data form - callback from the main form. *
    * *
    ***************************************************************/

    procedure(oferDisplayUserDataForm()
    hiDisplayForm(oferUserDataForm)
    )

    /****************************************************************
    * *
    * oferExampleFormCB(form) *
    * *
    * The form callback - doesn't do much except print out what has *
    * been entered *
    * *
    ****************************************************************/

    procedure(oferExampleFormCB(form)
    printf("You entered cellView %s/%s/%s\n"
    form->libName->value
    form->cellName->value
    form->viewName->value
    )
    printf("The radio button was set to %s\n"
    form->radio->value
    )
    printf("And the user data fields were\nfilename: %s\nradio: %s\n"
    oferUserDataForm->userFilename->value
    oferUserDataForm->userRadio->value
    )
    )

    /***************************************************************
    * *
    * oferExample() *
    * *
    * Main entry point *
    * *
    ***************************************************************/

    procedure(oferExample()
    unless(boundp('oferExampleForm)
    oferCreateForm()
    )
    unless(boundp('oferUserDataForm)
    oferCreateUserDataForm()
    )
    hiDisplayForm(oferExampleForm)
    )
     
    Andrew Beckett, Apr 30, 2008
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.