Apple Newton Utilities Guía de usuario Pagina 231

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 942
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 230
CHAPTER 6
Pickers, Pop-up Views, and Overviews
Overview Protos 6-31
Validation and Editing in protoListPicker 6
The built-in validation mechanism is not designed to deal with nested soup
information. In general, you gain more exibility by not using a
validationFrame in your pickerDef, even if you have no nested entries.
Instead, you can provide your own validation mechanism and editors:
dene a Validate method in your picker denition
dene an OpenEditor method in your picker denition
draw a layout for each editor you require
Here is how your
Validate method should work. The following example
assumes that pickerDef.ValidateName and pickerDef.ValidatePager have
been implemented:
pickerDef.Validate := func(nameRef, pathArray)
begin
// keep track of any paths that fail
local failedPaths := [];
for each index, path in pathArray do
begin
if path = 'name then
begin
// check if name validation fails
if NOT :ValidateName(nameRef) then
// if so, add it to array of failures
AddArraySlot(failedPaths, path);
end;
else begin
if NOT :ValidatePager(nameRef) then
AddArraySlot(failedPaths, path);
end;
end;
// return failed paths or empty array
failedPaths;
end;
Here is how your OpenEditor method should work:
pickerDef.OpenEditor := func(tapInfo, context, why)
begin
local valid = :Validate(tapInfo.nameRef,
tapInfo.editPaths) ;
if (Length(valid) > 0) then
// if not valid, open the editor
Vista de pagina 230
1 2 ... 226 227 228 229 230 231 232 233 234 235 236 ... 941 942

Comentarios a estos manuales

Sin comentarios