Hi,
I'm trying to create a popup form that will allow a user to specify a file name and directory in which to save a plot (amoung other things).
The difficulty I'm having is having the form remember the directory and file name between invocations of the form. In the skeleton code below, I've used a pair of global varibles to maintain a history of the previous directory path and file name. This seems like a rather crude approach. The string field structure has a "lastValue" property but I don't know how to make use of it.
My questions are:
1) How to elegantly have the last directory path and file name filled in on the form every time it is invoked.
2) How to maintain the history of these settings between Cadence session. Should I write the variables to a file each time the form completed and then read in the file when initially creating the form in a new session? What is the cleanest approach?
3) I've set the defValue for both fields, but only the plotDirField gets set to the default value when the "Default" button is pushed. The plotNameField retains its previous value. Why?
Thanks for any help.
I'm using IC6.1.5.500.17 if it matters.
Ivars
Code Skeleton:
procedure( igfPlotNameCB( theForm )
igfPlotNameFieldLastValue = theForm->igfPlotNameField->value
);procedure
procedure( igfPlotDirCB( theForm )
igfPlotDirLastValue = theForm->igfPlotDir->value
)
procedure( igfSavePlotFormCB( theForm )
hiSetCallbackStatus( theForm t)
)
igfPlotDirLastValue = "~/"
igfPlotNameFieldLastValue = ""
procedure( igfCreateSavePlotPopUp()
let( (plotDirField plotNameField)
plotDirField = hiCreateFileSelectorField(
?name 'plotDir
?mode 'directory
?prompt "Plot Directory:"
?value igfPlotDirLastValue
?defValue "~/"
?callback "igfPlotDirCB( hiGetCurrentForm() )"
?enabled t
)
plotNameField = hiCreateStringField(
?name 'plotName
?prompt "Plot Name"
?value igfPlotNameLastValue
?defValue " "
?callback "igfPlotNameCB( hiGetCurrentForm() )"
?editable t
)
igfSavePlotForm = hiCreateAppForm(
?name 'igfSavePlotPopUpMenu
?formTitle "Save Plot"
?callback 'igfSavePlotFormCB
?fields list( plotDir plotNameField )
?unmapAfterCB t
)
)
procedure( igfSavePlotPopUp()
when(igfSavePlotForm == 'unbound
igfCreateSavePlotPopup()
); when
hiDisplayForm( igfSavePlotForm )
); procedure igfSavePlotPopUp()
hiSetBindKey( "vivaGraph" "<Key>F6" "igfSavePlotPopUp()" )
↧
Remembering form settings between invocations (and sessions)
↧