Personal computing discussed

Moderators: renee, SecretSquirrel, just brew it!

 
OutlawTornNMT
Gerbil First Class
Topic Author
Posts: 148
Joined: Sun Jul 21, 2002 5:30 pm

Displaying Keyboard Input from Parent Window to Child Window

Mon Mar 08, 2004 10:50 pm

I've gotten some good help here in the past so I'll ask another question.

I have my app with three splitter child windows set up in it....

I want to be able to launch my app, press a key, say F, and then have it display F in one of the child view windows....

I would assume this can be accomplish through OnChar or something in my MainFrm class (MainFrm is the main frame in which all my child frames are created).....
 
Veritas
Gerbil First Class
Posts: 113
Joined: Wed Dec 26, 2001 7:00 pm
Location: Houston, TX
Contact:

Wed Mar 10, 2004 11:51 am

If you place a CEdit control in the child splitter window you want to type in then just give that control focus when the app initializes you should be able to accomplish what you want.
 
UberGerbil
Grand Admiral Gerbil
Posts: 10368
Joined: Thu Jun 19, 2003 3:11 pm

Wed Mar 10, 2004 12:08 pm

What language are you using... sounds like VB? Which version?
 
Veritas
Gerbil First Class
Posts: 113
Joined: Wed Dec 26, 2001 7:00 pm
Location: Houston, TX
Contact:

Wed Mar 10, 2004 5:05 pm

I think he is using VC++ based on his other posts.
 
UberGerbil
Grand Admiral Gerbil
Posts: 10368
Joined: Thu Jun 19, 2003 3:11 pm

Thu Mar 11, 2004 2:22 am

Ah, you're probably right. The reference to "forms" threw me... but of course in C++ .NET you have the managed libraries, which have forms. Haven't done any mixing of C++ with .NET yet, though I find C# is quite nice.

In the .NET forms package, if you look at your form you'll find it has a "KeyPreview" property. Set that to True. Your form should see key events prior to any control (in other words, no matter which control on that form has the focus, when a key is pressed the form will see the key first, and then the control). You can then write whatever centralized key handling code in the appropriate event (keydown, keypress, keyup) for the form. You could get the same effect by attaching the same delegate to the keyevents for each control, but that's more work.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On