• 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. GUI - Select File Form

Stats

  • Locked Locked
  • Replies 16
  • Subscribers 148
  • Views 8828
  • 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

GUI - Select File Form

archive
archive over 17 years ago

Hello,

In a SKILL program, I would need to let user specify the input file using GUI form, where he can browse the directory structure and select a file. Does some pre-prepared form exist or do I have to make my own using SKILL User Interface functions?
I have searched sourcelink, but found nothing.

Thanks,
Miro


Originally posted in cdnusers.org by miro
  • Cancel
Parents
  • archive
    archive over 17 years ago

    Here is a file browser I wrote that you can use:

    procedure( browseForFile(@optional (dir nil)) ; Argument is a file or directory path as string prog( (file temp okPressed firstSlash) ; Check inputs if(!stringp(dir) then dir = getWorkingDir() ) ; Get starting directory if(!isDir(dir) then if(substring(dir 1 1) == "/" then firstSlash = t else firstSlash = nil ) temp = parseString(dir "/") dir = car(temp) for(a 1 sub1(sub1(length(temp))) dir = strcat(dir "/" nth(a temp)) ) if(firstSlash then dir = strcat("/" dir) ) ) ; Create form fields dir = hiCreateStringField( ?name 'dir ?value dir ?callback "if(isDir(dir->value) then hiDeleteField(browseForFile 'file) file->choices = getDirFiles(dir->value) file->value = list(car(getDirFiles(dir->value))) hiAddField(browseForFile list(file 0:30 400:250 0)))" ) file = hiCreateListBoxField( ?name 'file ?choices getDirFiles(dir->value) ?value list(car(getDirFiles(dir->value))) ?multipleSelect nil ?doubleClickCB "if(isDir(strcat(dir->value \"/\" car(file->value))) then hiDeleteField(browseForFile 'dir) dir->value = parseDirectory(strcat(dir->value \"/\" car(file->value))) hiAddField(browseForFile list(dir 0:0 400:30 0)) hiDeleteField(browseForFile 'file) file->choices = getDirFiles(dir->value) file->value = list(car(getDirFiles(dir->value))) hiAddField(browseForFile list(file 0:30 400:250 0)) else hiFormDone(browseForFile))" ) ; Create form okPressed = nil hiCreateAppForm( ?name 'browseForFile ?formTitle "Browse For File" ?buttonLayout 'OKCancel ?callback "okPressed = t" ?fields list( list(dir 0:0 400:30 0) list(file 0:30 400:250 0) ) ?initialSize t ) hiDisplayForm(browseForFile) if(okPressed then return(sprintf(nil "%s/%s" dir->value car(file->value))) else return(nil) ) ) ) procedure( parseDirectory(dir) prog( (fS arr) if(substring(dir 1 2) == ".." dir = strcat(getWorkingDir() "/" dir) ) if(substring(dir 1 1) == "/" fS = t ) arr = parseString(dir "/") dir = car(arr) for(a 1 sub1(length(arr)) if(nth(a arr) != "." && nth(a arr) != ".." && nth((a+1) arr) != ".." then dir = strcat(dir "/" nth(a arr)) ) ) if(fS dir = strcat("/" dir) ) return(dir) ) )


    Originally posted in cdnusers.org by ahamlett
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 17 years ago

    Here is a file browser I wrote that you can use:

    procedure( browseForFile(@optional (dir nil)) ; Argument is a file or directory path as string prog( (file temp okPressed firstSlash) ; Check inputs if(!stringp(dir) then dir = getWorkingDir() ) ; Get starting directory if(!isDir(dir) then if(substring(dir 1 1) == "/" then firstSlash = t else firstSlash = nil ) temp = parseString(dir "/") dir = car(temp) for(a 1 sub1(sub1(length(temp))) dir = strcat(dir "/" nth(a temp)) ) if(firstSlash then dir = strcat("/" dir) ) ) ; Create form fields dir = hiCreateStringField( ?name 'dir ?value dir ?callback "if(isDir(dir->value) then hiDeleteField(browseForFile 'file) file->choices = getDirFiles(dir->value) file->value = list(car(getDirFiles(dir->value))) hiAddField(browseForFile list(file 0:30 400:250 0)))" ) file = hiCreateListBoxField( ?name 'file ?choices getDirFiles(dir->value) ?value list(car(getDirFiles(dir->value))) ?multipleSelect nil ?doubleClickCB "if(isDir(strcat(dir->value \"/\" car(file->value))) then hiDeleteField(browseForFile 'dir) dir->value = parseDirectory(strcat(dir->value \"/\" car(file->value))) hiAddField(browseForFile list(dir 0:0 400:30 0)) hiDeleteField(browseForFile 'file) file->choices = getDirFiles(dir->value) file->value = list(car(getDirFiles(dir->value))) hiAddField(browseForFile list(file 0:30 400:250 0)) else hiFormDone(browseForFile))" ) ; Create form okPressed = nil hiCreateAppForm( ?name 'browseForFile ?formTitle "Browse For File" ?buttonLayout 'OKCancel ?callback "okPressed = t" ?fields list( list(dir 0:0 400:30 0) list(file 0:30 400:250 0) ) ?initialSize t ) hiDisplayForm(browseForFile) if(okPressed then return(sprintf(nil "%s/%s" dir->value car(file->value))) else return(nil) ) ) ) procedure( parseDirectory(dir) prog( (fS arr) if(substring(dir 1 2) == ".." dir = strcat(getWorkingDir() "/" dir) ) if(substring(dir 1 1) == "/" fS = t ) arr = parseString(dir "/") dir = car(arr) for(a 1 sub1(length(arr)) if(nth(a arr) != "." && nth(a arr) != ".." && nth((a+1) arr) != ".." then dir = strcat(dir "/" nth(a arr)) ) ) if(fS dir = strcat("/" dir) ) return(dir) ) )


    Originally posted in cdnusers.org by ahamlett
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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