ptcgraph issues

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ptcgraph issues

Zaaphod

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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: ptcgraph issues

Zaaphod

I’ve been able to figure out a few workarounds for issues with ptcgraph,

 

To prevent scaling and dropped pixels, I have come up with 3 workarounds, not ideal but they could work:

 

  1. Positon the window so the title is off the top of the screen with

               SetWindowPos(Graphicwindow,HWND_TOP,-8,-31,0,0,SWP_NoSize);

               I cannot use maximize with this and the coordinates for the top left corner might be different on different machines. 

               I think my development computer is strange because of having 3 monitors

 

  1. Leave the title bar on with the window sized correctly, but set my own variables to not use the bottom of the window which

is off the screen so it looks right with

SetWindowPos(Graphicwindow,HWND_TOP,-8,0,0,0,SWP_NoSize);

                WinMax_Y:=GetMaxY-31; 

               Then I use WinMax_Y instead of GetMaxY

               This has the same problem as option #1 in that the coordinates for the top left of the screen might not be the same on other machines

               I haven’t been able to find a really good solution to keeping the titlebar and having the window the right size and being able to use maximize.

               I think the only way will be for ptcgraph to create the window sized so maximized it fits completely on the screen with the titlebar and then report a smaller GetMaxY

 

  1. Turn off the title bar, then reset the size of the window to be correct with:

         SetWindowLongPTR(graphicwindow, GWL_STYLE, 0);

         SetWindowPos(Graphicwindow,HWND_TOP,0,0,GetMaxX+1,GetMaxY+1,0);

         ShowWindow(graphicwindow, SW_Maximize);

If you don’t want the titlebar then this is the best solution because the Maximize will make it fit properly on the screen regardless of

How it is configured.

 

 

The only other issue I am having is the problem where task switching with ALT-Tab causes the keyboard not to respond to ptccrt anymore.  I have narrowed this down a bit,  it’s NOT task switching in general that causes this, it’s specifically ALT-TAB that causes it.   I was also mistaken about it only happening with full screen, this happens all the time, no matter how the window is configured.  If I hit the windows logo key and task switch that way , there is no problem when I go back to the ptcgraph window, also if I get back to my console window with

         ShowWindow(ConsoleWindow,SW_show);

         SetActiveWindow(ConsoleWindow);

         SetForegroundWindow(ConsoleWindow);

And alt tab from the console window, then no matter what method I use to get back to the ptcgraph window, even alt-tab,  it’s no problem and ptccrt responds to the keyboard.

 

So that’s where I’m at with this.  It would be great if better solutions can be found for these issues.  The main thing for me is the ALT-Tab issue, especially if I go with option 3 above where I won’t have a minimize button.   Alt-tab is a really big habit because as I mentioned before, most of the computer I run this on don’t have a mouse attached.   If I could disable alt-tab from this window somehow, then at least I wouldn’t accidentally break keyboard response to the ptcgraph window, but I don’t know how I could do that either.

 

James

 

 

From: fpc-pascal [mailto:[hidden email]] On Behalf Of James Richters
Sent: Wednesday, May 17, 2017 4:19 PM
To: 'FPC-Pascal users discussions' <[hidden email]>
Subject: [fpc-pascal] ptcgraph issues

 

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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: ptcgraph issues

Nikolay Nikolov-2
In reply to this post by Zaaphod



On 05/17/2017 11:19 PM, James Richters wrote:

 

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.

I just committed a fix, which might fix the issue with your program no longer responding to the keyboard, after alt-tabbing away and then clicking back to your application window. Can you test if r714 (ptcpas trunk in the sourceforge repo) fixes this bug?

Nikolay

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: ptcgraph issues

Zaaphod

Thank you Nikolay  I will give it a try and report back

 

From: fpc-pascal [mailto:[hidden email]] On Behalf Of Nikolay Nikolov
Sent: Sunday, May 21, 2017 5:09 PM
To: [hidden email]
Subject: Re: [fpc-pascal] ptcgraph issues

 

 

 

On 05/17/2017 11:19 PM, James Richters wrote:

 

 

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.

I just committed a fix, which might fix the issue with your program no longer responding to the keyboard, after alt-tabbing away and then clicking back to your application window. Can you test if r714 (ptcpas trunk in the sourceforge repo) fixes this bug?

Nikolay


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal