Solved

borland builder MDI modal window key down event

Posted on 2002-06-27
6
746 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now