hi guys,
i have a question for understanding.
this question has to do with windows, mac os x and linux, and i would need a solution of all three os's.
if clicking on a combobox-button we get a list of the combobox-items. this damn list become display on the screen by another window.
this "combolist-window" handles all events like mouse or keyboard if we use it, but that window does not steal the active-state of the parent-window, that contains the combobox.
how exactly this kind of behavier can be done by specific operating system api? is it a specific type of window? if yes, how can i realize this by my own?
thanks,
kurt
popup-window like popupmenu with custom content
Re: popup-window like popupmenu with custom content
I'm not sure how you could keep focus on the main window as you seek but allow keyboard input to go to the popup window.
For example, pressing tab would move the keyboard focus on the main window and on the popup window at the same time, if this happened the window should technically close as the form control is de-selected.
Also, you would probably need to open a child window for the popup to stop it appearing on the taskbar, however if the child window doesnt have focus it will be greyed out slightly.
It could probably be done with heavy use of Windows API's, but I wouldnt know where to start and as for having it work on Mac and Linux, this would probably be a lengthy project.
The easiest method would be using a PopupMenu as this has all the features you require other than it being a menu and not a window, so you'd only be able to have a list of selected on there and nothing fancy.
For example, pressing tab would move the keyboard focus on the main window and on the popup window at the same time, if this happened the window should technically close as the form control is de-selected.
Also, you would probably need to open a child window for the popup to stop it appearing on the taskbar, however if the child window doesnt have focus it will be greyed out slightly.
It could probably be done with heavy use of Windows API's, but I wouldnt know where to start and as for having it work on Mac and Linux, this would probably be a lengthy project.
The easiest method would be using a PopupMenu as this has all the features you require other than it being a menu and not a window, so you'd only be able to have a list of selected on there and nothing fancy.
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: popup-window like popupmenu with custom content
You can do it x-platform by hiding and unhiding a container gadget.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: popup-window like popupmenu with custom content
Just use a canvas gadget; simple and cross-platform:5mware wrote:...handles all events like mouse or keyboard if we use it, but that window does not steal the active-state of the parent-window...
Code: Select all
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
OpenWindow(0, #PB_Any, #PB_Any, 400, 300, "Canvas Window", wFlags)
StringGadget(0, 100, 50, 170, 30, "")
ButtonGadget(1, 270, 50, 30, 30, "V")
CanvasGadget(2, 101, 80, 198, 150, #PB_Canvas_Keyboard)
HideGadget(2, 1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
appQuit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
If GetGadgetData(1)
HideGadget(2, 1)
SetGadgetText(1, "V")
SetGadgetData(1, #False)
Else
HideGadget(2, 0)
SetGadgetText(1, "X")
SetGadgetData(1, #True)
EndIf
Case 2
Select EventType()
Case #PB_EventType_LeftButtonDown
SetGadgetText(0, "Canvas mouse left button down...")
Case #PB_EventType_LeftButtonUp
SetGadgetText(0, "Canvas mouse left button up...")
Case #PB_EventType_RightButtonDown
SetGadgetText(0, "Canvas mouse right button down...")
Case #PB_EventType_RightButtonUp
SetGadgetText(0, "Canvas mouse rigth button up...")
Case #PB_EventType_KeyDown
SetGadgetText(0, "Canvas mouse key down...")
Case #PB_EventType_KeyUp
SetGadgetText(0, "Canvas mouse key up...")
Case #PB_EventType_MouseMove
;setgadgettext(0, "Canvas mouse moving...")
Case #PB_EventType_MouseEnter
SetGadgetText(0, "Canvas mouse entering...")
Case #PB_EventType_MouseLeave
SetGadgetText(0, "Canvas mouse leaving...")
Case #PB_EventType_MouseWheel
SetGadgetText(0, "Canvas mouse wheel rolling...")
EndSelect
EndSelect
EndSelect
Until appQuit = 1Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: popup-window like popupmenu with custom content
TI-994A, I think a ContainerGadget() delivers all that is required, given that it's purpose in life is to contain other gadgets as is needed in this case. A custom pop-up is easily defined this way and behaves as part of the Window it belongs to.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: popup-window like popupmenu with custom content
Except it doesn't handle any events, as required by the OP. Ultimately, a canvas gadget would be required for this.IdeasVacuum wrote:...a ContainerGadget() delivers all that is required...
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: popup-window like popupmenu with custom content
Erm no, the OP believed he needed to handle events because he believed the way forward was to create another window. The events of the gadgets on a container are handled by the Main Window loop, same as the other gadgets on that window.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: popup-window like popupmenu with custom content
hi guys,
i am working on a cross-plattform framework with purebasic to do also this task. all is oop realized by interfaces.
if you create a window, the window opject creates also a canvasgadget in it and if you resize the window or what ever you do with it, the canvasgadget does the same too.
the "popup-menu" or "popup-container" will be displayed in the canvasgadget if the popup is small enough to fit in it. otherwise a second borderless window get it with a new canvasgadget. and there is the problem we are talking about...
the framework is because, purebasic haven't enough components and there are not good enough and they don't handle in the same way on all thee os. the framework shell it make possible to be very professional.
the idea behind the framework is to create all components like button, list, combo, "popup-menus", "popup-containers" within the same canvasgadget.
all components get styled by a common png-file. but it will be also possible to style components individually. and further more the plan is to find by code the os-default-theme and reproduce it for all components before starting the application build by that framework.
there are not much components available. i am working on the framework-core which is the most important part. if it would work fine and faultless then the next step is to code the components. the plan is make it possible to work with normal window and canvasgadget in a "window_viewport" mode or work in a "screen_viewport" mode. in the screen-mode there is a screen-object containing "windows" and in them the components. but here the work is with sprites etc.
the project is in early stage and i have not enough time to work on it full-time. since a while i think about a team that could work with me to bring more speed into that project.
i plan to use this framework for commercial development. if anyone has interest, you can contact me at aziz@5m-ware.de
thanks
kurt
i am working on a cross-plattform framework with purebasic to do also this task. all is oop realized by interfaces.
if you create a window, the window opject creates also a canvasgadget in it and if you resize the window or what ever you do with it, the canvasgadget does the same too.
the "popup-menu" or "popup-container" will be displayed in the canvasgadget if the popup is small enough to fit in it. otherwise a second borderless window get it with a new canvasgadget. and there is the problem we are talking about...
the framework is because, purebasic haven't enough components and there are not good enough and they don't handle in the same way on all thee os. the framework shell it make possible to be very professional.
the idea behind the framework is to create all components like button, list, combo, "popup-menus", "popup-containers" within the same canvasgadget.
all components get styled by a common png-file. but it will be also possible to style components individually. and further more the plan is to find by code the os-default-theme and reproduce it for all components before starting the application build by that framework.
there are not much components available. i am working on the framework-core which is the most important part. if it would work fine and faultless then the next step is to code the components. the plan is make it possible to work with normal window and canvasgadget in a "window_viewport" mode or work in a "screen_viewport" mode. in the screen-mode there is a screen-object containing "windows" and in them the components. but here the work is with sprites etc.
the project is in early stage and i have not enough time to work on it full-time. since a while i think about a team that could work with me to bring more speed into that project.
i plan to use this framework for commercial development. if anyone has interest, you can contact me at aziz@5m-ware.de
thanks


