🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #130

Re: Bringing MDIChild to Top

#130
From: Peter Below (TeamB)
Date: Sun, 16 Apr 2006 08:26
39 lines
2508 bytes
In article <4441b70a$1@newsgroups.borland.com>, TonyD wrote:
> If this is the wrong forum, please kindly direct me to the proper one.

If you are talking about a .NET Application the group is OK.
> 
> How can I bring a MDIChild window to the top?  I have a tool bar which when 
> a relative button is clicked it creates the form and then uses the Show 
> event.  I would like to bring the form the the top if the button is clicked 
> again.  When I use the BringToFront method I get an abstract error.
> 
> Project MyApp raised exception class EAbstractError with message 'Abstract 
> Error'.
> Process stopped.  Use Step or Run to continue.
> 
> [Code]
> var
>   frmNHList: TfrmNHList;
> begin
>   { create a new MDI child window if not already }
>   if not IsMDIChildOpen(MainForm, 'frmNHList') then
>     begin
>       frmNHList := TfrmNHList.Create(Application);
>       frmNHList.Show;
>     end;
>     frmNHList.BringToFront;  // if already created and showing, bring to 
> front

Your code contains an error. When the IsMDIChildOpen method returns true
the found MDI child will not be assigned to the frmNHLIst local variable, so 
your call to bringtofront executes on an uninitialized form reference.


--
Peter Below (TeamB)  
Don't be a vampire (http://slash7.com/pages/vampires), 
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Technical Details
Message-ID: <VA.0000c86a.0033598a@nomail.please>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4441b70a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,1ec3e423492bb80e
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 16 Apr 2006 10:26:29 +0200
Newsgroups: borland.public.delphi.winforms.controls.using
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va
Organization: TeamB
Message-ID: <VA.0000c86a.0033598a@nomail.please>
Subject: Re: Bringing MDIChild to Top
From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com>
Reply-To: 100113.1101@compuXXserve.com
References: <4441b70a$1@newsgroups.borland.com>
NNTP-Posting-Host: 217.246.255.232
X-Trace: newsgroups.borland.com 1145175829 217.246.255.232 (16 Apr 2006 01:23:49 -0700)
Lines: 41
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail