Window buttons !?

Blitz3D Forums/Blitz3D Beginners Area/Window buttons !?

Walter(Posted 2004) [#1]
Hello everybody,
I'm new here and I happy to join the Blitz community. I bought BlitzPlus and just updated it.
Well, I'm confronted to a simple but very annoying problem: Graphics() opens a window without the 3 classic buttons (min, max and close). How to make them appear ?
(I don't want to complicate all the rest of my prog by using GUI windows just to have these buttons!)
Thanks,
Walter


semar(Posted 2004) [#2]
Graphics width,height,color_depth,winmode

width,height: usually 640,480, or 800,600 or 1025,768 --> these are the most common window size resolution to use

color_depth: the values here could be 16 or 32, and indicates the graphics color depth (16 bit or 32 bit).
If you specify the value of 0, then Blitz will choose the appropriate depth accordingly with the gfx card capabilities.

winmode: the values here could be 0,1,2,3
0: window mode when debug is on, full screen when debug is off
1: full screen
2: windowed mode
3: windowed resizable mode - you can enlarge the window dragging the window edges with the mouse - the graphic will be scaled accordingly.

Try this:
Graphics 640,480,0,2

It should give you a 640X480 windowed mode.

Sergio.


Walter(Posted 2004) [#3]
In my prog I have: Graphics(640,480,16,0)
It's a window but without any button on the right of the top bar! I can't close the app!
If I put 2 instead of 0 for the winmod, it's the same. The only difference depends of debug if it's on or off.
Nobody knows how to have the buttons that all the windows app have!?! In the demo of BltzPlus, there were the close button. No more in the last update!


soja(Posted 2004) [#4]
If you're using BlitzPlus and want a window, I would use CreateWindow and CreateCanvas, along with an event loop. The Graphics command is there for BlitzBasic backwards compatibility and/or full-screen gameplay in a specific resolution.

Something like this:
Global wndMain, canMain, pos

InitGUI()
InitGame()
Repeat : EventLoop() : Forever

Function EventLoop()
	Select WaitEvent()
		Case $803 : End
		Case $4001 : UpdateWorld() : Render()
	End Select
End Function

Function InitGui()
	wndMain = CreateWindow("Hello", 200, 200, 400, 200, 0, 3)
	canMain = CreateCanvas(0, 0, ClientWidth(wndMain), ClientHeight(wndMain), wndMain)
End Function

Function InitGame()
	SetBuffer(CanvasBuffer(canMain))
	CreateTimer(60)
End Function

Function UpdateWorld()
	pos = pos + 1
End Function

Function Render()
	Color Rand(255),Rand(255),Rand(255)
	Text pos Mod ClientWidth(wndMain),ClientHeight(wndMain)/2, "Welcome to Blitzplus", 0, 1
	FlipCanvas(canMain) : Cls
End Function



Walter(Posted 2004) [#5]
I know that's possible with the GUI functions but I thought it was also possible to have the "close" and "minimize" buttons when Graphics() is initialized in a windowed mode. So I begin to think this command is only useful for the fullscreen mode... That's really a shame :(


soja(Posted 2004) [#6]
That's really a shame :(

I don't understand why it's a big deal

If you really wanted, you could probably use SetWindowLong (user32) to add a minimize button. This line might work for you.
Graphics(640, 480)
SetWindowLong(GetForegroundWindow(), -16, GetWindowLong(GetForegroundWindow(), -16) Or $20000)
WaitKey

It requires these lines in a decls file in your userlibs folder.
; .lib "user32.dll"
; SetWindowLong%(hWnd%,Val%,Long%):"SetWindowLongA"
; GetWindowLong%(hWnd%,Val%):"GetWindowLongA"
; GetForegroundWindow%():"GetForegroundWindow"



Walter(Posted 2004) [#7]
Thanks but unfortunately your code doesn't work. It does a fullscreen mode. If I change Graphics(640,480) by Graphics(640,480,0,2) it's a window without any buttons.
I wish an update of BlitzPlus will have the buttons.


_PJ_(Posted 2004) [#8]
Mode 0 is Fullscreen (the window appears for debug purposes only in Debug Mode)

Mode 2 is for a non-scalable window, so it wont have the other buttons.

USE MODE 3 because this is a scalale window (as standard Window - Windows!!!)


skidracer(Posted 2004) [#9]
Unfortunately mode 3 doesn't seem to be supported in BlitzPlus.


Grisu(Posted 2004) [#10]
Maybe Mark could put that into an update for b+? :)