Skip to main content
kuo chunh36971252
Participating Frequently
July 28, 2022
Question

How to change the tool that will be temporarily selected by pressing Ctrl key?

  • July 28, 2022
  • 1 reply
  • 343 views

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 

 

This topic has been closed for replies.

1 reply

Community Manager
August 1, 2022

Hello @kuo chunh36971252,

 

Thanks for reaching out. I would request you kindly try the developer console website (https://console.adobe.io/servicesandapis), select Illustrator from the product list, and you should be able to download the required documentation to learn more about the SDK.

 

Kindly update this thread if you need further assistance. We'd be happy to help.

 

Thanks,

Anubhav

kuo chunh36971252
Participating Frequently
August 2, 2022

Hi Anubhav,
Thanks for your reply. I haven't solved this problem yet.
Could you please point out what is wrong with my code?