SCREEN_EXIT

Forum for discussion about the documentation project.
Post Reply
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

SCREEN_EXIT

Post by Lothar Schirm »

In the FreeBASIC manual I found in the index "Screen(Graphics)" the following note:

Code: Select all

Note on using Screen 0
Screen 0 closes any graphics window, but also clears the console window if it exists.
Screen 0, , , SCREEN_EXIT (with SCREEN_EXIT=&h80000000) also closes any graphics window, but does not clear the console window if it exists (previous text is preserved).
This is a very interesting feature, but just writing

Code: Select all

Screen 0, , , SCREEN_EXIT
does not work, I get a compiler error message:

Code: Select all

Grafik_schliessen.bas(12) error 8: Undefined symbol, SCREEN_EXIT in 'Screen 0, , , SCREEN_EXIT
I tried also #include "fbgfx.bi" and FB.SCREEN_EXIT, but I got the same error message.
The constant SCREEN_EXIT seems to be defined nowhere, you must use &h80000000, not so nice! Is this an error in the documentation, or has it been forgotten to define the constant SCREEN_EXIT, e.g. in fbgfx.bi?
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN_EXIT

Post by fxm »

fxm wrote:@admin,
Flag "[GFX_]SCREEN_EXIT" (&h80000000) to be added in documentation and in fbgfx.bi?

Flag only significant when used with Screen 0 (closing any graphics window and preserving the console window content):
SCREEN 0, , , &h80000000

See Fbgfx , not erase txt console when closing graphic mode
fxm wrote:Documentation update:
KeyPgScreengraphics → fxm [Added note on using 'Screen 0, , , SCREEN_EXIT' (with SCREEN_EXIT=&h80000000) to close any graphics window while preserving the console window if it exists]
(this capacity has always existed since at least the FreeBASIC 0.12 Beta version)
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: SCREEN_EXIT

Post by Lothar Schirm »

Thank you, fxm!
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN_EXIT

Post by fxm »

@admin:

Have you seen my proposal to add a flag in fbgfx.bi ?
fxm wrote:
fxm wrote:@admin,
Flag "[GFX_]SCREEN_EXIT" (&h80000000) to be added in documentation and in fbgfx.bi?

Flag only significant when used with Screen 0 (closing any graphics window and preserving the console window content):
SCREEN 0, , , &h80000000

See Fbgfx , not erase txt console when closing graphic mode
fxm wrote:Documentation update:
KeyPgScreengraphics → fxm [Added note on using 'Screen 0, , , SCREEN_EXIT' (with SCREEN_EXIT=&h80000000) to close any graphics window while preserving the console window if it exists]
(this capacity has always existed since at least the FreeBASIC 0.12 Beta version)
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: SCREEN_EXIT

Post by coderJeff »

I see it now. lol
This seems like an easy one.

EDIT:
OK, added as "GFX_SCREEN_EXIT" for consistent naming with other constants.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN_EXIT

Post by fxm »

coderJeff wrote:I see it now. lol
This seems like an easy one.

EDIT:
OK, added as "GFX_SCREEN_EXIT" for consistent naming with other constants.
Jeff, not well seen !
the value is '&h80000000', and not '&h800000001' (does not work).

'changelog.txt' and 'fbgfx.bi' to be modified.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: SCREEN_EXIT

Post by coderJeff »

The new constant value does work.
The definition in gfxlib is literally: "#define SCREEN_EXIT ((int)0x80000000)"
So it's specifically typed as 'LONG' from fb's point of view

In gfxlib.bi it's lower case '&h80000000l'
it's an 'L' suffix for long: '&H80000000' + 'L'

Probably doesn't matter on fbc side.
And I made the 'L' lower case as in 'l', sorry.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SCREEN_EXIT

Post by fxm »

Excuse me!
At my age (70), I sometimes confuse the '1' and the 'l' in the teletype font.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: SCREEN_EXIT

Post by paul doe »

fxm wrote:...I sometimes confuse the '1' and the 'l' in the teletype font.
Please, do not confuse the '1' with the 'l', except under confusing circumstances!
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: SCREEN_EXIT

Post by dodicat »

70 plus aid.

Code: Select all


Sub Magnify()
    #define resetwheel(w,fl) fl=w
    #define wheel(w,f) w-f
    Dim As Integer mx,my,mw,button:Getmouse mx,my,mw,button
    Static As Integer flag,pmw
    mw=(mw/2)
   If button=2 Then  resetwheel(mw,flag)
    Dim As Ulong array(1 To 6561),count
    pmw=wheel(mw,flag)
    if pmw<=1 then exit sub
    For z As Integer=1 To 2
        For x As Integer=mx-40 To mx+40
            For y As Integer=my-40 To my+40
                count+=1
                If z=1 Then array(count)=Point(x,y)
                If z=2 Then
                    var NewX=pmw*(x-mx)+mx:var NewY=pmw*(y-my)+my
                    line(newx-pmw/2,newy-pmw/2)-(newx+pmw/2,newy+pmw/2),array(count),bf
                End If
            Next y
        Next x
        count=0
    Next z
    Line(mx-pmw*40,my-pmw*40)-(mx+pmw*40,my+pmw*40),5,B
End Sub

#undef pointer
sub pointer
      dim as integer x,y
      screencontrol 12,x,y
      line(x-50,y-50)-(x-5,y-5)
      line(x-5,y-5)-(314,225)
      line(x-5,y-5)-(305,232)
      draw string(234,179),"Number one"
      line(x+50,y-50)-(x-5+20,y-5)
      line (x-5+20,y-5)-(334,224)
      line (x-5+20,y-5)-(345,231)
      draw string(349,179),"Letter el"
end sub

screen 12

do
screenlock
cls
locate 5,10
print "Roll mouse wheel"
locate 12,12
draw string(320,240),"1l"'
pointer
magnify
screenunlock
sleep 1
loop until len(inkey)
sleep 
Post Reply