>Yes, you can do this, if you set:

>  FullscreenGraph := true;

 

I tried this and it does make a full screen graphics window without the windows 
title bar on top, which I like, however if I task switch out of the graphics 
window, then task switch back to it, my keyboard no longer responds via ptccrt. 
 I do this quite often, even launching things from within my program that I 
expect to be on top of it, for example I will launch a text editor and wait for 
it to be closed before my program continues.  

 

For non-full screen use, are there any variable I can set that would specify 
the graph windows position on the screen, or force the window to be maximized?

 

I was able to switch back and forth to the ptcgraph window by doing the 
following:

  {$H+}

   SetConsoleTitle(ConsoleTitle); //Change name of Console window so it’s not 
the same as the graph window

   Sleep(60); //give windows some time to make the change

   GraphWindow:=FindWindow(nil,Pchar(paramstr(0)+#0#0));  //Figure out handle 
for graph window with FindWindow()

  // the following all work with the handle obtained for the ptcgraph window 
with the above method

   setwindowtextA(graphwindow,GraphTitle); 

   ShowWindow(graphwindow,SW_show);

   SetActiveWindow(graphwindow);

   SetForegroundWindow(graphwindow); 

 

It would be handy if GraphWindow was set to the ptcgraph window handle to make 
it compatible with the graph unit

 

Thanks for the help with this, I really appreciate it

 

James

 

From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Nikolay Nikolov
Sent: Tuesday, May 16, 2017 7:45 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] FPC Graphics options?

 

 

 

On 05/16/2017 01:27 PM, James Richters wrote:

> Hmm? But he only wants to change the title of the window. Even on Windows 
> that should work from a different thread. However a platform independent 
> SetWindowTitle() for ptcgraph would be rather useful I guess.

I did a quick test and ran one program that did a writeln of it’s handle, then 
put that handle in another program and ran it and I was able to change the 
window title of the first program with the second program.   So if ptcgraph 
also had the graphwindow : handle variable I think it would work.

 

>Though I'd like to know why he needs ShowWindow()...

 

My application is purposefully designed not to use a mouse…  It’s CNC control 
software and mice, even optical ones out in dusty shops are tedious and 
difficult… it’s often difficult to even find a place to put a mouse, nevermind 
seeing a pointer when the screen is full of sawdust.   So I have keyboard 
commands that get me back to the console window where I can look at some things 
like the contents of some variables, then when I’m done I hit another key and 
it puts me back on the graphics window.   I just use both crt and pctcrt  and 
do things like crt.readkey and pctcrt.readkey to know which screen got the 
input.   I can get by without ShowWindow() because I can alt-tab between the 
windows without a mouse, and admittedly there isn’t a huge use for the console 
window, but it is a lot nicer for the program to put the correct window on top 
by itself.

 

It would be nice if I could: 

1.      The above mentioned ShowWindow()
2.      Make the graph window full screen always, it normally does not come up 
full screen it’s the correct size for full screen but mispositioned.. I can 
probably fix this in a shortcut that starts it but would be nice if the program 
itself forced full screen

Yes, you can do this, if you set:

  FullscreenGraph := true;

In the beginning of your program (before InitGraph). Tonight I'll also add the 
option for changing the title bar text, when in windowed mode.



3.       
4.      Get rid of the windows titlebar all together, I could just draw my own. 
  I was able to shut the title bar off with the graph unit, but the window 
would still be the size of the screen minus the bar.   I believe if the 
titlebar was defined to be shut off before the window was created, or shortly 
after then I could have completely full screen with no title bar. But I don’t 
know where or how the window is created to do that.
5.      If I can’t get rid of the titlebar, then setting a custom window title 
would be nice, preferably after my program was running so I could put status 
information up there, but if not possible then a one time custom title bar name 
would be great.

 

James

 

From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Sven Barth via fpc-pascal
Sent: Tuesday, May 16, 2017 2:00 AM
To: FPC-Pascal users discussions  <mailto:fpc-pascal@lists.freepascal.org> 
<fpc-pascal@lists.freepascal.org>
Cc: Sven Barth  <mailto:pascaldra...@googlemail.com> 
<pascaldra...@googlemail.com>
Subject: Re: [fpc-pascal] FPC Graphics options?

 

Am 16.05.2017 02:46 schrieb "Nikolay Nikolov" <nick...@gmail.com 
<mailto:nick...@gmail.com> >:
>> I also no longer have the 'graphwindow' handle variable so I had to comment 
>> out anything that was using it like
>>
>> SetWindowTextA(graphicwindow,graphwindowtext);
>> And
>> ShowWindow(graphwindow, SW_SHOW);
>> So I just commented them out for now.    I'm hoping there is a way to get 
>> around the graphwindow variable because I was using the above 2 functions 
>> and I don't know how else to determine the graphic window handle... but the 
>> performance gain and ease of implementation will make working out any other 
>> issues worth the effort.  Any advice on how I can capture the graph window 
>> handle would be appreciated
>
> Unfortunately, you can't do that and it's actually the main reason why 
> ptcgraph is fast. Even if you modify the ptcgraph source, so that you get the 
> window handle, it would do you no good, because the window is created in a 
> different thread and this means that you cannot draw to the window from your 
> program's thread. In fact, all the ptcgraph drawing routines actually render 
> to an internal software buffer and issue no winapi drawing calls at all. 
> That's the reason ptcgraph is fast and the regular graph unit is slow - the 
> winapi drawing routines are really the bottleneck in this case and not the 
> speed of the code, generated by FPC.

Hmm? But he only wants to change the tttle of the window. Even on Windows that 
should work from a different thread. However a platform independent 
SetWindowTitle() for ptcgraph would be rather useful I guess.

Though I'd like to know why he needs ShowWindow()...

Regards,
Sven






_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
<mailto:fpc-pascal@lists.freepascal.org> 
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

 

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to