Article # 9, added by Geoworks, historical record
| first | previous | index | next | last |

Find/Replace disabled problem




Question:
Why aren't the triggers in the Find/Replace controller enabled, even after I
type some text in the Find field?

Answer:
In the SearchReplaceControl you need to have the following attribute:

    ATTR_SEARCH_CONTROL_INTERACT_ONLY_WITH_TARGETED_TEXT_OBJECTS;

This will make the triggers become enabled at the appropriate time. Here is
a sample SearchReplaceControl object:

    @object GenInteractionClass MyEditMenu = {
        GI_comp = @MySearchReplaceControl;
        ...
    } /* MyEditMenu */

    @object SearchReplaceControlClass MySearchReplaceControl = {
        GI_visMoniker = "Find and Replace";
        GI_states = @default & ~GS_ENABLED;
        GII_visibility = GIV_DIALOG;
        ATTR_SEARCH_CONTROL_INTERACT_ONLY_WITH_TARGETED_TEXT_OBJECTS;
        ATTR_GEN_DESTINATION_CLASS = { (ClassStruct*)&MyTextClass };
    } /* MySearchReplaceControl */

This example is for text objects, which is generally what Find/Replace
is used for. You should only need to make minor modifications to make this
work with other kinds of objects.