Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Cadence > Re: Where can i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 3951 of 4373
Post > Topic >>

Re: Where can i learn to build gui with SKILL

by Andrew Beckett <andrewb@[EMAIL PROTECTED] > Apr 30, 2008 at 10:53 AM

DReynolds wrote, on 04/19/08 15:02:
> 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
> 
> On Apr 15, 8:47 am, Reotaro Hashemoto <ahmad.abdulgh...@[EMAIL PROTECTED]
>
> wrote:
>> 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
> 

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: @[EMAIL PROTECTED]
(#) 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 f****t)
	fileName=oferExampleForm->templateFile->value
	when(fileName==""
	    error("Must specify template filename")
	    )
	f****t=outfile(fileName)
	unless(f****t
	    error("Could not write to template file %s" fileName)
	    )
	fprintf(f****t "oferKeys='(nil\n")
	; output all of the main form keys
	foreach(key '(libName cellName viewName radio)
	    fprintf(f****t "  %s %L\n" key get(oferExampleForm key)->value)
	    )
	; output all of the user data form keys
	foreach(key '(userFilename userRadio)
	    fprintf(f****t "  %s %L\n" key get(oferUserDataForm key)->value)
	    )
	; end of the file
	fprintf(f****t ")\n")
	close(f****t)
	)
     )
	

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

procedure(oferLoadTemplate()
     let( (fileName f****t)
	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)
	    )
	; ****ft 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)
     )
 




 5 Posts in Topic:
Where can i learn to build gui with SKILL
Reotaro Hashemoto <ahm  2008-04-15 05:47:29 
Re: Where can i learn to build gui with SKILL
Riad KACED <riad.kaced  2008-04-16 00:59:59 
Re: Where can i learn to build gui with SKILL
Reotaro Hashemoto <ahm  2008-04-16 05:12:50 
Re: Where can i learn to build gui with SKILL
DReynolds <spurwinktec  2008-04-19 07:02:29 
Re: Where can i learn to build gui with SKILL
Andrew Beckett <andrew  2008-04-30 10:53:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:47:17 CST 2008.