Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / Custom Display Host steals focus
  RSS 2.0 ATOM  

Custom Display Host steals focus
Rate this thread
 
30117
 
Permlink of this thread  
avatar
  • saajjj
  • Posted: 12 October 2008 04:33 AM
  • Total Posts: 161
  • Joined: 10 June 2008 12:38 PM

I have been developing a custom plug-in for XSI using the C++ API. There was some interesting behaviour I came across regarding the CDH window getting focus automatically if the mouse was hovered to within it’s area. By within I mean as soon as the mouse crossed the titlebar or the resize borders. This behaviour is reproducible using the VertexColorsExample CDH provided with XSI.

Unlike a seasoned programmer, I unwittingly spent the last 4 days meticulously going through my code to try and pin-point the problem or finding a hack around it.
The hack I found is really annoying from a user-perspective (explained later).

All the steps can be duplicated with the XSI v7 VertexColorsExample CDH.

[LIST=1]
[*] Open a CDH. View > General > Custom Display Host.
[*] Right-click somewhere near the right edge of the CDH. This is imporant because when we select ‘VertexColorsExample’ from the pop-up list, we want the mouse pointer to be outside the CDH window. (Ref. Image A)
[*] Select ‘VertexColorsExample’
[*] At this point, the CDH window has focus and the focus rectangle is on the ‘Vertex Color Properties’ listbox
[*] Click somewhere outside the CDH window so that it loses focus.
[/LIST]
Case A:

[LIST=1]
[*] Now bring the mouse back to within the CDH window. Without a click, the CDH window automatically gets focus. (Unexpected behaviour but let’s proceed)
[*] From this point onwards, if you click outside the CDH window and bring the mouse back in, the focus stealing does not happen.
[/LIST]
Case B:

[LIST=1]
[*] Instead of bringing the mouse pointer back to any location in the CDH window, take the pointer over the barely visible ‘Run’ button towards the top right of the CDH (this button is to the right of the ‘Quick Operators’ combobox). Ref Image B.
[*] The CDH takes focus automatically. Again, although this focus stealing is unexpected, it also happend in CaseA.1.
[*] Without taking the mouse outside the bounds of the ‘Run’ button, steer it towards the right and leave the CDH window again.
[*] Click outside the CDH window so that the CDH window loaes focus.
[*] Repeat step CaseB.1
[/LIST]
Case B, can be run infinitely to show this focus stealing behaviour.

It appears that until the mouse has hovered above some part of the base dialog (i.e. non-control stuff), the auto-focus stealing will continue to happen.
Keep in mind that this problem can not be duplicated with the VertexColorExample if the CDH is loaded while the mouse pointer is inside the CDH window. This is because as you leave the CDH window, the mouse pointer will always get in touch with some part of the base dialog.
One obvious hack around this issue is to put everything inside the CDH with a thickish border, this ensures that when the user leaves the CDH window, the mouse would’ve gone over part of the base dialog and the focus stealing doesn’t happen. I’m not in favour of this because this wastes screen real estate.
My other hack was to force the mouse pointer to a position directly above a base dialog area. I don’t like this because of obvious UI usability issues, nobody I know likes a mouse pointer with a soul.

I have thought of other idiotic hacks as well, but that’s the problem: they’re idiotic.

Is there anyway to avoid this? Should I submit this to SI as a bug?

Any help appreciated.



Attachment Attachment
Attachment Attachment
Replies: 0