• 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 7727
  • 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
  • archive
    archive over 17 years ago

    Try using the axlDMFileBrowse skill command.


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

    The axlDMFileBrowser would have been fine if this was an SPB forum, because that's for Allegro. But this is a CIC forum, so the question is presumably for DFII.

    In ICOA5251 onwards (i.e. IC61 onwards in supported releases), you have hiDisplayFileDialog() which does this. Before that, you'll have to write your own or ask customer support nicely if they can send you one. There's one I wrote included in CCR 502768 (if I have a chance, I'll create a solution for it for sourcelink).

    Andrew.


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

    Thanks a lot for a tip Andrew.
    Miro


    Originally posted in cdnusers.org by miro
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • 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
  • archive
    archive over 17 years ago

    Alan, it's generally recommended to use a prefix for your function names, and for customer code, it should begin with upper case. It then avoids clashing with any other function parseDirectory, browseForFile etc.

    BTW there's actually a built-in browser, even in IC5141 which I hadn't realised at the time I appended before was public. This was added in IC5141 USR4, and is called ddsFileBrowseCB(). For more details see my sourcelink solution number 11457794, as well as the documentation.

    Regards,

    Andrew.


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

    Hi, Andrew,

    For ddsFileBrowseCB(), if I like to control the location of the initial "Current Directory" instead of the default director for the purpose of easy navigation, any easy way to achieve this?

    Thanks,

    Tongju


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

    Tongju,

    The browser is seeded from any directory that is in the field on your form. So you can do it this way. If the field is blank, it uses the current directory; if not blank, it uses the directory that is the field value.

    Andrew.


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

    Thank you, Andrew! It works great! Tongju


    Originally posted in cdnusers.org by Tongju
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • 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
  • archive
    archive over 17 years ago

    The first argument is not a string. It's a form object. It's

    ddsFileBrowseCB(form 'fieldName)

    e.g.

    ddsFileBrowseCB(hiGetCurrentForm() 'fileNameField)

    The solution I mention above gives an example. It's also covered in (at least) the IC612 documentation. Not checked - perhaps it didn't make it into the IC5141 docs since it got added only in a USR.

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • 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