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

MDI form and OnKeyDown Event

238 views
Skip to first unread message

Ertan Fidan

unread,
Jan 30, 1999, 3:00:00 AM1/30/99
to
How can I make MDI form responding to OnKeyDown Event ?

Ertan

Ralph Friedman (TeamB)

unread,
Jan 31, 1999, 3:00:00 AM1/31/99
to
Do you have the form's KeyPreview property set to true?

--
Regards
Ralph (TeamB)
--
Ertan Fidan wrote in message <7900cr$9e...@forums.borland.com>...

Ertan Fidan

unread,
Jan 31, 1999, 3:00:00 AM1/31/99
to
KeyPreview is set to True. Only main MDI form is not responding OnKeyDown
event. I put a breakpoint to see if it is because of my coding but program
never comes to that breakpoint.

Ertan

Ralph Friedman (TeamB) <ralphfriedman@spamno_email.com> wrote in message
news:79274a$bn...@forums.borland.com...

Ertan Fidan

unread,
Jan 31, 1999, 3:00:00 AM1/31/99
to
I also tried the New Application Wizard to create an empty MDI form. It
didn't work. When I edit the main.dfm file, Keypreview was set to true. so
it wasn't the problem. I removed the line 'FormStyle = fsMDIForm' and
compiled again. It worked. So I'm sure MDI form doesn't accept onkey events.

Ralph Friedman (TeamB)

unread,
Feb 1, 1999, 3:00:00 AM2/1/99
to
Ertan,

the MDI client form is designed to hold MDI children and, AFAIK, by design
(Windows) does not accept keyboard input. Your 1st message was unclear as to
which kind of MDI form you were referring to and I assumed that you were
referring to your MDI children. If you need it at the "form" level, handle
Application.OnMessage and, in that handler, handle one of the Windows keyboard
messages.

--
Regards
Ralph (TeamB)
--

Ertan Fidan wrote in message <792imi$cc...@forums.borland.com>...

Ertan Fidan

unread,
Feb 2, 1999, 3:00:00 AM2/2/99
to
What I would like to do is to get the idle time of the application. In this
way I want to disconnect user from database after a period of time. Can I do
this in another way?

Thanks in Advance,

Ertan


Ralph Friedman (TeamB) <ralphfriedman@spamno_email.com> wrote in message

news:793mfv$d2...@forums.borland.com...

Ralph Friedman (TeamB)

unread,
Feb 3, 1999, 3:00:00 AM2/3/99
to
Ertan,

take a look at handling Application.OnIdle;


--
Regards
Ralph (TeamB)
--

Ertan Fidan wrote in message <797rcq$gv...@forums.borland.com>...

Ertan Fidan

unread,
Feb 3, 1999, 3:00:00 AM2/3/99
to
Thank you for the reply but I think it won't solve my problem. I can learn
when application became idle but I also need to get when user presses a key.

Ertan

Ralph Friedman (TeamB) <ralphfriedman@spamno_email.com> wrote in message

news:7992aq$i4...@forums.borland.com...

Ralph Friedman (TeamB)

unread,
Feb 4, 1999, 3:00:00 AM2/4/99
to
Ertan,

then I repeat my original suggestion. Handle Application.OnMessage and look
for WM_KEYDOWN, WM_KEYUP or WM_CHAR. Whichever is appropriate to your
situation.

--
Regards
Ralph (TeamB)
--

Ertan Fidan wrote in message <79ai9m$j8...@forums.borland.com>...

Ken Bailey

unread,
Feb 4, 1999, 3:00:00 AM2/4/99
to
Why don't you handle it with your MDIChildren?

Create a descendent of TForm with KeyPreview True.
In the KeyDown event, do something like this:
TMyMainForm(Application.MainForm).KeyHasBeenPressed.

Then create your MDI Children as descendents of this form.

Ertan Fidan wrote:

> Thank you for the reply but I think it won't solve my problem. I can learn
> when application became idle but I also need to get when user presses a key.
>
> Ertan
>
> Ralph Friedman (TeamB) <ralphfriedman@spamno_email.com> wrote in message
> news:7992aq$i4...@forums.borland.com...
> >Ertan,
> >
> >take a look at handling Application.OnIdle;
> >--
> >Regards
> >Ralph (TeamB)
> >--
> >Ertan Fidan wrote in message <797rcq$gv...@forums.borland.com>...
> >|What I would like to do is to get the idle time of the application. In
> this
> >|way I want to disconnect user from database after a period of time. Can I
> do
> >|this in another way?
> >

--
Ken Bailey
Falmouth Software Works Ltd.

Ertan Fidan

unread,
Feb 5, 1999, 3:00:00 AM2/5/99
to
Thanks very much both of you,

Ertan


Ken Bailey <kbai...@maine.rr.com> wrote in message
news:36B9B299...@maine.rr.com...

0 new messages