Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

borland builder MDI modal window key down event

Posted on 2002-06-27
6
Medium Priority
?
760 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 200 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

719 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