MouseEnter and MouseDown

Perhaps the title is a bit misleading… so let me explain.

App with two windows… one a “document” style window (the main window) and another a “floating window”
The main window has a custom cursor…
When the floating window is activated … it has a different custom cursor
HOWEVER, when the cursor is moved back over the main window (and MOUSEENTER is fired) the cursor does NOT change back.
it requires the user CLICK on the main window again. This (in my opinion) defeats the purpose of a floating window.

I have tracked ALL of the events that are exposed for a Window and only MOUSEENTER fires (as expected)… Attempts to SETFOCUS etc seem to be totally ignored…

So my question is… What is happening if the user CLICKS the window, as opposed to any event I can force during a MOUSEENTER.

Basically I need these two window to both be visible, and have everything (focus, cursor etc) change seamlessly when the user causes the mouse to enter or exit either window… Clicking to regain cursor is not acceptable as the main window is mostly a single Canvas, and clicking invokes other events that are not appropriate when changing window views.

This is OSX only…

MousExit on the floating window does not fire?

The canvas needs AcceptFocus to be True. Then set the cursor in the GetFocus event.

Yes MouseExit fires.
Yes AcceptFocus is true

The MOUSEENTER on the canvas fires, where there is code to reset the cursor… but the cursor DOES NOT change…
It seems that something is mucking with the cursor, and as long as another window is open, I lose all control of the cursor image in the main window. Even if I tell mouseenter to SETFOCUS…

The instant I close the floating window the cursor immediately returns to the desired image.

Can you raise the floating windows LostFocus event in the Window’s MouseEnter event?

It seems to me the events do only fire when the window is activated. Question is: How do you activate a window when the mouse hovers over it when mouse enter fires only when it is activated?

BTW, it seems to me mouseexit suffers under the same conditions. I have a custom Clickbox that changes its picture according to its state. When it activates another window, the main window becomes deactivated and therefore the picture is wrong. I could change this however in its Activate event, but like in Dave’s example the user always has to click on the floating window to activate it before he can interact with it as sonn as it lost its focus.

And like written elsewhere he, the window loses its floating state as long as a child HUD window is opened. It is returned to floating the moment the child window closes.

In the Float MouseExit I put a Main.SetFocus … no effect

As a matter of fact… at no time does any GETFOCUS event ever seem to fire (I have logging on ALL the events of both window/canvas)

and yes it seems that this is the real question

Except it is the user has to click on the MAIN window to get back

I tried it in REAL.studio 2012 R2.1 and it works fine for me. That’s the code in the floating window:

Sub MouseEnter()
me.MouseCursor = System.Cursors.FingerPointer
End Sub

Sub MouseExit()
me.MouseCursor = System.Cursors.HandClosed
End Sub

Try it with a COCOA image cursor…

it worked fine before in Carbon using XML defined cursors… but that cursor style doesn’t seem to work at all any more, plus I wanted slightly larger (and color) cursors when I moved to Cocoa.

Hmm, correction. The Cursor becomes the standard arrow when it leaves the floating window.

Build it for Cocoa, cursor changes on MouseExit to the standard pointer.

I assume this means you are seeing the behaviour I described?

Tried it with Xojo 2013 R3.3 (last one to run on my Snow Leo system) and it still works.

dim w as new winFloat
w.show

Run the app. Floating window has active titlebar (with the close etc buttons).

Mouse entering the floating window changes the cursor to the FingerPointer as expected.

Mouse leaving the floating window changes it to standard cursor, not HandClosed cursor (hmmmmm …)

Clicking on main window -> floating window looses focus

Moving mouse in does NOT change cursor. I need to click on the titlebar and make it the active window before the cursor changes. Clicking inside the window has no effect on the cursor.

Yup that sounds like the problem

Added a colour change to the MouseEnter and MouseExit events and made a little movie

https://dl.dropboxusercontent.com/u/992591/REALbasic/Forum/FloatingWindow.mov

So the MouseEnter certainly fires …

Workaround:

add a me.show in the MouseEnter event of the floating window.

[quote=74838:@Markus Winter]Workaround:

add a me.show in the MouseEnter event of the floating window.[/quote]

WORKS!!! :slight_smile: Thanks

Hello,
I have a similar problem because if I leave the ‘Global Floating Window’ in COCOA when I come back I can not focus on a textfield that needs focus, only if I click on, not for me ran “Me.Show” on Mouse Enter, any suggestions ?

One thing… the ME.SHOW needs to be on the MAIN window… not the floating window

For me in Carbon works very well but COCOA NO !