How to change the tool that will be temporarily selected by pressing Ctrl key?
I need to change the tool that will be temporarily selected by pressing Ctrl key.
The default setting is kSelectTool, and I want to kDirectSelectTool.
I have used the following code for this:
______________________________________________________________________________
AIAddToolData data;
data.title = ai::UnicodeString("Annotator Tool");
data.tooltip = ai::UnicodeString("Annotator Tool");
data.sameGroupAs = kNoTool;
data.sameToolsetAs = kNoTool;
data.normalIconResID = kAnnotatorToolIconResourceID;
data.darkIconResID = kAnnotatorToolIconResourceID;
data.iconType = ai::IconType::kSVG;
ai::int32 options = kToolWantsToTrackCursorOption | kToolWantsAlternateSelectionTool;
error = sAITool->GetToolNumberFromName(kAnnotatorTool, &data.sameGroupAs);
if (error) return error;
error = sAITool->GetToolNumberFromName(kAnnotatorTool, &data.sameToolsetAs);
if (error) return error;
if (!result) {
result = sAITool->AddTool(message->d.self, kAnnotatorTool, data, options, &fToolHandle);
}
error = sAITool->SetAlternateSelectionToolName(fToolHandle, kDirectSelectTool);
______________________________________________________________________________
If SetAlternateSelectionToolName writed before AddTool, error > 0.
So I write it after AddTool, and error = 0.
And I can get the name kDirectSelectTool by using
char* name;
sAITool->GetAlternateSelectionToolName(fToolHandle, &name);
Anyway when I pressed Ctrl key, I still got Select Tool. Nothing changed.
Can anyone please suggest me that what should I do in this code?
Thanks in advance
Kuo
