Menu

#26 Look Up: behaves like address book lookup

open
None
5
2007-02-06
2007-02-05
No

This patch adds the following feature to the keyring lookup functionality:

If a non-matching character is typed on the lookup line, then the palm device beeps and removes the last typed character. This functionality is consistent with how the address book lookup behaves.

Patch to listform.c in cvs-HEAD:

***************
*** 295,300 ****
--- 295,303 ----
MemHandle rec;
FieldHeaderType *fldHeader;
Int16 compare;
+ UInt16 oldSelectedIdx;
+
+ oldSelectedIdx = f_SelectedIdx;

if (!item || !(itemLen = StrLen(item))) {
f_SelectedIdx = kNoRecord;
***************
*** 329,334 ****
--- 332,345 ----
}
idx++;
}
+ // remove the last letter (cuz it didn't match)
+ if (f_SelectedIdx == kNoRecord) {
+ SndPlaySystemSound(sndWarning);
+ FldDelete(f_LookUp,FldGetTextLength(f_LookUp)-1,FldGetTextLength(f_LookUp));
+ f_SelectedIdx = oldSelectedIdx;
+ ListForm_Scroll(f_SelectedIdx);
+ ListForm_UpdateSelection();
+ }
}

static GUI_SECTION void ListForm_CategoryTrigger(void)

Discussion

  • Jochen Hoenicke

    Jochen Hoenicke - 2007-02-06

    Logged In: YES
    user_id=18252
    Originator: NO

    I think there is a problem: The method LookUpItem is also called if the category is changed. It would be really strange if the last character of the search string is removed in this case. The code should probably be moved to HandleEvent. Also if you insert some text from the clipboard or if you delete the last character (e.g. after switching categories) the effect is strange.

     
  • Jochen Hoenicke

    Jochen Hoenicke - 2007-02-06
    • assigned_to: nobody --> hoenicke
     

Log in to post a comment.