Solved

borland builder MDI modal window key down event

Posted on 2002-06-27
6
754 Views
Last Modified: 2008-01-09
In Borland Builder an MDI application has a Modal window which is not a Child window.  For non-child modal windows, how does one get the OnKeyDown event?


0
Comment
Question by:lirtua
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Accepted Solution

by:
DrDelphi earned 50 total points
ID: 7117074
You could send a user defined message back to the mainform:

MODAL form's OnKeyDown event handler:

{
  SendMessage(FindWindow('TMyMainForm',null),WM_USER+100,0,0);
}  



MainForm:

class TMyMainForm : public TForm
{
__published:     // IDE-managed Components
private:     // User declarations
public:          // User declarations
       __fastcall TMyMainForm(TComponent* Owner);
       void __fastcall ProcessMyMessage(TMessage &msg);
       BEGIN_MESSAGE_MAP
       MESSAGE_HANDLER(WM_USER+100, TMessage, ProcessMyMessage)
       END_MESSAGE_MAP(TForm)
};


//MyMainform cpp


void __fastcall TMyMainForm::ProcessMyMessage(TMessage &msg)
{
 if (msg.Msg=WM_USER+100) ShowMessage("Modal form keydown event fired");
}




Good luck!!



0
 

Author Comment

by:lirtua
ID: 7122475
ok - this looks cool - i'll give it a try sometime this week - have a couple other issues that need fixing first - i'll let you know how it goes in a few days
0
 

Author Comment

by:lirtua
ID: 7147870
Ok DrDelphi - heres the deal - it works almost all the time - it doesnt work the first time, ie if you start the app, open a modal non-child window, and then hit the MODAL form's OnKeyDown event - once you close the modal window, and reopen it, the code you gave works great - so im stumped

the solution looks pretty good - just needs small fix
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:DrDelphi
ID: 7150303
Hmmm.. sounds like a timing issue. I'd check the return of FindWindow to make sure that the "Main" form is being hit.

Good luck!!
0
 
LVL 11

Expert Comment

by:griessh
ID: 7284952
Dear lirtua

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "DrDelphi"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332982
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question