Floating Plain Box Window

I am creating a custom control. I’m using declares borrowed from MBS to show a drop down list as a window with no border.
I’m having trouble with activation because either my control or the list is active. In the native control both are active simultaneously. How can I achieve this using declares. @Christian Schmitz

Under Windows, you can make the border and bar of a floating window transparent using the same technique as used in the
Example Projects/Platform-Specific/Windows/CustomWindowShape

I used that, and just slightly modified the declare to define rectangular regions instead of slowly wok pixel by pixel.

FWIW, I discovered since that Windows 10 is using the same technique to produce borderless windows ; underneath are the good old windows 8 windows. So much so it throws off Xojo’s bounds :wink:

Under macOS, MacOSLIb shows a nice round splash window. I believe you can use the same technique to render the border and bar transparent.

How can I make the plain box be a child window so my main window doesn’t lose focus? Basically I need both my main window and the dropdown to be active simultaneously. At the moment my focus is windows.

Maybe you should consider the entire control as a new window when the dropdown is displayed, instead of a separate part from the TextField.

It should be possible when the dropdown window is displayed for it to show a TextField part of the floating at exactly the same place as the closed combobox. So in effect both TextField and dropdown are on the same window, but look like two separate parts. It will be a whole lot easier in terms of focus.

When you close/hide the dropdown window, just put the content of the dropdown textfield back into the window one.

Use a container control instead of a floating window. The CC can be made a child object of the man window and resized as needed.

Hmmm. that’s a new thought. I wonder how the native controls work? On the native control the text field and the list are active simultaneously (blue highlight). I can’t do that even the combo box and the list are in the same window. Besides then the main window would become inactive. I have a serious problem with apps that deactivate the main window while it is actually active.

I don’t think a container control can protrude off the edge of it’s parent window.

I see no way to obtain a protruding control without using a window (unless there was some type of window I did not know about*). It is a trade off here : protruding and window deactivated, or window active, but no protruding.

I like ContainerControls, but on Windows there is an issue when they cover other controls, in particular TextFields and buttons, because they show through. So it is necessary to disable them or make them invisible when displaying the CC over. Same punishment with anything else. In Char Menu where I use a ListBox as drop down, I have exactly the same issue.

Don’t forget all controls are basically the result of astute drawing. You could probably get a similar result with a canvas. And since controls can be made children of canvases, it would seem pretty easy to come up with a canvas control with an embedded TextField.

Thanks that got me to the right place.

This code turns the window into a plain box and prevents it from ever being activated, even when using controls on the dropdown. I guess it’s windows only for now. I was able to make the list appear active by adding a little code in the paint events.

#If TargetWin32 Then Const GWL_STYLE = -16 Const WS_Custom = &H40800000 Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer dim i as Integer i = SetWindowLong( DList.Handle, GWL_STYLE, WS_Custom ) #EndIf