|
Yes, it is of DropDown style only and i am doing all this just to move the focus. For other combobox of style DropList type the tab key is working fine.
I am sending message from some other class to the dialog containing the combobox to set the focus.
Thanks
|
|
|
|
|
ashtwin wrote: I am sending message from some other class to the dialog containing the combobox to set the focus.
How are you sending the message? Code fragment will be helpful.
|
|
|
|
|
Hi, from the function below i am sending the message.
<br />
BOOL MyBaseClass::PreTranslateMessage(MSG *pMsg)<br />
{<br />
HWND hParent, hChild;<br />
if(::FindWindow(NULL, _T("My Dialog")))<br />
{<br />
if(pMsg->message == WM_KEYDOWN)<br />
{<br />
if(pMsg->wParam == VK_TAB)<br />
{<br />
hChild = ::GetFocus();<br />
hParent = ::GetParent(hChild);<br />
::PostMessage(hParent, WM_MYMESSAGE, 0, 0); <br />
}<br />
}<br />
<br />
}<br />
return MyBaseClass::PreTranslateMessage(pMsg);<br />
}<br />
I am doing this because due to some reasons the keyboard messages are going to the above function.
MyBaseclass is the class from the child class of whom i am creating the modeless dialog.
modified on Monday, January 07, 2008 8:31:43 AM
|
|
|
|
|
First of all, are you missing the call to base class's PreTranslateMessage ?
PS:
The following should be noted.
if(::FindWindow(NULL, _T("My Dialog")))
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_TAB)
{
is not good. Change as follows...
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_TAB)
{
if(::FindWindow(NULL, _T("My Dialog")))
{
|
|
|
|
|
Ok, thanks i will change my code as u have suggested. But i am calling the base class PreTranslateMessage.
Thanks
|
|
|
|
|
ashtwin wrote: return MyBaseClass::PreTranslateMessage(pMsg);
OK...
ashtwin wrote: ::PostMessage(hParent, WM_MYMESSAGE, /*pMsg->wParam*/0, /*pMsg->lParam*/0);
I think this WM_MYMESSAGE is WM_USER + nonzero message, right? If so what is the exact value?
Or it a registered message?
Also did you tried by excluding the subclassing done in the InitDialog, but keeping this MyBaseClass::PreTranslateMessage function as now?
|
|
|
|
|
The value of MyMessage is WM_USER+1 and it is working fine for other controls.
Without subclassing also io have tried but the message is getting lost somewhere because the focus is on the editbox of combobox and not on combobox.
Thanks
|
|
|
|
|
One thing I noticed just now...
<blockquote class="FQ"><div class="FQA">ashtwin wrote:</div>hChild = ::GetFocus();
hParent = ::GetParent(hChild);
::PostMessage(hParent, WM_MYMESSAGE, /*pMsg->wParam*/0, /*pMsg->lParam*/0); </blockquote>
So the parent is the combobox itself, and the message is posted to it. So this message is going to be received by combobox, not the parent of the combobox. Is it expected?
What is happening exactly with the subclassing?
|
|
|
|
|
No it is not expected, i want to send the message to the parent dialog and not to the combobox. Because in dialog class i am setting the focus to the next control after receiving the message i.e why i have done subclassing for combobox.
But after doing subclassing mouse clicks and other things are not working for combobox and even it is effecting other comboboxes also(eg they are appearing as disabled untill i am cliking the mouse on them).
Thanks
|
|
|
|
|
So you should check whether it is the correct control or not. You can check control ID since you have to do it in only one control. Calling ::GetMenu( hWndCombo ) will give you the ID, provided hWndCombo is the handle to the combobox obtained by calling GetParent( hWndEdit ). You should only change the focus if the control ID is of the specified combo.
|
|
|
|
|
Hi,
now after doing the following changes the application is working fine but still i don't know about the problem with subclassing.
<br />
BOOL MyBaseClass::PreTranslateMessage(MSG *pMsg)<br />
{<br />
if(::FindWindow(NULL, _T("Temporary Catheter Connections")))<br />
{<br />
if(pMsg->message == WM_KEYDOWN)<br />
{<br />
if(pMsg->wParam == VK_TAB)<br />
{<br />
COMBOBOXINFO cbi;<br />
hChild = ::GetFocus();<br />
hParent = ::GetParent(hChild);<br />
cbi.cbSize = sizeof(COMBOBOXINFO);<br />
if(GetComboBoxInfo(hParent, &cbi))<br />
{<br />
hParent = ::GetParent(hParent);
}<br />
::PostMessage(hParent, WM_MYMESSAGE, 0, 0);<br />
}<br />
}<br />
}<br />
return BaseClass::PreTranslateMessage(pMsg);<br />
} <br />
<br />
Thanks
|
|
|
|
|
OK...
Please confirm my understanding.
You need to change the focus to the next control when the focus is set to combo using Tab key.
Am I right?
|
|
|
|
|
Yes, u r right.
Thanks
|
|
|
|
|
Then removing the WS_TABSTOP property wasn't enough?
|
|
|
|
|
I want the focus on combobox also, when user presses the tab key on the control previous to the ComboBox. So, problem was that if the focus is on Combobox and user presses the tab key, then it should move to the next control.
Thanks
|
|
|
|
|
Hi
In my system not installed languagepack.when i paste chinese characters in rtf ..
In sending i wrote this code...
m_chattext.GetWindowText(m_Text);
AfxMessageBox(m_Text);
here m_chattext is rtf object.
in messagebox the chinese characters are not displaying..its coming ???? how i can solve this problem ...plz tell...
#sanroop#
|
|
|
|
|
There is no one thing, hence your difficulty in getting this question answered.
Do you understand about Unicode I wonder? You need to compile your application with UNICODE and _UNICODE defined so that AfxMessageBox maps to AfxMessageBoxW, which is capable of displaying Chinese characters if and only if the default system font that it uses, (depends on XP or Vista etc) contains those characters.
Then you need to make sure that you are using wide character variables (wchar_t, TCHAR if UNICODE is defined) to both get the data form the clipboard and pass it to the message box so that you don't loose data along the way. That's if the clipboard is giving you wide character data in the first place. You might have to request a different format, or do conversion from a specific Chinese code page. Do you know about Code pages?
You can see that there is rather a lot going on here already and this may not be the end of the story as you're involving RTF as well. To get a more definitive answer you'll need to give better information on what you already understand and what you're actually doing, a few lines of code would be good, and be prepared to ask a series of smaller questions to get all the info you need.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
A non-Unicode program can display Chinese text in MBCS way. But two premises are required:
1. The system should be Chinese character set installed (for viewing with IE and other text applications).
2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.
Maxwell Chen
|
|
|
|
|
Indeed but I think in this case 1. is scuppered by the lack of a language pack and 2. can't be gaurenteed because the data is external input form the clipboard. It could contain anything.
Also MBCS is a minefield if you don't already understand Unicode and Code Pages. It's pretty treacherous even if you do
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
The lines last far too long, but the horizontal scroll bar does not show up. I can not reach the "Edit" button to modify the post.
Maxwell Chen
|
|
|
|
|
A non-Unicode program can display Chinese text in MBCS way. But two premises are required:
1. The system should be Chinese character set installed (for viewing with IE and other text applications).
2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.
Maxwell Chen
|
|
|
|
|
Hi friends,
I need to put two small buttons in the caption bar of file open dialog whenever the user invokes open dialog from any application ... Please tell me how can i do it?
Thanks in advance,
John.
|
|
|
|
|
The technique you need is called 'global subclassing', you'll need to look it up and proabably go through a couple of articles to get the hang of it. The file open dialog is designed to let you do this. The technique has different caveats and gotcha's on different Windows versions as well so you need to know what you're targetting. The good news it can definitely be done
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
How can I get the scaleline of the bitmap Image
Trioum
|
|
|
|
|
trioum wrote: How can I get the scaleline of the bitmap Image
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|