Page 1 of 1

Can't open a windowedscreen in a maximized window?

Posted: Wed Sep 29, 2004 9:14 am
by Alberto
Run this code and try to maximize the window

Code: Select all

Global Larghezza.l 
Global Altezza.l 
Larghezza = 500
Altezza = 500

Procedure linea()
    StartDrawing(ScreenOutput())
        Line(0,0,Larghezza,altezza,RGB(255,0,0))
    StopDrawing()
    FlipBuffers()    
EndProcedure

punt = OpenWindow(1, 100, 100, Larghezza, Altezza, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget , "Itecad")

InitSprite()

OpenWindowedScreen(punt, 0, 0, Larghezza, Altezza,0,0,0)

linea()

Quit = #FALSE
Repeat
    If IsIconic_(punt) = #FALSE
        If (WindowWidth() <> Larghezza) Or (WindowHeight() <> Altezza)
            Larghezza = WindowWidth()
            Altezza = WindowHeight()
            CloseScreen()
            OpenWindowedScreen(punt, 0, 0, Larghezza, Altezza,0,0,0)
            linea()
        EndIf
    EndIf
    
    Evento = WaitWindowEvent()  
    Select Evento
    Case #PB_EventCloseWindow
        Quit = #TRUE
    EndSelect    

Until Quit = #TRUE
You can't do it but you can resizing manually the window to fit all the desktop. It's strange...

If I don't want to use Autostretch I can't create a windowedscreen on a maximized window.
Look at this other little program:

Code: Select all

punt = OpenWindow(1, 100, 100, 500, 500, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget , "Alberto")

ShowWindow_(punt,#SW_MAXIMIZE)

InitSprite()
OpenWindowedScreen(punt, 0, 0, 500, 500,0,0,0)

ClearScreen(255,0,0)
FlipBuffers()

Quit = #FALSE
Repeat
    Evento = WaitWindowEvent()  
    Select Evento
    Case #PB_EventCloseWindow
        Quit = #TRUE
    EndSelect    
Until Quit = #TRUE
the window is not maximized. Why?

Am I misundersting something? :roll:
Is it possible to create a windowedscreen on a maximized window without using Autostrecth?

Thanks
Alberto

Posted: Wed Sep 29, 2004 6:27 pm
by VPureBasic
Hi Alberto,

I hope this will give this anwer of your request...

Code: Select all

Global Larghezza.l 
Global Altezza.l 
Larghezza = 500 
Altezza = 500 

Procedure linea() 
    StartDrawing(ScreenOutput()) 
        Line(0,0,Larghezza,altezza,RGB(255,0,0)) 
    StopDrawing() 
    FlipBuffers()    
EndProcedure 

InitSprite()

Main  = OpenWindow(0, 100, 100, Larghezza, Altezza, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget , "Itecad") 
 
Child = OpenWindow(1,   0,   0, Larghezza, Altezza, #WS_CHILD|#PB_Window_BorderLess,"",WindowID(0)) 
SetParent_(WindowID(1), WindowID(0))

OpenWindowedScreen(Child, 0, 0, Larghezza, Altezza,1,0,0) 

 

Quit = #FALSE 
Repeat 
    Evento = WaitWindowEvent()  
    ClearScreen(0,0,0)
    linea()
    Select Evento 
      Case #WM_SIZE
        If EventWindowID() = 0
            WW = WindowWidth()
            WH = WindowHeight()
            SetWindowPos_(Child,0,0,0,WW,WH,#SWP_NOMOVE)
            UseWindow(0) : ActivateWindow()
        EndIf    
      Case #PB_EventCloseWindow 
        Quit = #TRUE 
    EndSelect    

Until Quit = #TRUE
Roger

Posted: Thu Sep 30, 2004 7:24 am
by Alberto
Happyness and joy to you, Roger!!!
Your code show me the way.
In your code you use Autostretch=1 inside the OpenWindowedScreen, but this is not a problem.
This is the solution to my problem:

Code: Select all

Global Larghezza.l 
Global Altezza.l 
Larghezza = 500 
Altezza = 500 

Procedure linea() 
StartDrawing(ScreenOutput()) 
    Line(0,0,Larghezza,altezza,RGB(255,0,0)) 
StopDrawing() 
FlipBuffers() 
EndProcedure 

InitSprite() 

Main = OpenWindow(0, 100, 100, Larghezza, Altezza, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget , "Itecad") 

Child = OpenWindow(1, 0, 0, Larghezza, Altezza, #WS_CHILD|#PB_Window_BorderLess,"",WindowID(0)) 
SetParent_(WindowID(1), WindowID(0)) 

OpenWindowedScreen(Child, 0, 0, Larghezza, Altezza,0,0,0) 

Quit = #FALSE 
Repeat 
Evento = WaitWindowEvent() 
ClearScreen(0,0,0) 
linea() 
Select Evento 
Case #WM_SIZE 
    If EventWindowID() = 0 
        Larghezza = WindowWidth() 
        Altezza = WindowHeight() 
        SetWindowPos_(Child,0,0,0,Larghezza,Altezza,#SWP_NOMOVE)
        CloseScreen()
        OpenWindowedScreen(Child, 0, 0, Larghezza, Altezza,0,0,0) 
        linea() 
        UseWindow(0)
        ActivateWindow() 
    EndIf 
Case #PB_EventCloseWindow 
Quit = #TRUE 
EndSelect 

Until Quit = #TRUE