I wonder if applications can be designed using a non-moveable main frame window to stick in the middle of a screen.
It would hinder the user from resizing the frame manually and instead offer a variety of different sizes/styles.
A such flag for the openWindow function does not exist but i suppose some API calls could do the switch.
This should be handy for quick-close applications like jotters or converters, who present kind-of a wizard application style.
Surely no graphical operating system is designed to stack-up non-moveable windows as the only way to navigate then is the tab switching through shortcut keys or the system tray. It should be possible, though.
What do you think? Ever created an application with handicapped main windows ?
Having a main window being unmoveable
Re: Having a main window being unmoveable
It is possible, yes, but it largely goes against the "put the user in control of their own experience" ethos of windowed operating systems. I did encounter a program that tried to do this a long time ago. I killed it off via task manager immediately and uninstalled it pronto...
Re: Having a main window being unmoveable
First take spikey post into consideration
Code: Select all
OpenWindow(0,0,0,640,320,"No Size No Move",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
hWnd = WindowID(0)
RemoveMenu_(GetSystemMenu_(hWnd,0),1,#MF_DISABLED|#MF_BYPOSITION) ;No Move
RemoveMenu_(GetSystemMenu_(hWnd,0),0,#MF_DISABLED|#MF_BYPOSITION) ;No Size
RemoveMenu_(GetSystemMenu_(hWnd,0),0,#MF_DISABLED|#MF_BYPOSITION) ;No Size
DrawMenuBar_(hWnd)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
Egypt my love
Re: Having a main window being unmoveable
Basically the same as RASHAD
Code: Select all
EnableExplicit
Procedure.i Main()
If OpenWindow(0,0,0,320,200,"Parent - static!",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindow(1,WindowX(0) + 160,WindowY(0) + 100,320,200,"Child - moveable!",#PB_Window_SystemMenu,WindowID(0))
DeleteMenu_(GetSystemMenu_(WindowID(0),#False),#SC_MOVE,#MF_BYCOMMAND)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
CloseWindow(0)
EndIf
EndProcedure
End Main()
Re: Having a main window being unmoveable
I am pretty sure that there must be very, very good reasons for this.
I would delete such a program immediately! No matter what the reason is
My thought: The developer has not adhered to the generally applicable rules.
But of course it is technically feasible, even without an API.
I would delete such a program immediately! No matter what the reason is
My thought: The developer has not adhered to the generally applicable rules.
But of course it is technically feasible, even without an API.
Code: Select all
EnableExplicit
Enumeration Window
#WINDOW_Main
EndEnumeration
Enumeration Gadget
#GADGET_lstOutput ; dummy gadget here
EndEnumeration
; ---
Global g_MainWndX = 400, g_MainWndY = 400 ; keep this pos
Global g_MainWndWidth = 400, g_MainWndHeight = 400 ; keep this size
; ---
Procedure SizeMainWindow()
; ResizeWindow(#WINDOW_Main, g_MainWndX, g_MainWndY, g_MainWndWidth, g_MainWndHeight)
ResizeGadget(#GADGET_lstOutput, #PB_Ignore, #PB_Ignore, WindowWidth(#WINDOW_Main)-16, WindowHeight(#WINDOW_Main)-16)
EndProcedure
Procedure MoveMainWindow()
; ResizeWindow(#WINDOW_Main, g_MainWndX, g_MainWndY, g_MainWndWidth, g_MainWndHeight) ; <-- keep the pos and size
ResizeWindow(#WINDOW_Main, g_MainWndX, g_MainWndY, #PB_Ignore, #PB_Ignore) ; <-- kepp the pos only
EndProcedure
; ---
Procedure CreateMainWindow()
If OpenWindow(#WINDOW_Main, g_MainWndX, g_MainWndY, g_MainWndWidth, g_MainWndHeight, "Unmovable Window", #PB_Window_SystemMenu|#PB_Window_SizeGadget)
ListViewGadget(#GADGET_lstOutput, 8, 8, g_MainWndWidth-16, g_MainWndHeight-16)
BindEvent(#PB_Event_SizeWindow, @SizeMainWindow(), #WINDOW_Main)
BindEvent(#PB_Event_MoveWindow, @MoveMainWindow(), #WINDOW_Main)
ProcedureReturn #True
EndIf
ProcedureReturn #False
EndProcedure
; ---
Procedure main()
If CreateMainWindow()
Repeat ; main loop
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver ; main loop
EndIf
ProcedureReturn 0
EndProcedure
End main()
; BoF Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).


