When I for example init a screen with screen 18,
I will get a normal minimize-maximize-close window.
How do I access what happens when I click on for example close or maximize, without using WinAPI?
minimize-maximize-close window in fbgfx.bi
Some ideas to detect the graphic window state:
Testing the current window position (x, y), in desktop coordinates, you can detect:
- the minimize window state (x=-32000, y=-32000).
- the maximize window state (always x=0, y=0), but it is not a test absolutely sure, because the position (0, 0) can exist for a normal window.
- Testing the screenptr value, you can detect the closing window state (screenptr=0)
Test program which monitors on console window the parameters (x, y, screenptr) of the graphic window:
- click on 'x' to close the graphic window
- enter 'escape' to exit
Testing the current window position (x, y), in desktop coordinates, you can detect:
- the minimize window state (x=-32000, y=-32000).
- the maximize window state (always x=0, y=0), but it is not a test absolutely sure, because the position (0, 0) can exist for a normal window.
- Testing the screenptr value, you can detect the closing window state (screenptr=0)
Test program which monitors on console window the parameters (x, y, screenptr) of the graphic window:
- click on 'x' to close the graphic window
- enter 'escape' to exit
Code: Select all
screen 18
dim as integer x, y
dim as string c
do
screencontrol(0, x, y)
shell("echo." + str(x) + ", " + str(y) + ", " + str(screenptr))
c = inkey
if c = chr(255) + "k" then
screen 0
end if
sleep 1000
loop until c = chr(27)
Extract of the FreeBASIC manual, keyword "Screen (Graphics)", paragraph "Other details":N3trunn3r wrote:What has chr(255) + "k" to do with clicking on the "X" / close button?
How are they related?
While in windowed mode, clicking on the window close button will add a keypress of Chr(255)&"k" to the Inkey buffer.
For a graphic window only, clicking the "X" / close button has no other effect than to simulate receiving of this string.
Re: minimize-maximize-close window in fbgfx.bi
Thanks Thanks Thanks. Screen 0, and The X close window keyboard trick worked perfectly. Big help.