• 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 142
  • Views 7736
  • 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

    Updated function:


    procedure( AHbrowseForFile(@optional (dir nil) (filter nil)) ; Argument is a file or directory path as string prog( (file temp okPressed firstSlash) ; Check inputs if(!stringp(dir) || strlen(dir) == 0 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) ) if(!isDir(dir) then dir = getWorkingDir() ) ) ; Create form fields dir = hiCreateStringField( ?name 'dir ?value dir ?callback "if(isDir(dir->value) then hiDeleteField(AHbrowseForFile 'file) file->choices = AHgetFiles(dir->value t \"\\\\.log$\") file->value = list(car(AHgetFiles(dir->value t \"\\\\.log$\"))) hiAddField(AHbrowseForFile list(file 0:30 400:250 0)))" ) file = hiCreateListBoxField( ?name 'file ?choices AHgetFiles(dir->value t "\\.log$") ?value list(car(AHgetFiles(dir->value t "\\.log$"))) ?multipleSelect nil ?doubleClickCB "if(isDir(strcat(dir->value \"/\" car(file->value))) then hiDeleteField(AHbrowseForFile 'dir) dir->value = AHparseDirectory(strcat(dir->value \"/\" car(file->value))) hiAddField(AHbrowseForFile list(dir 0:0 400:30 0)) hiDeleteField(AHbrowseForFile 'file) file->choices = AHgetFiles(dir->value t \"\\\\.log$\") file->value = list(car(AHgetFiles(dir->value t \"\\\\.log$\"))) hiAddField(AHbrowseForFile list(file 0:30 400:250 0)) else hiFormDone(AHbrowseForFile))" ) ; Create form okPressed = nil hiCreateAppForm( ?name 'AHbrowseForFile ?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(AHbrowseForFile) if(okPressed then return(sprintf(nil "%s/%s" dir->value car(file->value))) else return(nil) ) ) ) procedure( AHgetFiles(directory @optional (sort nil) (filter nil)) prog( (allFiles file myFiles) if(stringp(directory) then allFiles = getDirFiles(directory) if(stringp(filter) then rexMagic(t) rexCompile(filter) myFiles = allFiles allFiles = nil foreach(file myFiles if(isDir(strcat(directory "/" file)) || rexExecute(file) then allFiles = cons(file allFiles) ) ) reverse(allFiles) ) if(sort allFiles = sort(allFiles nil) ) ) return(allFiles) ) ) procedure( AHparseDirectory(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) ) )
    Andrew, what are the two arguments expected when calling ddsFileBrowseCB()? It seems to want a string as arg 0 and a form symbol as arg 1 but the form needs a certain field to be defined.


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

    Updated function:


    procedure( AHbrowseForFile(@optional (dir nil) (filter nil)) ; Argument is a file or directory path as string prog( (file temp okPressed firstSlash) ; Check inputs if(!stringp(dir) || strlen(dir) == 0 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) ) if(!isDir(dir) then dir = getWorkingDir() ) ) ; Create form fields dir = hiCreateStringField( ?name 'dir ?value dir ?callback "if(isDir(dir->value) then hiDeleteField(AHbrowseForFile 'file) file->choices = AHgetFiles(dir->value t \"\\\\.log$\") file->value = list(car(AHgetFiles(dir->value t \"\\\\.log$\"))) hiAddField(AHbrowseForFile list(file 0:30 400:250 0)))" ) file = hiCreateListBoxField( ?name 'file ?choices AHgetFiles(dir->value t "\\.log$") ?value list(car(AHgetFiles(dir->value t "\\.log$"))) ?multipleSelect nil ?doubleClickCB "if(isDir(strcat(dir->value \"/\" car(file->value))) then hiDeleteField(AHbrowseForFile 'dir) dir->value = AHparseDirectory(strcat(dir->value \"/\" car(file->value))) hiAddField(AHbrowseForFile list(dir 0:0 400:30 0)) hiDeleteField(AHbrowseForFile 'file) file->choices = AHgetFiles(dir->value t \"\\\\.log$\") file->value = list(car(AHgetFiles(dir->value t \"\\\\.log$\"))) hiAddField(AHbrowseForFile list(file 0:30 400:250 0)) else hiFormDone(AHbrowseForFile))" ) ; Create form okPressed = nil hiCreateAppForm( ?name 'AHbrowseForFile ?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(AHbrowseForFile) if(okPressed then return(sprintf(nil "%s/%s" dir->value car(file->value))) else return(nil) ) ) ) procedure( AHgetFiles(directory @optional (sort nil) (filter nil)) prog( (allFiles file myFiles) if(stringp(directory) then allFiles = getDirFiles(directory) if(stringp(filter) then rexMagic(t) rexCompile(filter) myFiles = allFiles allFiles = nil foreach(file myFiles if(isDir(strcat(directory "/" file)) || rexExecute(file) then allFiles = cons(file allFiles) ) ) reverse(allFiles) ) if(sort allFiles = sort(allFiles nil) ) ) return(allFiles) ) ) procedure( AHparseDirectory(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) ) )
    Andrew, what are the two arguments expected when calling ddsFileBrowseCB()? It seems to want a string as arg 0 and a form symbol as arg 1 but the form needs a certain field to be defined.


    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