|
|
1.1 root 1: {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;}
2: \paperw13040
3: \paperh9600
4: \margl120
5: \margr120
6: \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b\i0\ulnone\fs36\fc0\cf0 QueryFieldEditor
7: \b0\fs28 \
8: by Adam Hertz\
9: \
10: This example is a field editor that does escape completion against any IXBTree cursor. It is used by Webster, Librarian and the ToDoList example. Attach it to a TextField, and when the user types Esc, it completes the prefix using an IXBTree's key space as the set of possible completions.\
11: \
12: It behaves like (and was inspired by) the escape completion in Edit: it cycles through all possible completions for a given prefix. Attach it to a TextField by implementing the Window delegate's - windowWillReturnFieldEditor:toObject: delegate method. Arm it with any IXBTree cursor, such as an IXBTreeCursor or an IXPostingCursor, and away you go.\
13: \
14: The interface and implementation files for this example, QueryFieldEditor.h and QueryFieldEditor.m, are included in the ToDoList example.\
15: \
16: The following code sample shows how the Window delegate manages the QueryFieldEditor:\
17: \
18:
19: \fs24 #import <btree/IXBTreeCursor.h>\
20: \
21: // This window delegate method sets the field editor for the TextField in the instance \
22: // variable queryField from the instance variable fieldEditor. The first time through, it \
23: // creates the field editor and loads it with a cursor from the instance variable cursor\
24: \
25: - windowWillReturnFieldEditor:sender toObject:client\
26: \{ \
27: if (client != queryField) return nil;\
28: if (fieldEditor == nil)\
29: \{\
30: fieldEditor = [[QueryFieldEditor alloc] init];\
31: [fieldEditor setCursor:cursor];\
32: \}\
33: \
34: return fieldEditor;\
35: \}\
36:
37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.