Hey guys,
I have a simple problem: in my current application, I want to pop up a container gadget with a notification (and a close button) above all other gadgets located on a specific window. What would be the best approach to do this? Additionally, applying transparency to the container gadget would be nice.
Best approach for placing a gadget above all other
Re: Best approach for placing a gadget above all other
Use another borderless window and attach it to the parent window.
Re: Best approach for placing a gadget above all other
Simple and effective! Thanks!
Re: Best approach for placing a gadget above all other
Hello,
I have just implemented this method and I am using the move/resize event of the parent window in order move/resize the borderless window accordingly. However, I am experiencing a lag. Also, when clicking on the borderless window, the parent window loses its focus, which is not what I want.
Is there any other solution?
I have just implemented this method and I am using the move/resize event of the parent window in order move/resize the borderless window accordingly. However, I am experiencing a lag. Also, when clicking on the borderless window, the parent window loses its focus, which is not what I want.
Is there any other solution?
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Best approach for placing a gadget above all other
Hi Xor - can you explain why the main window losing the focus is a problem? It's normal behaviour in MS Windows at least.
You could define your notifier window with a timer, such that there is nothing to click - that would prevent the notifier from 'taking' the focus. You could also, having detected that the notifier has the focus, immediately return focus to the main window.
You could define your notifier window with a timer, such that there is nothing to click - that would prevent the notifier from 'taking' the focus. You could also, having detected that the notifier has the focus, immediately return focus to the main window.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Best approach for placing a gadget above all other
If you need it for the Windows OS only, you could probably just add a child gadget (container for example) to the main window and set the z-order to topmost using SetWindowPos_().
Re: Best approach for placing a gadget above all other
Hi
For Windows
For Windows
Code: Select all
flags = #PB_Window_SystemMenu| #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered | #PB_Window_SizeGadget
OpenWindow(0,0,0,400,300,"Test",Flags)
ContainerGadget(0,-300,0,200,100 ,#PB_Container_Flat|#WS_CLIPSIBLINGS)
TextGadget(1,10,10,100,26,"Please take care")
ButtonGadget(2,10,60,60,26,"OK")
CloseGadgetList()
ListIconGadget(10,10,10,380,240,"Test",60, #PB_ListIcon_FullRowSelect |#WS_CLIPSIBLINGS)
ButtonGadget(20,10,260,60,26,"POP")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Menu
Select EventMenu()
Case 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case 2
ResizeGadget(0,-300,0,200,100)
Case 20
ResizeGadget(0,100,100,200,100)
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Best approach for placing a gadget above all other
Maybe I should provide a picture in order to make my goal clearer : https://2.bp.blogspot.com/-TBqSLm1Ky5Q/ ... _types.pngHi Xor - can you explain why the main window losing the focus is a problem? It's normal behaviour in MS Windows at least
What I also want is to place a hyperlink as well as a button gadget on the notification container, and I definitely do not want the parent window to lose its focus. Apart from that, the lag issue is very annoying.
I will use the method suggested by Danilo and RASHAD, thanks.
Re: Best approach for placing a gadget above all other
I use this approach (found somewhere on this forum) to be able to click through window and don't lose focus
EDIT: Found source post: viewtopic.php?p=521630#p521630
Code: Select all
OpenWindow(0, 0, 0, 320, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 300, 30, "depends...")
SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_TRANSPARENT)
SetLayeredWindowAttributes_(WindowID(0), 0, 150, #LWA_ALPHA)
StickyWindow(0, 1)
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend