[fpc-pascal] FPC Graphics options?
James Richters
james at productionautomation.net
Tue May 16 12:27:16 CEST 2017
> 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
3. 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.
4. 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-bounces at lists.freepascal.org] On Behalf Of Sven Barth via fpc-pascal
Sent: Tuesday, May 16, 2017 2:00 AM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Cc: Sven Barth <pascaldragon at googlemail.com>
Subject: Re: [fpc-pascal] FPC Graphics options?
Am 16.05.2017 02:46 schrieb "Nikolay Nikolov" <nickysn at gmail.com <mailto:nickysn at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170516/dc168ba9/attachment.html>
More information about the fpc-pascal
mailing list