Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot focus a disabled or invisible window

865 views
Skip to first unread message

Robert Jochemsen

unread,
Oct 8, 1996, 3:00:00 AM10/8/96
to

Hi,

I'm porting a large delphi 1 program to D2, and all was well, but
a certain window won't create, and gives the message

' Cannot focus a disabled or invisible window '

Nowhere in my code I'm explicitly making things disabled or invisible
before the warning comes. I saw some other people having problems
with this one too, but no real solutions.


chi...@pc.jaring.my

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Robert Jochemsen wrote:
> ' Cannot focus a disabled or invisible window '
>
> Nowhere in my code I'm explicitly making things disabled or invisible
> before the warning comes. I saw some other people having problems
> with this one too, but no real solutions.

I get this when I do MyEdit.SetFocus in my FormCreate event. Use this instead
try MyEdit.SetFocus; except end;

Hope this helps.

Eric FOOKES

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Joch...@fel.tno.nl (Robert Jochemsen) wrote:

>Hi,

> I'm porting a large delphi 1 program to D2, and all was well, but
>a certain window won't create, and gives the message

>' Cannot focus a disabled or invisible window '

>Nowhere in my code I'm explicitly making things disabled or invisible
>before the warning comes. I saw some other people having problems
>with this one too, but no real solutions.

This problem usually appears when you assign a control to the
ActiveControl property of a form. If the form's visible property is
False when you create it, the exception you describe will be
triggered.

I guess you could say it is a bug in Delphi.

Hope this helps!


Eric G.V. Fookes ===============<foo...@sc2a.unige.ch>==============
Creator of Delphi (1 & 2) Labeled Input Controls. Download from...
http://www.unige.ch/sciences/terre/geologie/fookes/delphi.htm
====================================================================


Olav

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to foo...@sc2a.unige.ch, Joch...@fel.tno.nl

Eric FOOKES wrote:

> This problem usually appears when you assign a control to the
> ActiveControl property of a form. If the form's visible property is
> False when you create it, the exception you describe will be
> triggered.

I fix it with TForm( owner ).show.

Anybody got something cleaner?

_
| | | _ _ http://www.stud.ntnu.no/~olavb/
|_| |_|_|_|_| mailto:Ol...@dds.nl
Eyecom Images, Amsterdam


Robert Jochemsen

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

In article <53e145$n...@alley.fel.tno.nl>, Joch...@fel.tno.nl says...

>
>Hi,
>
> I'm porting a large delphi 1 program to D2, and all was well, but
>a certain window won't create, and gives the message
>
>' Cannot focus a disabled or invisible window '
>
>Nowhere in my code I'm explicitly making things disabled or invisible
>before the warning comes. I saw some other people having problems
>with this one too, but no real solutions.
>


I found it (only after getting down to the VCL-source code). My
application has a main window, and starts other windows from there, from which
other windows got created.

When creating these dialogs the creating window sets itself as parent of the
dialog. Then the VCL tries to set focus to one of the buttons, but raises
an exception because it thinks the main window is the parentform of the
button, and not the dialog. (GetParentForm function).

This is because the VCL iterates through te parents, until there is no more
parent. When this one is reached it supposes it is a form. That is correct,
but earlier in the parentlist the right form is passed. For an easy fix I
hacked the VCL, so that it stops at the first form. All is well since.

Thanks a lot for your reactions.

Robert


Markus Peters

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Joch...@fel.tno.nl (Robert Jochemsen) meinte am 8 Oct 1996 16:56:37
GMT zum Thema "Cannot focus a disabled or invisible window":

> Hi,

> I'm porting a large delphi 1 program to D2, and all was well, but
> a certain window won't create, and gives the message

> ' Cannot focus a disabled or invisible window '

> Nowhere in my code I'm explicitly making things disabled or invisible
> before the warning comes. I saw some other people having problems
> with this one too, but no real solutions.

Hi Robert.

I had this problem in D1 in designing state, when I tried to set the
forms ActiveControl property to a component, which was located in a
notebook page, which was not the active page at this moment. Actually
it typed the name of the component instead selecting it from the
combobox in the object inspector.

Maybe it helps.

Greets, Markus
___________________________________________________________________
| | |
| Markus Peters | "Vertrauen Sie mir - |
| m.pe...@koan.de | ich weiss, was ich tue" |
| http://www.koan.de/~m.peters/ | Sledge Hammer |
|_____________________________________|____________________________|


Mário Reis

unread,
Jul 29, 2022, 4:02:28 PM7/29/22
to
A quarta-feira, 9 de outubro de 1996 à(s) 07:00:00 UTC, Markus Peters escreveu:
This is a crasy think i'm openin the qry ok assgning variables ok but
post generetes this crasy error
0 new messages