See here.. for tutorial..
SearchFieldEditor
This explains the same procedure, but it also applies to creating buttons.