[fpc-pascal]How to set focus to graph window?

Thomas Schatzl tom_at_work at yline.com
Thu Mar 13 20:30:25 CET 2003


  although others have already pointed out a few solutions, here're my two

> I'm using the graph unit to provide graphing capabilities for my program
> (Win 32 platform). The graph window opens as a separate window, which is
> ok for me - except one point: The graph window gets opened with the
> least important position in Z-order (ie: all other windows are in front
> of this window).
> Is there a way to set the focus to the freshly opened graph window from
> within my program? (eg: open a graph window and define this as the
> foremost window, in front even of the opening program)

Graph (Win32 version) publishes the variable "mainwindow" in its interface
section. So why not use it?



SetForegroundWindow(mainwindow); // bring window into foreground
SetFocus(mainwindow); // set focus

Probably worth trying... after a quick look at the sources I think that this
variable holds the handle to the graph window, doesn't it? Florian?

[Not tested]


More information about the fpc-pascal mailing list