PDA

View Full Version : Broadcast/Emulate hotkey pressed event (dialog focus problem)


Pjanssen
03-07-2008, 11:31 AM
I've got a bit of a problem: I'm developing a tool (outliner) that helps with the selection of objects. It will be open while people are working in a scene.
The problem is that when the focus is on the dialog, or more specifically on one of the controls in the dialog, the key events are captured by the controls, rather than max. I want to be able to use all the hotkeys set by max or the user.

I tried setting the focus on the dialog itself after each focus event, but this isn't a nice way of handling things and it doesn't seem to work when called from dotnet objects...

I could use some help in this :)

Pjanssen
03-08-2008, 04:50 PM
My progress so far, using the toolmode.commandmode setting I managed to remove the focus from the dialog, but now it's still not working. Max still doesn't capture any hotkeys...


on tree gotFocus e do (
try (
toolMode.CommandMode = toolMode.CommandMode;
) catch (
toolMode.CommandMode = #SELECT;
)
)


Any help would be greatly appreciated!

Pjanssen
03-09-2008, 12:32 PM
Well, after hours of messing around, I finally found a solution. It's a bit nasty and hackish, but it works.
Apparently there were certain events that put the focus back on the treeview if you remove it right after the GotFocus event. So what I'm doing now is starting a timer with an interval of 1ms which removes the focus:
rollout focusTest "focusTest" (
dotNetControl tree "TreeView";
timer removeFocusTimer interval:1 active:false;

on removeFocusTimer tick do (
if (tree.LabelEdit == false) do (
setFocus focusTest;
)
removeFocusTimer.active = false;
)

on tree gotFocus e do (
removeFocusTimer.active = true;
)
)

It's not a very elegant solution at all, but at least it works :)

CGTalk Moderation
03-09-2008, 12:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.