|
Ah, sorry, i got a bit mixed up there, the "control parent" thing is a setting in Dialog editor (in VS's resource editor) you use when you make a dialog resource be a child of another dialog. Sorry. But it might be related since it's for including the child dialog's controls in the tab order of the parent.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for the response. It is now working the way I want it to. Part of the problem was that I needed the following routine:
BOOL
CMainWindow::PreTranslateMessage( MSG *pMsg )
{
return ::IsDialogMessage( m_hWnd, pMsg );
}
However, I do not understand why. Maybe you could tell me.
Bob
|
|
|
|
|
I have two other follow up questions:
1) I would like the program to behave in such a way that when the user hit's return
the program move to the next field. Just the way tab works. Is there a way to do this?
2) When the user moves to the next field, say by entering a tab character, I would like
to know that and be able to check his input so far. Is there a way to do this?
I ran the debugger and noticed that my input field is not seeing the carriage character any more. I am thinking that character (message) is being processed in the following routine:
<br />
BOOL<br />
CMainWindow::PreTranslateMessage( MSG *pMsg )<br />
{<br />
return ::IsDialogMessage( m_hWnd, pMsg );<br />
}<br />
Do you agree with my reasoning?
Thanks
Bob
|
|
|
|
|
How about catching the enter keyhit and changing it to a TAB hit or maybe posting a tab hit? For example in that PreTranslateMessage you made you could try something like:
BOOL CMainWindow::PreTranslateMessage( MSG *pMsg )
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) pMsg->wParam = VK_TAB;
return ::IsDialogMessage( m_hWnd, pMsg );
}
or maybe
BOOL CMainWindow::PreTranslateMessage( MSG *pMsg )
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
PostMessage(WM_KEYDOWN, VK_TAB, 0);
return TRUE;
} else return ::IsDialogMessage( m_hWnd, pMsg );
}
You probably need to experiment with that some, maybe you need WM_CHAR instead of WM_KEYDOWN and maybe you need also WM_KEYUP for the WM_KEYDOWN. For your second point, you can use the WM_KILLFOCUS message or notifications from the controls sent upon loosing the focus (like EN_KILLFOCUS for edits), but i don't much recommend doing that, validating on kill focus can lead to nasty results, there are articles out there about it though, try googling for them.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for the response. Your suggestion of using the following statement:
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) pMsg->wParam = VK_TAB;<br />
worked. I did some googling and I found that you are right. I do not want to check it when I lose
the focus but what about when the user hits the tab key. I think I want to check it then. The problem is that my routine for processing user inputs is not seeing the tab key. So, how do I know when the user has hit tab to leave the field? I suppose I could put the code in the parent window, but that seems very kludge to me. I suspect you know a better way. What is that better way?
Bob
|
|
|
|
|
Also in that PreTranspateMessage you could catch the TAB hit as you did with the enter key and perform validation and if you want the user to stay in a control that doesn't have a valid information written to it you simply don't relay the message to that IsDialogMessage call. But you don't want validation if the user clicks away from your controls (so changes the focused control via the mouse and not by hitting the TAB key)?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for the response. I now have it working the way I want it. Your help has been most valuable.
Bob
|
|
|
|
|
I'm glad i could help. Good luck with the project...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I have downloaded the coderoject demo code form Url:"http://www.codeproject.com/KB/IP/IOlkAccountManager.aspx"
Now we want to modify
IOlkAccount properties, ie PROP_ACCT_ID,
PROP_ACCT_IS_EXCH, PROP_ACCT_NAME, PROP_ACCT_SEND_STAMP, PROP_ACCT_STAMP and
PROP_ACCT_USER_DISPLAY_NAME.
How can we do it?
i hope experts can solve this problem..
|
|
|
|
|
Hi,
I need to develop an GUI interface for my project. Where in my embedded device(Ambiance analyzing robot, have on-board micro-controller) can be connected to PC via COM port.
As of now I have a set of commands developed to communicate with micro-controller, and I use Hyper-terminal to send the commands to the micro-controller via COM port, and receive back the outputs on Hyper-terminal in HEX format.
I want to develop a user interface where user can set the parameters and click a button to generate the command and send it to COM port, and on receiving data back from COM port displays it on separate section of the screen store it in a file.
I have Visual Studio Team Suite 2008, 1 year evaluation version and it got all kind of tools in it, Visual basic, Visual C++, MFC, WPF, WinForm, Win32, and I am confused what to do, which is the right tool to deliver fast and with at least the basic features.
I have very minimal experience of building GUI in Visual Studio 6 Visual C++ using MFC in past (precisely 4yrs back, one application), i don't know visual basics, have little knowledge of C#. I do not want my application to be behind in technologies, and wnat to develop in latest technologies.
Can you help me find the best combination to do this development, like Visual C++ with MFC, Visual Basic, Visual C++ with Win 32, or CLR Windows forms application etc.
Thanks for all your help and patients.
Karmendra Suthar
|
|
|
|
|
Karmendra,
If you want to use the latest technologies then I would use C# and .NET. If you go that route, expect a long learning curve. I am personally partial to C++ with MFC.
Bob
|
|
|
|
|
Bob,
Thanks for your reply, I even talked with some friends of mine they said Windows Form Application using C# would be easy to learn and implement. What in your opinion would be any pros or cons of using this combination?
Regards,
Karmendra
|
|
|
|
|
Karmenda,
I do not know Window Form Applications well enough to give you a meaningfully answer about how hard or easy it is to use. My feeling is that learning C# and .Net at the same time is going to be a lot of work. At least, it would be a lot of work for me. However, it is the latest technology and therefore it could be the right solution for you. By the way, using .NET and C++ is kind of a kludge and I would not recommend it.
I am wondering, what is your estimate of the time for you to do this project. I think the more time you have the better off you are by learning the C# and the Windows Form Application.
Bob
|
|
|
|
|
I want to be notified whenever the user presses "Paste" or "Copy" menu items from within any menu in the whole system. can any one help me please?
Thank you masters!
|
|
|
|
|
Why the menu items? Many users might use Ctrl+C / Ctrl+V instead.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Those aren't system-wide events. They are implemented individually
per application.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hai all,
In pretranslate message i have given the code to move from one dialog box to another, using two key F2 and F6 we can shift between two keys. and when calling the dialog box everytime a domodal() is called and the corresponding window is Updated.
In the dialog box, Which appears when F6 is called a number of other dialog boxes appear on the click of each and every button. When we move between these dialog boxes it gets closed or the window application disappears after sometime. Please some one help me.
Thanks and regards
Bhanu
|
|
|
|
|
Please post code of your PreTranslateMessage().
|
|
|
|
|
Hi all
i am new to the c++.In my project I need to pass the xml file using c++.This xml parsing already i done in the php.for Example
File Name : Language.xml
<languages>
<language id="english">
<Name>kumar</Name>
<Sex>Male</Sex>
<language>
<language id="french">
<Name>french_kumar</Name>
<Sex>french_male</Sex>
</language>
</languages>
In this file how to get the particular node(language id="english") value..ouput look likes
Name : kumar
Sex: Male
Please send me the articles or send me a link for sample programme ..
Help me..
Thanks and regards
Sumitra.E
|
|
|
|
|
kumarsumitra wrote: Please send me the articles or send me a link for sample programme ..
oh come on !! google it - there's plenty of articles out there
|
|
|
|
|
|
Check this article[^] about how to parse XML file by using msxml. Its so simple.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I've been using TElemW[^]-- I find this helper class to be fantastic at parsing XML -- easy to write simple code with it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
|
AT
modified on Saturday, November 29, 2008 6:04 AM
|
|
|
|