[MAXGUI] Window always on top?

BlitzMax Forums/BlitzMax Programming/[MAXGUI] Window always on top?

Grisu(Posted 2006) [#1]
Hi!

I'm currently using these two functions to set the window flag to "always on top".

Function WinalwaysOnTop(hWnd:Long)
SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE )
End Function

Function WinnotAlwaysOnTop(hWnd:Long)
SetWindowPos( hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE )
End Function

The problem is that when I use tooltips in maxgui listboxes they no longer show up / shop up behind the listbox. So one can't read the text.

Is there a better way of locking the gui app window on top?

Thanks, Grisu


ozak(Posted 2006) [#2]
You shouldn't make windows on top of all others. It's an ugly Windows hack that should die. What if two windows want to be on top at the same time? I rest my case ;)


Grisu(Posted 2006) [#3]
Well lets say you work in open office and want to use winamp. That's when "always on top" is quite nice, cause you can work as you like and still play your songs...


Eikon(Posted 2006) [#4]
Try forcing the listboxe's hWnd to the top - might work ;)


Grisu(Posted 2006) [#5]
but how? I'm no windows api gutu.
And it seems if I touch something, it breaks something elsewhere... :/

I have around 10 Listboxes in my app...and i want to allow the user to set the window on top or not on the fly.

So this isnt easy... :/


Eikon(Posted 2006) [#6]
Get the listboxe's hWnd with QueryGadget (QUERY_HWND) and force it to the top the same way you do the parent window.

Like I said, it may or may not work, but it's worth a shot. Good luck with it!


Grisu(Posted 2006) [#7]
Can't I just move the window to "ONTOP"-1?

That would be better than moving all listbox tooltips.
Don't know how to code this though.. :(


Eikon(Posted 2006) [#8]
Yes, but you said that it caused your listbox tooltips to vanish, so I thought that also forcing the listbox itself to the top might help.


Grisu(Posted 2006) [#9]
sorry, i will try to explain. The function sets the window to the top. therefore the tooltips show up behind. So I "just" need to change the function so it sets the window itself to "HWND_TOPMOST-1".


Eikon(Posted 2006) [#10]
I just tried to set the listbox to top and it didn't fix the problem, please forget I ever mentioned it.

There is no such layer between HWND_TOP and HWND_TOPMOST. Tooltips reside on the TOPMOST layer by default, so in theory they should be visible. Maybe talk to skid about it.

Code to recreate the problem:
Window:TGadget = CreateWindow("Test", 0, 0, 500, 500)
SetWindowPos QueryGadget(Window, QUERY_HWND), -1, 0, 0, 0, 0, 3

ListBox:TGadget = CreateListBox(0, 0, 400, 400, Window)
AddGadgetItem ListBox, "test", 0, -1, "Tip"
SetWindowPos QueryGadget(ListBox, QUERY_HWND), -1, 0, 0, 0, 0, 3 ' Attempted fix

Repeat
Until WaitEvent() = EVENT_WINDOWCLOSE



Grisu(Posted 2006) [#11]
Thanks Eikon for looking into this.

Skid will probably kill me when I report this... *shivers*

He has lot's of other stuff to fix first (higher priority)...