|
prithaa wrote: But can I make Message map of the form MY_MESSAGE and have a handler function OnMyMessage ?
Yes, but not with ClassWizard. You need to modify BEGIN_MESSAGE_MAP manually, outside of the //}}AFX_MSG_MAP comment.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
prithaa wrote: How to send/post a message to the parent view window
Views should not know about one another. They should communicate to the "Controller" as in Model-View-Controller
In the MFC Framework you can send messages to Views using CDocument::UpdateAllViews(...). If not using MFC you should have your own MVC design.
led mike
|
|
|
|
|
Hi,
What is MVC design?
Thanks
Prithaa
|
|
|
|
|
|
Hello
I´m trying to do this :
A user starts to write his username in an editcontrol, and as he types
Im searching in a database finding any coincidences with other data I have...
If found one i will show it in other editcontrol else I will disable it.
So at what event from the editcontrol should I put my code?
EN_UPDATE ?
EN_CHANGE ?
or this is not the best way..?
thx in advance...
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
Hi,
I'm not sure what the appropriate events / method is to use but in JavaScript I use onKeyPress and filtering thought the database.
Can't think of anything else....
Hope this might spark something in your brain .... lol ....
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
|
thx
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
it will work but might not be practical if the search in the DB takes a long time.
user types "a" waits for a few seconds, user types "c" waits for a few seconds, user types backspace because he wanted to type "v" instead, waits a few seconds, user types "v" ...
|
|
|
|
|
Maximilien wrote: it will work but might not be practical if the search in the DB takes a long time.
I agree. That's why I chose EN_CHANGE - at least the user will see the character typed before
it goes off and searches
|
|
|
|
|
can't you try both and see which one fits you best ?
also, reading the MSDN about those events may help !
|
|
|
|
|
Im on it testing both, just wanted to know a better way.
thx
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
jarleydg wrote: So at what event from the editcontrol should I put my code?
EN_UPDATE ?
EN_CHANGE ?
The former is sent before the control us updated, whereas the latter is sent after.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
how to write the code,if want to make hourglass cursor during process thread function.
|
|
|
|
|
You obviously know that CWaitCursor exists, so what exactly is the problem?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
If your using VS 2005 I would advise the following:
<br />
Namespace: System.Windows.Forms<br />
Assembly: System.Windows.Forms (in system.windows.forms.dll)<br />
<br />
Cursors::Default;<br />
Cursors::Hand;<br />
Cursors::HourGlass;<br />
else try this:
<br />
<br />
void LengthyFunction( )<br />
{<br />
<br />
CWaitCursor wait;
<br />
<br />
}
<br />
<br />
void ConditionalFunction( )<br />
{<br />
if ( SomeCondition )<br />
{<br />
CWaitCursor wait;
<br />
<br />
}
else<br />
{<br />
}<br />
}<br />
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
I try thease code.
it don't work..
void CThread1Dlg::OnOK()
{
AfxBeginThread(Thread,this);
}
UINT Thread(LPVOID pParam)
{
CWaitCursor wait;
CThread1Dlg *m_dlg = (CThread1Dlg*)pParam;
for (int i=0;i<200;i++)
{
Sleep(20);
}
TRACE("Finish");
return TRUE;
}
|
|
|
|
|
Max++ wrote: it don't work..
Which tells us a whole lot.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
As you've discovered, CWairCursor won't work in a separate thread.
If you look at CWaitCursor, all it does is call SetCursor, and then restore your old one when its destructor is called.
If its in the same thread as the message pump (99.(% the main thread), then no messages are processed, including WM_MOUSEMOVE & WM_SETCURSOR.
If its in a separate thread, then the first time WM_SETCURSOR is processed, your cursor will be reset.
The solution is to override WM_SETCURSOR / OnSetCursor in your main program, or view (as appropriate).
BOOL CMyWndOrView::OnSetCursor (HITTYPE ht, CPoint pt)
{
if (ht == HTCLIENT && m_bMyThreadIsActive)
{
SetCursor (m_hMyThreadyCursor)
return TRUE;
}
else
return CWndParentClass:OnSetCursor (ht, pt);
}
This is off the top of my head - check the function prototype using MSDN, and you may also need to create the window class using a NULL cursor. See OnPreCreateWindow for MFC.
I hope this guides you in the right direction....
Iain.
|
|
|
|
|
I'm currently using a dialog based application. May i know how do i open a file or link to the file by just selecting one of the items listed in the combo box?
For example, my program is to test IC. The combo box will contain different type of IC. Therefore, by choosing one of the items listed in the combo box, i will be able to send appropriate data to the hardware to do the testing process. So, is there anyone who may advice me on how to link the appropriate file corresponding to the chosen item in the combo box?
Thanks.
|
|
|
|
|
Hi,
Have you tried using the onclick event of the combo box? (I'm assuming you are using VS 2005).
Hope this might help you
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
i'm using visual studio 6.0. Do you know any related examples i can refer to.
thanks in advance
|
|
|
|
|
Are you handling the CBN_SELCHANGE notification? If so, in that handler function, use the GetCurSel() and GetLBText() methods.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Do you have any related examples that i can refer to. I'm still a beginner at this. so if yes, thanks alot
|
|
|
|
|
Use ClassWizard (Ctrl+W) to create a handler function for the CBN_SELCHANGE notification. In that handler function, call GetCurSel() and GetLBText() , like:
void MyDialog::OnSelChange()
{
int nIndex;
CString strText;
nIndex = m_combo.GetCurSel();
m_combo.GetLBText(nIndex, strText);
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|