Archicad C++ API
About Archicad add-on development using the C++ API.

Shortcuts assigned to numerals being executed instead of inserting their num. values

Anonymous
Not applicable
Hello, I've got a question about shortcuts. Our users are complaining they have usually various commands assigned to the numerals. E.g. 1 is True Line Weight, 3 is Unify, 4 is intersect...
and because of that, they are not able to put those values to our virtual frame buffer window text fields ( when they try, assigned shortcut commands are executed and their values are not written into a text field ).

It's possible to disable using shortcuts temporarily? Or what workaround do you suggest? Thanks for your feedback!
6 REPLIES 6
Anonymous
Not applicable
I've uploaded a video : https://youtu.be/LBQUJSrVa-k
I wanted to write "1" but I have got the Plot command set as a shortcut for the "1" :
Anonymous
Not applicable
Another update: I've got the callbacks for the gain/loss of focus in the VFB text fields. Now the final question is, am I able to enable/disable shortcuts globally?
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Your dialog is a modeless dialog, am I right?

In this case you should inherit your dialog class from DG::LowLevelKeyboardHandler, call InstallHandler(*this) from the constructor, call RemoveHandler(*this) from the destructor and override the KeyPressed function like this:
bool <MyDialogClass>::KeyPressed (const DG::Key::Code&, DG::Item**)
{
	// If my dialog has the focus, then don't allow ARCHICAD to handle the shortcut
	short focusID;
	DGGetFocus (DG_ALL_DIALOGS, &focusID, nullptr);
	if (focusID == GetId ()) {
		return true;
	}

	return false;
}
Anonymous
Not applicable
Tibor wrote:
Your dialog is a modeless dialog, am I right?

In this case you should inherit your dialog class from DG::LowLevelKeyboardHandler, call InstallHandler(*this) from the constructor, call RemoveHandler(*this) from the destructor and override the KeyPressed function like this:
bool <MyDialogClass>::KeyPressed (const DG::Key::Code&, DG::Item**)
{
	// If my dialog has the focus, then don't allow ARCHICAD to handle the shortcut
	short focusID;
	DGGetFocus (DG_ALL_DIALOGS, &focusID, nullptr);
	if (focusID == GetId ()) {
		return true;
	}

	return false;
}
Hm, unfortunately, VFB window is not an ArchiCAD dialog and we are re-using this window across plugins. I'm able to handle events for user gain/loss focus in the text field in that window. Therefore my idea was to tell ArchiCAD there to bypass the shortcuts. Is something like this possible?
Anonymous
Not applicable
@Tibor I've problems with DG::LowLevelKeyboardHandler as DG has no member class with this name?? Can you please assist?
Anonymous
Not applicable
In the meanwhile, I tried to use `DGEnableHotKeys` and `DisableHotKeys` but this was not disabling anything at all. I was calling this on the palette..

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!