[fpc-pascal] ptcgraph issues

James Richters james at productionautomation.net
Wed May 17 22:19:13 CEST 2017


I'm having a few issues with ptcgraph.  

 

The main issue is that it's not correctly reporting the actual size of the
available area to use inside the ptcgraph window.  It's reporting my full
screen resolution, but that amount of space is not really available due to
the title bar.   The window that is generated is a 1919x1176 window, but it
won't fit on the screen due to the title bar, so I hit maximize, now it fits
on the screen but it's too small.   I generate my screen based off the
GetMaxX and GetMaxY functions and my screen based on GetMaxX being 1919 and
GetMaxY being 1199 should not fit inside a window that fills the screen but
with a border around it and a title bar at the top, but it is being scaled
down to fit.  This scaling is causing pixels to be dropped.   If I force
GetMaxX and GetMaxY to be the correct numbers of 1919x1176 which is what the
graph unit reports, It just leaves a gap at the bottom of the screen the
same width as the title bar, and still scales the screen from 1919x1199 down
to fit in the available space of 1919x1176 making some pixels drop.    I
have tried maximizing the screen with ShowWindow(graphwindow, SW_Maximize);
before I use GetMaxX and GetMaxY, but they still report the full screen
size.   

 I can get the screen to look right with no scaling and no dropped pixels if
I use SetWindowPos(Graphicwindow,HWND_TOP,-8,-32,0,0,swp_nosize); to
position the window so the title bar is off the top of the screen,  but as
you can see my X and Y coordinates are screwy. it's something to do with my
multiple monitors why top left is not 0,0  So I have no way of knowing what
to set this to on any given system, so it's not really a solution at all. it
just proves what the problem is.

 

So I thought I would force it to be full screen, to see if I could prevent
the scaling.. but that also has issues.  I figured if it looks right
shifting the title bar off the top of the screen, then simply shutting off
the title bar should fix it, but I could not get that to work either.  There
are 2 ways I can get full screen without the title bar that I can think of.
I can just shut off all windows styles with    SetWindowLongPTR(graphwindow,
GWL_STYLE, 0);   but this has the opposite problem,  If I draw a rectangle
from 0,0 to GetMaxX,GetMaxY, I should get a rectangle that barely fits on
the screen, but I don't see anything because it's way too big.  I have to
draw a rectangle from 8,8 to GetMaxX-8,GetMaxY-8 to get it to fit on the
screen.    However with this method of getting rid of the titlebar, I can
taskswitch out and back in with no issues, my keyboard still works and if I
taskswitch out, it just puts other windows on top of this, so I can always
click on it to make it active again.  The scaling causes things to not look
right.

 

 

If I get the full screen by setting fullscreengraph := True;  then it does
seem to report stop scaling and now everything fits correctly on the screen,
however. this has it's own issues.   For some reason when I use this to
obtain full screen, it does not task switch anywhere near as gracefully as
using SetWindowLongPTR(graphwindow, GWL_STYLE, 0);    If I task switch to
anything else, the graph window disappears completely, so now I have nothing
to click on to get it back, and using ShowWindow() to get it back takes a
very long time.  Then when I eventually get the window back, it no longer
responds to the keyboard. 

 

James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170517/f158ee2e/attachment.html>


More information about the fpc-pascal mailing list