Re: "Dialogs" in AppGraphics

Hi Jeff,

I have a question regarding the screen resolution in pixels using APPGRAPHICS. When a window is created of width and height of 800,600 using initwindow(800, 600, title="Example Application"), the functions getwindowwidth ( ) and getwindowheight ( ) produce pixels of 806 and 629. In comparision, the functions getmaxx ( ) and getmaxy ( ) produce 799 and 599 as they should.
Why do these function calls produce different window dimension?

Moreover, when subsequently initwindow (getwindowwidth ( ), getwindowheight ( ), "EXAMPLE WINDOW", DEFAULT_POSITION , DEFAULT_POSITION , .FALSE., .TRUE.) is called, then functions getwindowwidth ( ) and getwindowheight ( ) produce pixels of 812 and 658. 
Why has the window dimensions gotten larger?

EXAMPLE CODE:
    INTEGER :: window, initwin

        !--- Display screen in pixel coordinates
        !--- Create a window 800 pixels wide by 600 pixels tall.
        ! (width,height)
        ! (0,0).....................................(800,0)
        !  .
        !  .
        !  .
        ! (0,600)...................................(800,600)

    !--- Initialized window x,y dimensions (800,600)
        window = initwindow(800, 600, title="Example Application")

        !-------------------------------------
        !INITWIN = initwindow (getwindowwidth ( ), getwindowheight ( ), &
        !"EXAMPLE WINDOW", DEFAULT_POSITION , DEFAULT_POSITION , &
        !.FALSE., .TRUE.)

        !--- Width in pixels of the current window
        !PRINT *, 'INITWIN-XTOTAL_PIX = ', getwindowwidth ( )    !--> 812
        !!--- Height in pixels of the current window
        !PRINT *, 'INITWIN-YTOTAL_PIX = ', getwindowheight ( )   !--> 658
        !-------------------------------------

        !--- Width in pixels of the current window
        PRINT *, 'XTOTAL_PIX = ', getwindowwidth ( )    !--> 806

        !--- Height in pixels of the current window
        PRINT *, 'YTOTAL_PIX = ', getwindowheight ( )   !--> 629

        !--- Largest horizontal position possible in the current window
        PRINT *, 'XMAX_PIX = ', getmaxx ( )    !--> 799
   
    !--- Largest vertical position possible in the current window
        PRINT *, 'YMAX_PIX = ', getmaxy ( )    !--> 599

btw, I running Windows 10 using a Microsoft Surface Pro PC. SimplyFortran is verison 3.19, build 3543 using GNU Fortan 10.2.0.

Frank

Re: "Dialogs" in AppGraphics

The calls to getwindowwidth and getwindowheight return the true width and height of the window, the equivalent of the Windows API call GetWindowRect.  The true size includes the size of window decorations (like the title bar, border, etc.) and, if present, a menu. 

When you specify a window size to initwindow, it actually is specifying the window's client area where drawing can take place, and it does not include the decorations.

Jeff Armstrong
Approximatrix, LLC

Re: "Dialogs" in AppGraphics

Klaus Asmus wrote:

Hi Jeff,
I am restarting developement of my program for costing for shipstructures using the latest version of SF.
I did not use it for a longer time and found an unwanted reaction on hitting the windows cross on top of dioalogs: It causes a crash or it does not return to the calling window. All my dialogs  have buttons to exit and return to the calling window. The cross at top is not needed. Is it possible te deactivate it?
Regards Klaus

There is no way to deactivate the window's close button.  However, recent versions of AppGraphics include a routine setwindowclosecallback that will trigger a subroutine call when a window is closed, regardless of how it occurs.  If you set up a callback routine properly, it should be able to do the same thing gracefully4 that your exit buttons do.

Jeff Armstrong
Approximatrix, LLC