Re: How to make a GUI open file dialog with SKILL?
by Andrew Beckett <andrewb@[EMAIL PROTECTED]
>
May 14, 2008 at 06:06 AM
Riad KACED wrote, on 05/12/08 02:14:
> Hi Andrew,
>
> I think it is worth re-posting it again. The original one seems to end
> in a black hole I'm afraid ;-)
>
> Riad.
And secondly the example of using it:
/* abSelectFileExample.il
Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Feb 15, 2008
Modified
By
An example of using abSelectFile.il
The main entry point is abSelectFileExample()
***************************************************
SCCS Info: @[EMAIL PROTECTED]
(#) abSelectFileExample.il 02/15/08.10:25:18 1.1
*/
/***************************************************************
* *
* abSelectFileExampleCreateForm() *
* *
* Create the example form. *
* *
***************************************************************/
procedure(abSelectFileExampleCreateForm()
let((fileName selectFile)
fileName=hiCreateStringField(
?name 'fileName
?prompt "File Name"
?callback "(abUpdateSelectFile)"
)
selectFile=hiCreateButton(
?name 'selectFile
?buttonText "Select File"
?callback "(abSelectFileExampleSyncWithSelectFile)"
)
hiCreateAppForm(
?name 'abSelectFileExampleForm
?formTitle "Choose filename"
?fields
list(
list(fileName 0:0 405:35 105)
list(selectFile 105:35 95:30)
)
?callback list('abSelectFileExampleCB 'abSelectFileExampleCancelCB)
)
))
/***************************************************************
* *
* abSelectFileExampleSyncWithSelectFile() *
* *
* Callback for the button on the form. Sets up the link with *
* the select file browser. *
* *
***************************************************************/
procedure(abSelectFileExampleSyncWithSelectFile()
abSyncWithSelectFile(
abSelectFileExampleForm
'fileName
nil)
)
/***************************************************************
* *
* abSelectFileExampleCB(form) *
* *
* Callback for form. Views the specified file. *
* *
***************************************************************/
procedure(abSelectFileExampleCB(form)
abEndSyncWithSelectFile()
if(isFile(form->fileName->value) then
view(form->fileName->value)
else
warn("Invalid file: %s\n" form->fileName->value)
)
)
/***************************************************************
* *
* abSelectFileExampleCancelCB(form) *
* *
* Callback for when form is cancelled. Breaks link with select *
* file browser *
* *
***************************************************************/
procedure(abSelectFileExampleCancelCB(_form)
abEndSyncWithSelectFile()
)
/***************************************************************
* *
* abSelectFileExample() *
* *
* Create the form if it doesn't exist, and display it *
* *
***************************************************************/
procedure(abSelectFileExample()
unless(boundp('abSelectFileExampleForm)
abSelectFileExampleCreateForm()
)
hiDisplayForm(abSelectFileExampleForm)
)