Page 1 of 2
Mode=Ask problems
Posted: Thu Nov 14, 2024 12:26 pm
by SpawnPPC
Hello everyone.
I have this line of code that, in my opinion, works perfectly and to which I pass the values by means of previously set variables:
----------------------------------------------------
CreateDisplay(1, {Width = WinWidth, Height = WinHeight, X = XPos, Y = YPos, Title = "", Borderless = True, Fixed = True, Mode = "Ask", Active = True, Hidden = True})
---------------------------------------------------
Now, given the fact that I inserted the Mode=Ask attribute, the CreateDisplay command should behave in this way:
- if the user chooses full screen mode, the command will open the Display with the resolution chosen by the user
- if the user chooses window mode, the command will open a window with the dimensions entered in the command itself such as position and size
Am I perhaps wrong? Or is my interpretation correct?
Now, if I wanted to know, at a later time, what characteristics this open Display has, I can trace the mode, for example, window or full screen with these lines of code:
----------------------------------------------------
; Checking the mode of the newly created display
DebugPrint("Checking the mode of the newly created display (ID 1).")
Local DisplayMode = GetAttribute(#DISPLAY, 1, #ATTRMODE)
DebugPrint("Display mode: " .. DisplayMode)
DebugPrint(GetAttribute(#DISPLAY, 1, #ATTRMODE))
Local DisplayMode = GetAttribute(#DISPLAY, 1, #ATTRMODE)
If DisplayMode = #DISPMODE_WINDOWED
DebugPrint("The created display (ID 1) is in window mode.")
ElseIf DisplayMode = #DISPMODE_FULLSCREEN
DebugPrint("The created display (ID 1) is in full screen mode.")
EndIf
----------------------------------------------------
I created these lines of code to check the CreateDisplay command. I purposely repeated the DebugPrint etc. commands several times. just to understand and to be sure of the result.
I discovered that first of all the arguments #DISPMODE_WINDOWED and #DISPMODE_FULLSCREEN are not stored like this but rather with integers, and I also discovered that the integer is and always remains 1. That is, there is no difference between the 2. Then I read that these commands actually always refer to Display ID 0, which in my case is the HOST Display, that is, the guest OS, and that there is no way to control the Display with ID 1.
I can't understand if I'm confusing it or what.
Any ideas?
I need to be able to know how the Display with ID 1 was opened, if in Window mode or Full Screen mode, for example, and maybe also know the size of this Display with ID 1.
Thanks to everyone who will give me some advice!
Bye!
SpawnPPC
Re: Mode=Ask problems
Posted: Thu Nov 14, 2024 8:05 pm
by plouf
i lost a bit
but i think you trying to open a display 1 while display 1 is already opened.. hollywood creates a display when starts thats display 1
i slighly modify your example opening a second display with my prefered attributes, and i think it get correct resutls
try
Code: Select all
CreateDisplay(2, {Width = 300, Height = 100, X = 10, Y = 10, Title = "", Borderless = True, Fixed = True, Mode = "Ask", Active = True, Hidden = True})
OpenDisplay(2)
CloseDisplay(1)
NPrint("Hello World")
; Checking the mode of the newly created display
DebugPrint("Checking the mode of the newly created display (ID 2).")
Local DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
NPrint("Display mode: " .. DisplayMode)
NPrint(GetAttribute(#DISPLAY, 2, #ATTRMODE))
Local DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
If DisplayMode = #DISPMODE_WINDOWED
NPrint("The created display (ID 2) is in window mode.")
ElseIf DisplayMode = #DISPMODE_FULLSCREEN
NPrint("The created display (ID 2) is in full screen mode.")
EndIf
WaitLeftMouse()
p.s. for code display, there is a buttonm in forum [</>] that insert a [.code.] block ,and is more readable that line (also easier to type

Re: Mode=Ask problems
Posted: Thu Nov 14, 2024 11:38 pm
by SpawnPPC
Thanx, I will try !
XD
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 12:19 am
by SpawnPPC
Thanx but the problem is alwys the same !
Can you try it pls for me ?
SpawnPPC
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 5:24 am
by plouf
what are the expected results ?
when i run my example
and chose [Full Screen] in requester, script says
display mode 2
created display is .. full screen
when chose in reequester [Windowed] , script says
display mode 1
created display is .. windowd mode
also adding line
Code: Select all
NPrint(" Opened screen is "..GetAttribute(#DISPLAY, 2, #ATTRHOSTWIDTH).. " x " ..GetAttribute(#DISPLAY, 2, #ATTRHOSTHEIGHT))
i get 320*200 in full screen , and nothing in windowed
note that chosing a resolution under UAEgfx says "hollywood not in palette mode chose true color" but i chose a 32bit/16 mode and still fails !?
no problem in windows though ??
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 12:08 pm
by SpawnPPC
I got always mode = 1.
Uff. I have some problems in some where !
I need to resolved It !
SpawnPPC
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 6:23 pm
by SpawnPPC
Guys, it keeps telling me that the mode is always 1 in window.
But how is that possible ?
I have added a lot of DebugPrints. The result is always the same.
Can anyone help me ?
I would really appreciate it.
Thanks everyone
SpawnPPC
---------------------------------------------------
Code: Select all
@DISPLAY 10, {Width = 320, Height = 200, Hidden = True}
Global ScreenWidth, ScreenHeight; Variabili globali per la risoluzione dello schermo
Global WinWidth, WinHeight; Variabili globali per le dimensioni della finestra
Global XPos, YPos; variabili globali per la posizione della finestra
Function SceltaDisplay()
; Seleziona un display di cortesia invisibile
DebugPrint("Selezione del display di cortesia invisibile (ID 10).")
SelectDisplay(10)
; Libera il display esistente con ID 1
DebugPrint("Tentativo di liberare il display con ID 1.")
CloseDisplay(1)
FreeDisplay(1)
; Recupera le dimensioni dello schermo host (ID 0)
DebugPrint("Recupero delle dimensioni dello schermo host (ID 0).")
ScreenWidth = GetAttribute(#DISPLAY, 0, #ATTRHOSTWIDTH); HOST del S.O.
ScreenHeight = GetAttribute(#DISPLAY, 0, #ATTRHOSTHEIGHT); HOST del S.O.
; Debug dei valori recuperati
DebugPrint("ScreenWidth recuperato: " .. ScreenWidth)
DebugPrint("ScreenHeight recuperato: " .. ScreenHeight)
; Calcolo del margine e gestione del layout in base alla larghezza dello schermo
DebugPrint("Calcolo del margine e del layout in base alla larghezza dello schermo.")
Local Margine
Local GestioneLayout
If ScreenWidth <= 800
Margine = 10
GestioneLayout = 0
ElseIf ScreenWidth > 800 And ScreenWidth <= 1920
Margine = 100
GestioneLayout = 0
ElseIf ScreenWidth > 1920 And ScreenWidth <= 2560
Margine = 200
GestioneLayout = 0
ElseIf ScreenWidth > 2560
Margine = 300
GestioneLayout = 0
EndIf
; Calcolo delle dimensioni della finestra
DebugPrint("Calcolo delle dimensioni della finestra (WinWidth, WinHeight).")
WinWidth = ScreenWidth - (2 * Margine)
WinHeight = ScreenHeight - (2 * Margine)
DebugPrint("WinWidth calcolato: " .. WinWidth)
DebugPrint("WinHeight calcolato: " .. WinHeight)
; Calcolo della posizione della finestra
DebugPrint("Calcolo della posizione della finestra (XPos, YPos).")
XPos = (ScreenWidth - WinWidth) / 2
YPos = (ScreenHeight - WinHeight) / 2
DebugPrint("XPos calcolato: " .. XPos)
DebugPrint("YPos calcolato: " .. YPos)
; Creazione del display (ID 1)
DebugPrint("Creazione del display (ID 1) con dimensioni e posizione calcolate.")
DebugPrint("WinWidth: " .. WinWidth)
DebugPrint("WinHeight: " .. WinHeight)
DebugPrint("XPos: " .. XPos)
DebugPrint("YPos: " .. YPos)
CreateDisplay(2, {Width = 1720, Height = 880, X = 100, Y = 100, Title = "", Borderless = True, Fixed = True, Mode = "Ask",})
SelectDisplay(2)
; Controllo della modalità del display appena creato
DebugPrint("Controllo della modalità del display appena creato (ID 2).")
Local DisplayMode
DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
DebugPrint("Modalità del display: " .. DisplayMode)
If DisplayMode = 1
DebugPrint("Il display creato (ID 2) è in modalità finestra.")
ElseIf DisplayMode = 2
DebugPrint("Il display creato (ID 2) è in modalità schermo intero.")
EndIf
; Se il display è in modalità fullscreen, aggiorna le dimensioni
If DisplayMode = 2
DebugPrint("Modalità fullscreen rilevata. Aggiornamento delle dimensioni.")
ScreenWidth = GetAttribute(#DISPLAY, 2, #ATTRWIDTH)
ScreenHeight = GetAttribute(#DISPLAY, 2, #ATTRHEIGHT)
WinWidth = ScreenWidth
WinHeight = ScreenHeight
DebugPrint("Fullscreen aggiornato: WinWidth = " .. WinWidth .. ", WinHeight = " .. WinHeight)
EndIf
; Apertura del display
DebugPrint("Apertura del display (ID 2).")
OpenDisplay(2)
Wait(5, #SECONDS)
End
EndFunction
Function Main()
SceltaDisplay()
; Attesa dell'evento (interazione con l'utente)
Repeat
WaitEvent
Forever
EndFunction
; Avvio del programma principale
Main()
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 6:48 pm
by plouf
ok
you create a display but you NOT open it, then ask attributes (you get from host ) and THEN you open
first you have to open (active) ask attributes then open it
also too much italian

, both debug/variables/comments hard to see

i comment OUT a few thinks to understand...
Code: Select all
@DISPLAY 10, {Width = 320, Height = 200, Hidden = True}
Global ScreenWidth, ScreenHeight; Variabili globali per la risoluzione dello schermo
Global WinWidth, WinHeight; Variabili globali per le dimensioni della finestra
Function SceltaDisplay()
; Seleziona un display di cortesia invisibile
DebugPrint("Selezione del display di cortesia invisibile (ID 10).")
SelectDisplay(10)
; Libera il display esistente con ID 1
DebugPrint("Tentativo di liberare il display con ID 1.")
CloseDisplay(1)
FreeDisplay(1)
; Recupera le dimensioni dello schermo host (ID 0)
DebugPrint("Recupero delle dimensioni dello schermo host (ID 0).")
ScreenWidth = GetAttribute(#DISPLAY, 0, #ATTRHOSTWIDTH); HOST del S.O.
ScreenHeight = GetAttribute(#DISPLAY, 0, #ATTRHOSTHEIGHT); HOST del S.O.
; Debug dei valori recuperati
;DebugPrint("ScreenWidth recuperato: " .. ScreenWidth)
;DebugPrint("ScreenHeight recuperato: " .. ScreenHeight)
; Calcolo del margine e gestione del layout in base alla larghezza dello schermo
;DebugPrint("Calcolo del margine e del layout in base alla larghezza dello schermo.")
Local Margine
If ScreenWidth <= 800
Margine = 10
GestioneLayout = 0
ElseIf ScreenWidth > 800 And ScreenWidth <= 1920
Margine = 100
GestioneLayout = 0
ElseIf ScreenWidth > 1920 And ScreenWidth <= 2560
Margine = 200
GestioneLayout = 0
ElseIf ScreenWidth > 2560
Margine = 300
GestioneLayout = 0
EndIf
; Calcolo delle dimensioni della finestra
;DebugPrint("Calcolo delle dimensioni della finestra (WinWidth, WinHeight).")
WinWidth = ScreenWidth - (2 * Margine)
WinHeight = ScreenHeight - (2 * Margine)
; DebugPrint("WinWidth calcolato: " .. WinWidth)
; DebugPrint("WinHeight calcolato: " .. WinHeight)
; Calcolo della posizione della finestra
; DebugPrint("Calcolo della posizione della finestra (XPos, YPos).")
Local XPos = (ScreenWidth - WinWidth) / 2
Local YPos = (ScreenHeight - WinHeight) / 2
; DebugPrint("XPos calcolato: " .. XPos)
; DebugPrint("YPos calcolato: " .. YPos)
; Creazione del display (ID 1)
; DebugPrint("Creazione del display (ID 1) con dimensioni e posizione calcolate.")
; DebugPrint("WinWidth: " .. WinWidth)
; DebugPrint("WinHeight: " .. WinHeight)
; DebugPrint("XPos: " .. XPos)
; DebugPrint("YPos: " .. YPos)
Width = WinWidth
Height = WinHeight
X = XPos
Y = YPos
; DebugPrint("Width: " .. Width)
; DebugPrint("Height: " .. Height)
; DebugPrint("X: " .. X)
; DebugPrint("Y: " .. Y)
CreateDisplay(2, {Width, Height, X, Y, Title = "", Borderless = True, Fixed = True, Mode = "Ask",})
OpenDisplay(2)
SelectDisplay(2)
; Controllo della modalità del display appena creato
DebugPrint("Controllo della modalità del display appena creato (ID 2).")
Local DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
DebugPrint("Modalità del display: " .. DisplayMode)
DebugPrint(GetAttribute(#DISPLAY, 2, #ATTRMODE))
Local DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
If DisplayMode = #DISPMODE_WINDOWED
DebugPrint("WINDOW Il display creato (ID 2) è in modalità finestra.")
ElseIf DisplayMode = #DISPMODE_FULLSCREEN
DebugPrint("FULLSCREEN Il display creato (ID 2) è in modalità schermo intero.")
ElseIf DisplayMode = #DISPMODE_FULLSCREENSCALE
DebugPrint("FULLSCREEN SCALE ")
EndIf
; Se il display è in modalità fullscreen, aggiorna le dimensioni
If DisplayMode = #DISPMODE_FULLSCREEN
DebugPrint("Modalità fullscreen rilevata. Aggiornamento delle dimensioni.")
ScreenWidth = GetAttribute(#DISPLAY, 2, #ATTRWIDTH)
ScreenHeight = GetAttribute(#DISPLAY, 2, #ATTRHEIGHT)
WinWidth = ScreenWidth
WinHeight = ScreenHeight
DebugPrint("Fullscreen aggiornato: WinWidth = " .. WinWidth .. ", WinHeight = " .. WinHeight)
EndIf
; Apertura del display
DebugPrint("Apertura del display (ID 2).")
; OpenDisplay(2)
DebugPrint("Funzione SceltaDisplay completata con successo.")
Wait(5, #SECONDS)
End
EndFunction
Function Main()
SceltaDisplay()
; Attesa dell'evento (interazione con l'utente)
Repeat
WaitEvent
Forever
EndFunction
; Avvio del programma principale
Main()
btw i notice a "bug" in IDE in windows
if a fullscreen is opened, debug print text is not updated, have to select with mouse text to see it
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 6:54 pm
by SpawnPPC
The error persist, always window mode (1). I have changed the DisplayID to 2 and inserted fixed variables in the CreateDisplay command. The result is always the same.
bySpawnPPC
Code: Select all
@DISPLAY 10, {Width = 320, Height = 200, Hidden = True}
Global ScreenWidth, ScreenHeight ; Global variables for screen resolution
Global WinWidth, WinHeight ; Global variables for window dimensions
Global XPos, YPos ; Global variables for window position
Function SceltaDisplay()
; Select an invisible courtesy display
DebugPrint("Selecting an invisible courtesy display (ID 10).")
SelectDisplay(10)
; Free the existing display with ID 1
DebugPrint("Attempting to free display with ID 1.")
CloseDisplay(1)
FreeDisplay(1)
; Retrieve host screen dimensions (ID 0)
DebugPrint("Retrieving host screen dimensions (ID 0).")
ScreenWidth = GetAttribute(#DISPLAY, 0, #ATTRHOSTWIDTH) ; Host OS screen width
ScreenHeight = GetAttribute(#DISPLAY, 0, #ATTRHOSTHEIGHT) ; Host OS screen height
; Debug retrieved values
DebugPrint("Retrieved ScreenWidth: " .. ScreenWidth)
DebugPrint("Retrieved ScreenHeight: " .. ScreenHeight)
; Calculate margin and layout based on screen width
DebugPrint("Calculating margin and layout based on screen width.")
Local Margin
Local LayoutManagement
If ScreenWidth <= 800
Margin = 10
LayoutManagement = 0
ElseIf ScreenWidth > 800 And ScreenWidth <= 1920
Margin = 100
LayoutManagement = 0
ElseIf ScreenWidth > 1920 And ScreenWidth <= 2560
Margin = 200
LayoutManagement = 0
ElseIf ScreenWidth > 2560
Margin = 300
LayoutManagement = 0
EndIf
; Calculate window dimensions
DebugPrint("Calculating window dimensions (WinWidth, WinHeight).")
WinWidth = ScreenWidth - (2 * Margin)
WinHeight = ScreenHeight - (2 * Margin)
DebugPrint("Calculated WinWidth: " .. WinWidth)
DebugPrint("Calculated WinHeight: " .. WinHeight)
; Calculate window position
DebugPrint("Calculating window position (XPos, YPos).")
XPos = (ScreenWidth - WinWidth) / 2
YPos = (ScreenHeight - WinHeight) / 2
DebugPrint("Calculated XPos: " .. XPos)
DebugPrint("Calculated YPos: " .. YPos)
; Create display (ID 2)
DebugPrint("Creating display (ID 2) with calculated dimensions and position.")
DebugPrint("WinWidth: " .. WinWidth)
DebugPrint("WinHeight: " .. WinHeight)
DebugPrint("XPos: " .. XPos)
DebugPrint("YPos: " .. YPos)
CreateDisplay(2, {Width = 1720, Height = 880, X = 100, Y = 100, Title = "", Borderless = True, Fixed = True, Mode = "Ask"})
SelectDisplay(2)
; Check the mode of the newly created display
DebugPrint("Checking the mode of the newly created display (ID 2).")
Local DisplayMode
DisplayMode = GetAttribute(#DISPLAY, 2, #ATTRMODE)
DebugPrint("Display mode: " .. DisplayMode)
If DisplayMode = 1
DebugPrint("The created display (ID 2) is in windowed mode.")
ElseIf DisplayMode = 2
DebugPrint("The created display (ID 2) is in fullscreen mode.")
EndIf
; If the display is in fullscreen, update dimensions
If DisplayMode = 2
DebugPrint("Fullscreen mode detected. Updating dimensions.")
ScreenWidth = GetAttribute(#DISPLAY, 2, #ATTRWIDTH)
ScreenHeight = GetAttribute(#DISPLAY, 2, #ATTRHEIGHT)
WinWidth = ScreenWidth
WinHeight = ScreenHeight
DebugPrint("Fullscreen updated: WinWidth = " .. WinWidth .. ", WinHeight = " .. WinHeight)
EndIf
; Open the display
DebugPrint("Opening the display (ID 2).")
OpenDisplay(2)
Wait(5, #SECONDS)
End
EndFunction
Function Main()
; Call SceltaDisplay to initialize the display
SceltaDisplay()
; Wait for user interaction
Repeat
WaitEvent
Forever
EndFunction
; Start the main program
Main()
Re: Mode=Ask problems
Posted: Fri Nov 15, 2024 6:57 pm
by plouf
but the "fixed" code i create and post, works for you or not ?
if it works .. its all ok
