I’m trying to create a flyout menu. It would normally be 25 pt wide and display only an icon. On mouse enter the menu expands to show the menu text. The Problem I’m having is controls ‘under’ the flyout receive mouse clicks instead of the menu. My flyout is a canvas subclass. I tried placing it inside a container control and turning off the transparent property for both the container and the canvas. I also made sure that the zorder of the flyout was ordered to front in the IDE. Any suggestions? Do I really need to use a plain box window.
This is typical of Windows buttons and textfield. They spring up whenever the mouse passes by, even when another control is on top. In general under Windows, avoid as much as possible stacking controls. It usually flickers badly.
Try disabling the OK button when you pop the rows. If that does not suffice, make the button invisible.
It might be easier to use a modified plain box window.
Indeed, you could very well place your flyout buttons on a plain box window. That would solve the issue.
That brings up another issue. Why does MouseExit not fire consistently?
In the MouseExit for both the canvas and the plainbox window it put
Self.Close. This only closes the window about half the time when exiting. Especially if moving the mouse fast.
It seems that setting the window to be a child window prevents the MouseExit event from working properly.
I also cant figure out how to eliminate the rectangle border around the window.
Const WS_Custom = &H40800000
Neil, I wonder if this is what your experiencing and if Julian’s
ZOrderFix classes help? See the discussion here: https://forum.xojo.com/38658-xojo-framework-z-order-backwards
Did you put
Return True in
(to enable all other MouseXxxx Events).
This is a ‘flyover’ so no mousedown involved.
Thanks Tanner I’ll take a look.
Julian’s example causes controls to be drawn in reverse order (from what set in IDE). So controls that appear to be on the bottom are the ones that receive the mouse click.
OK I’ve got a modified window working. I was able to creat my own mousexit even using System.MouseX/Y in a timer.
One last problem. How can I get rid of the annoying window border?
OK got it figured out.
fw = New FlyoutWindow
fw.Top = Me.top + Me.TrueWindow.Top+25
fw.Left = Me.Left + Me.TrueWindow.Left+2
#If TargetWin32 Then
Declare Function CreateRectRgn Lib "gdi32" (Left As Integer, top As Integer, Right As Integer, bottom As Integer) As Integer
Declare Function SetWindowRgn Lib "user32" (hWnd As Integer, hRgn As Integer, bRedraw As Boolean) As Integer
Dim r1 As Integer
Const GWL_STYLE = -16
Const WS_Custom = &H40800000
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Int64) As Integer
Dim i As Integer
i = SetWindowLong( fw.Handle, GWL_STYLE, WS_Custom )
r1 = CreateRectRgn(1, 1, fw.Width+5, fw.Height+28)
Call SetWindowRgn(fw.handle, r1, True)