background image
C H A P T E R 6
Pickers, Pop-up Views, and Overviews
6-32
Overview Protos
// NOTE: returns the edit slip that is opened
GetLayout("editor.t"):new(tapInfo.nameRef,
tapInfo.editPaths, why, self, 'EditDone, context);
else
begin
// the item is valid, so just toggle the selection
context:Tapped('toggle);
nil;
// Return <nil>.
end;..
end;
The example above assumes that the base view of the layout
editor.t
has a
New
method that opens the editor and returns the associated view.
The editor can be designed to fit your data. However, we suggest that you use a
protoFloatNGo
that is attached to the root view using
BuildContext
. You are
also likely to need a callback to the
pickderDef
so it can appropriately update
the edited or new item. Finally, your editor needs to update your data soup using an
Xmit
soup method so that the list picker updates.
In the
OpenEditor
example above, the last three arguments are used by the editor
to send a callback to the
pickerDef
from the
viewQuitScript
. The design of
the callback function is up to you. Here is an example:
pickerDef.EditDone := func(nameRef, context)
begin
local valid = :Validate(tapInfo.nameRef, tapInfo.editPaths) ;
if (Length(valid) > 0) then
begin
// Something failed. Try and revert back to original
if NOT :ValidatePager(nameRef) AND
self.('[pathExpr: savedPagerValue, nameRef]) = nameRef then
nameRef.pager := savedPagerValue.pager;
context:Tapped(nil);// Remove the checkmark
end;
else
// The nameRef is valid, so select it.
context:Tapped('select);
// Clear the saved value for next time.
savedPagerValue := nil;
end;
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна