Mega Search
23.2 Million


Sign Up

Make a donation  
RAD 2010 Window not coming to front  
News Group: embarcadero.public.delphi.vcl.components.using

I posted this in another question and no answer.  I have an application I am converting from RAD 2006 to RAD 2010.  The program has a main button bar with other windows that open from the buttons, or menu selections, in this window.  The old program, when other windows are opened, will bring the main button bar to the front when clicked on.  In RAD 2010, the main button bar clearly has focus, but will not come to the foreground.  I have looked at the properties, and methods and cannot see the problem.  BT
W, the other windows will receive focus and will come to the foreground.  

I have set an event handler in the main window that has the following one line: Self.BringToFront;  This does nothing.  Also, I have tried the program on the XP machine that has the RAD 2006 and it does the same thing.  I have also, brought the RAD 2006 main window (main button bar) unit back into the RAD 2010 program with the same results, will not come to foreground.  Does anyone have ideas where to look for a solution????

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 31-Dec-2014, at 8:19 AM EST
From: Alan Jordan
 
Re: RAD 2010 Window not coming to front  
News Group: embarcadero.public.delphi.vcl.components.using
Alan Jordan wrote:

> > Open the project's DPR file (Project -> view source) and
> > see whether there is a line
> > 
> >   Application.MainFormOnTaskbar := True;
> > 
> > after 
> > 
> >   Application.Initialize;
> > 
> > If not, try to introduce it.
> > 

> That was it!!!  I changed the true to false and now the focus goes to
> the main button bar and it comes to the front.  THANK YOU!  I would
> never have found this myself.
> 
> Question, where is that set?

The statement is now part of the "VCL Forms application" template. The
property was introduced with Delphi 2009 if memory serves, to deal with
a problem the Vista Aero desktop caused (the preview in the Alt-Tab
list did not show the main window but an empty rectangle). Previously
all forms including the main form of a VCL app used the zero-size
Application window (Application.Handle is its HWND) as the owner on the
API level, and the apps taskbar button belonged to this Application
window. You reverted to this behaviour by setting the property to false.

The default (true) for the property makes the main form the API owner
of all other forms and it now manages the taskbar button for the
application. The API owner relationship determines the Z order of
windows. The OS makes sure all windows owned by another window are
always on top of their owner in the Z order. In the old scheme of
things all VCL forms were siblings in the Z order, in the new scheme
only the secondary forms are siblings, and the main form is always
beneath them in the Z order.



-- 
Peter Below (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 3-Jan-2015, at 12:43 AM EST
From: Peter Below
 
Re: RAD 2010 Window not coming to front  
News Group: embarcadero.public.delphi.vcl.components.using
> {quote:title=Peter Below wrote:}{quote}
> Alan Jordan wrote:
> 
> > I posted this in another question and no answer.  I have an
> > application I am converting from RAD 2006 to RAD 2010.  The program
> > has a main button bar with other windows that open from the buttons,
> > or menu selections, in this window.  The old program, when other
> > windows are opened, will bring the main button bar to the front when
> > clicked on.  In RAD 2010, the main button bar clearly has focus, but
> > will not come to the foreground.  I have looked at the properties,
> > and methods and cannot see the problem.  BT W, the other windows will
> > receive focus and will come to the foreground.
> > 
> > I have set an event handler in the main window that has the following
> > one line: Self.BringToFront;  This does nothing.  Also, I have tried
> > the program on the XP machine that has the RAD 2006 and it does the
> > same thing.  I have also, brought the RAD 2006 main window (main
> > button bar) unit back into the RAD 2010 program with the same
> > results, will not come to foreground.  Does anyone have ideas where
> > to look for a solution????
> 
> The main difference between these two Delphi versions I can think of is
> the introduction of the Application.MainformOnTaskbar property. Open
> the project's DPR file (Project -> view source) and see whether there
> is a line
> 
>   Application.MainFormOnTaskbar := True;
> 
> after 
> 
>   Application.Initialize;
> 
> If not, try to introduce it.
> 
> What kind of button do you use on the main form? If these are
> TSpeedbuttons you may have nothing on the menu form that takes the
> focus when clicked on...
> 
> -- 
> Peter Below (TeamB)

That was it!!!  I changed the true to false and now the focus goes to the main button bar and it comes to the front.  THANK YOU!  I would never have found this myself.

Question, where is that set?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 2-Jan-2015, at 7:51 AM EST
From: Alan Jordan
 
Re: RAD 2010 Window not coming to front  
News Group: embarcadero.public.delphi.vcl.components.using
Alan Jordan wrote:

> I posted this in another question and no answer.  I have an
> application I am converting from RAD 2006 to RAD 2010.  The program
> has a main button bar with other windows that open from the buttons,
> or menu selections, in this window.  The old program, when other
> windows are opened, will bring the main button bar to the front when
> clicked on.  In RAD 2010, the main button bar clearly has focus, but
> will not come to the foreground.  I have looked at the properties,
> and methods and cannot see the problem.  BT W, the other windows will
> receive focus and will come to the foreground.
> 
> I have set an event handler in the main window that has the following
> one line: Self.BringToFront;  This does nothing.  Also, I have tried
> the program on the XP machine that has the RAD 2006 and it does the
> same thing.  I have also, brought the RAD 2006 main window (main
> button bar) unit back into the RAD 2010 program with the same
> results, will not come to foreground.  Does anyone have ideas where
> to look for a solution????

The main difference between these two Delphi versions I can think of is
the introduction of the Application.MainformOnTaskbar property. Open
the project's DPR file (Project -> view source) and see whether there
is a line

  Application.MainFormOnTaskbar := True;

after 

  Application.Initialize;

If not, try to introduce it.

What kind of button do you use on the main form? If these are
TSpeedbuttons you may have nothing on the menu form that takes the
focus when clicked on...

-- 
Peter Below (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 1-Jan-2015, at 1:04 AM EST
From: Peter Below