|
That's what struck me as odd. This VS2005 page shows it to take three arguments.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yep - CWnd::OnNotify[^]
I wonder which is true? I only have VS2005 Express so I can't test it
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Arg Now I see it - The OnNotify with 3 arguments is a virtual function that doesn't require
a message map entry. The ones in the link from Michael Dunn are for use with the more specific
ON_NOTIFY message map macros.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello all,
maybe is that the reason why i dont have any error when in dont make any message map entries!
That is what i dont know before!
I try to use this like in
http://www.codeproject.com/miscctrl/gridctrl.asp[^]
Here is:
BOOL CGridCtrlDemoDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
thanks to all for help!
regards
termal
|
|
|
|
|
Did you get it working?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
yes, it works, i only remove the macro ON_NOTIFY(...) and this works...
I didn't know that i dont have to call this macro?
But im now more confused as before, when should i use this OnNotify(..) with 3 paramethers, and when this one with two params?
I like to use my MFC Grid in virtual mode!
regards
termal
|
|
|
|
|
The virtual CWnd::OnNotify is called for every child notification. According to the document
TN061: ON_NOTIFY and WM_NOTIFY Messages[^], the default implementation checks the
message map for notification handlers.
The message map ON_NOTIFY lets you relate a specific notification code and control ID to a
specific function. Without using the ON_NOTIFY macro (just overriding OnNotify), you need to
extract this information yourself.
That's the difference.
Here's what the document states:
In general, you do not override OnNotify. Instead, you provide a handler function and add a
message-map entry for that handler to the message map of your owner window's class.
Make sense?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello Mark,
i can now use this OnNotify() like in MFC Grid Control from Chris Maunder, but one question is there!
Where are my own data, i use pGrid->InsertRow() and pGrid->SetItemText(); to add my data,
but now is there my sample message?
thanks
termal
|
|
|
|
|
hmm I'm not sure about that one. I've never used Chris' control
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
In my OnSize:
m_List.SetWindowPos(NULL,
m_rcOldList.left*(cx-m_rcOldWnd.left)/(m_rcOldWnd.right-m_rcOldWnd.left),
m_rcOldList.top*(cy-m_rcOldWnd.top)/(m_rcOldWnd.bottom-m_rcOldWnd.top),
m_rcOldList.left+(m_rcOldList.right-m_rcOldList.left)*(cx-m_rcOldWnd.left)/ (m_rcOldWnd.right-m_rcOldWnd.left),
m_rcOldList.top+(m_rcOldList.bottom-m_rcOldList.top)*(cy-m_rcOldWnd.top)/(m_rcOldWnd.bottom-m_rcOldWnd.top),
SWP_NOZORDER);
But the ListBox changes not very correctly,how should i convert the coordinates to make the change more precise? Thank you!
-- modified at 9:58 Wednesday 18th April, 2007
|
|
|
|
|
kingliub wrote: But the ListBox changes not very correctly...
Which means what? What exactly are you trying to do?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I can only guess from your description that the coordinates you work with are wrong. Make sure you use coordinates relative to you point of reference... see GetWindowRect(), ScreenToClient(), GetClientRect() .
|
|
|
|
|
I can sure the coordinates are right,but the methord I used to convert the coordinates is not very precise,which make the ListBox and the dailog`s proportion seem a little wrong. So can you give a more precise methord to locate the ListBox`s size and position? Thanks very much!
|
|
|
|
|
kingliub wrote: but the methord I used to convert the coordinates is not very precise
Please show the code, otherwise it is hard to help.
|
|
|
|
|
Now I have made it,I do like this:
CListBox m_List;// The ListBox;
CRect m_rcOldList;// The initialization WindowRect of the ListBox;
CRect m_rcOldWnd;// The initialization ClientRect of the Window;
OnSize(UINT nType, int cx, int cy)
{
m_List.SetWindowPos(NULL,m_rcOldList.left*cx/m_rcOldWnd.Width(),
m_rcOldList.top*cy/m_rcOldWnd.Height(),
m_rcOldList.Width()*cx/m_rcOldWnd.Width(),
m_rcOldList.Height()*cy/m_rcOldWnd.Height(),
SWP_NOZORDER);
}
This can work well,but there is still a problem, I want to define two variable:
int m_iPercentX;// The percent of the window`s client width has changed
int m_iPercentY;// The percent of the window`s client height has changed
OnSize(UINT nType, int cx, int cy)
{
m_iPercentX=cx/m_rcOldWnd.Width();
m_iPercentY=cy/m_rcOldWnd.Height();
m_List.SetWindowPos(NULL,m_rcOldList.left*m_iPercentX,
m_rcOldList.top*m_iPercentY,
m_rcOldList.Width()*m_iPercentX,
m_rcOldList.Height()*m_iPercentY,
SWP_NOZORDER);
}
But as you know, the m_iPercentX and m_iPercentY can`t be very precise, so the position of the ListBox will be a little wrong, how should I do? Thank you!
|
|
|
|
|
kingliub wrote: m_iPercentX and m_iPercentY can`t be very precise, so the position of the ListBox will be a little wrong
I see, this is a mathematical problem. Here a possible solutions, when calculating the position of a control don't throw away the fractions (of a pixel) and further resizing will be accurate. For an implementation see CResizeCtrl in method CResizeCtrl::CalcValue() plus bugfix!
Hope it helps.
|
|
|
|
|
I have written one program for which it needs Open SSL include directory. that I included in My projct written in C. Now I want to know what does the functions provided by the each header will do. Ofcourse I used a program which has been given in the Sun web site common to both C and Java, I want to know the definition especially for the function named BIO_ctrl() provided in bio.h header file.
Pruthvidhar Pendyala
|
|
|
|
|
Pruthvidhar wrote: Now I want to know what does the functions provided by the each header will do
While you may find someone here who is familiar with OpenSSL, it seems to me a much better
place to look is at the OpenSSL Website[^].
There's documentation there!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All,
I have a SDI application with multiple interchange-able CFormView's. My app does not disappear from the task panel when no dialogs are opened, but when I open a dialog and switch to another app in the task panel (with Alt + Tab of course) and then switch back to my app the opened dialog doesn't have the focus any more and my app's icon from the task panel simply disappears! So I can not longer switch to my app with Alt + Tab!
I don't have this problem when opening a standard MFC dialog like CFileDialog. So the problem is with my dialogs.
I managed to set the focus on the opened dialog when switching in task panel by handling ON_ACTIVATEAPP into the dialog's window but the icon in the task panel is nowhere to be seen!
Any ideas? Thanks!
Regards,
Cosmin Unguru
|
|
|
|
|
When you create the dialogs, try to make sure they have the main application window as their parent. If they do not, they are getting the desktop as their parent, explaining perhaps your strange behavior.
|
|
|
|
|
Is it a Modal dialog box or Modeless?
Cheers,
Suresh
|
|
|
|
|
They are all modal dialog boxes
Regards,
Cosmin Unguru
|
|
|
|
|
I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is:
0 0 0 0
0 1 2 3
0 2 4 6
0 3 6 9
This is what I have so far:
<br />
#include "stdafx.h"<br />
#include "pattern.h"<br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
<br />
using namespace std;<br />
CWinApp TheApp;<br />
<br />
<br />
<br />
int main()<br />
{<br />
int j;<br />
int i;<br />
int test_score[4][4];<br />
<br />
for(i = 0; i < 4; i++)<br />
{<br />
for(j= 0; j < 4; j++)<br />
{<br />
test_score[i][j] = 0;<br />
cout<< test_score[i][j];<br />
}<br />
<br />
cout<<endl;<br />
}<br />
<br />
<br />
return 0;<br />
} <br />
|
|
|
|
|
Well, you have put zero in all of the array values. What do you need now?
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.
|
|
|
|
|
klutez123 wrote: all i was given was that i need to put a loop inside of a loop.
I agree.
klutez123 wrote: test_score[i][j] = 0;
cout<< test_score[i][j];
Study these two statements carefully. What does it look like they are doing? Do you see anything that would look like it would produce the "chart" you are after?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|