[fpc-pascal] windows graph unit questions

Pierre Free Pascal pierre at freepascal.org
Wed Aug 17 15:41:06 CEST 2016


Hi,

the beauty about free open source is that you can search the sources:

> -----Message d'origine-----
> De : fpc-pascal-bounces at lists.freepascal.org [mailto:fpc-pascal-
> bounces at lists.freepascal.org] De la part de James Richters
> Envoyé : mercredi 17 août 2016 14:42
> À : 'FPC-Pascal users discussions'
> Objet : [fpc-pascal] windows graph unit questions
> 
> I have a few questions about using the graph unit with windows.
> 
> 1.        Is there any way to get rid of the bar at the top that says
> ‘graph window application’   I don’t need it or want it, I want the
> user locked into my program full screen until they exit it
  I think that display/hiding title bar of a window
is feasible with some standard Windows API call, it might be forbidden
for specific windows type, but I don't think that we added anything
special for this in the source code...
  I can't help you on this side, sorry.
  
> 2.       If there is no way to get rid of the bar at the top, Is there
> a way change the title of it to the name of my application instead of
> ‘graph window application’ ?
Look for ‘graph window application’   in graph package:
Pierre at E6510-Muller cygwin-32 ~/pas/off-trunk/packages/graph
$ grep -ir 'graph window application' .
./src/win32/graph.pp:    windowtitle : pchar = 'Graph window application';
Note here that windowtitle is an initialized variable,
that that you can change its value before calling InitGraph.

Find where windowtitle is used:
Pierre at E6510-Muller cygwin-32 ~/pas/off-trunk/packages/graph
$ grep -riw windowtitle .
./src/macosx/graph.pp: windowTitle:   CFStringRef;
./src/macosx/graph.pp:  windowTitle := CFCopyLocalizedString(titleKey, nil);
// 5
./src/macosx/graph.pp:  err := SetWindowTitleWithCFString (myMainWindow,
windowTitle); // 6
./src/macosx/graph.pp:  CFRelease (windowTitle);
./src/win32/graph.pp:    windowtitle : pchar = 'Graph window application';
./src/win32/graph.pp:
ParentWindow:=CreateWindowA('FPCGraphWindowMain', windowtitle,
./src/win32/graph.pp:       hWindow:=CreateWindowA('FPCGraphWindow',
windowtitle,

Here you see that the Windows version simply uses CreateWindowA Windows API
function,
which means that you can use the Windows API function SetWindowTextA
to modify the title after starting (untested).
You will need the windows handle, but there is an interface variable 
called GraphWindow that provides this for you.


> 3.       Is there any way I can make my program use only the graph
> interface, and not display the command window?
  Did you try 
{$apptype gui}
or -WG option?

> 
> Thanks for any advice anyone has to address these thing

I hope this will help you,

Pierre



More information about the fpc-pascal mailing list