AssistantFrames
view release on metacpan or search on metacpan
This is for handcoded sequencing through dialogs - this allows a
flexible sequence and shows some more of the methods.
use Mac::AssistantFrames;
my $assist = Mac::AssistantFrames->new();
while ($assist->running()) {
my $last = $assist->getLastFrame();
if ($last eq "<empty>") {
$assist->startFrame("title", "description");
} elsif ($last eq "<start>") {
$assist->constantFrame("dlg1", "title",
"description", "value");
} elsif ($last eq "dlg1") {
$assist->singleSelectionFrame("dlg2", "title",
"description",
["v1", "v2", "v3"]);
} elsif ($last eq "dlg2") {
$assist->constantHiddenFrame("dlg3", "value");
} elsif ($last eq "dlg3") {
$assist->finishFrame("title", "description");
}
}
if ($assist->getLastFrame eq "<finish>") {
print $assist->joinedAnswersr(":"), "\n";
} else {
print "aborted\n";
}
DESCRIPTION
This Module implements simple assistant style frames for
MacPerl. You can use it if you need to ask the user some
questions in sequence to accomplish a task. This could be done
with one dialogbox, too. But the assistant approach is often
easier to understand, especially if the user doesn't know much
about the subject at hand. This is the case most often with
configuration of new software packages, where the user has to be
given much more detailed descriptions of what to do as would fit
on a simple dialog.
The AssistantFrame allows backward navigation in case the user
erred on some of his answers. It allows complete backwind of the
frames (abortion of the process) and it has a uniform
userinterface that resembles a lot the Mac-style assistants.
CLASS METHODS
new()
This constructor creates a new frame sequence object.
Version()
This method returns the version of the module.
METHODS
running()
This checks if the assistant object is in running state. If
the "<start>" frame is aborted, this is reset to 0. If the
"<finish>" frame is accepted, this is reset to 0.
backupOne()
This method backs up one frame. This is internally used, you
seldom have to invoke it yourself.
continueOne(name, value)
This method adds a successfull frame to the sequence. This
is used internally, so you shouldn't need to call this
yourself.
abort([text])
This method stops the assistant. If "text" is given, it
creates an alert dialog. If it is not given, the assistant
is just canceled. This can be used to react on errors in a
assistant processing.
standardAction(name, dlg)
This method is internally used to process the events from
the dialog. Just ignore it.
getLastFrame()
This method returns the last frame the user completed. This
is needed to allow backing up and sequencing correctly. If
the sequence of frames is empty, it returns "<empty>".
getLastFrameRaw()
This method is used to get the last frame, as is
getLastFrame. Only difference: getLastFrameRaw delivers the
frame-name in "raw" format - names of hidden constant
elements is bracketed in []. This function is used
internally to distinguish frames from constants.
getLastAnswer()
This returns the last answer given. It is usefull to make
frames dependend on older frames.
getAnswers()
This returns a reference to the array of the answer-strings.
joinedAnswers(sep)
This returns a string created by joining all answers
together, separated by sep.
getNumAnswers()
This returns the number of accumulated answers.
addToSequence(closure)
This adds the closure to the sequence array of the
assistant. The sequence array allows a simple processing of
a static sequence of frames.
processSequence()
This processes the sequence array and returns a reference to
the array of answers.
FRAMES
startFrame(title, description)
This frame has the special name "<start>". It must be the
first frame in the sequence and should give the user a short
introduction into the task at hand. The user can only abort
the sequence if he is at this frame and backs up, or by
closing the window of the current frame (this can be done in
( run in 1.079 second using v1.01-cache-2.11-cpan-39bf76dae61 )