|
vgrigor wrote:
but can I prohibit routing check for some menu Item?
No. A handler is always called for each control identifier.
vgrigor wrote:
CCmdUI::m_bContinueRouting - what does ?
Allows multiple ON_UPDATE_COMMAND_UI() handlers to be called for a single control identifier. It is not used for preventing handlers being called.
vgrigor wrote:
It is also low probably that microsoft not proposed some or two methods of hanling any user item...
It might be a low probabilty, but they have
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Allows multiple ON_UPDATE_COMMAND_UI() handlers to be called for a single control identifier. It is not used for preventing handlers being called
- probably.
But I can not understand your sure that
method and keywords:
pFilterMenu->EnableMenuItem(ID_BT_AL_RISED, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
is created to not work ??
|
|
|
|
|
vgrigor wrote:
pFilterMenu->EnableMenuItem(ID_BT_AL_RISED, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
is created to not work ??
It works for popup menus, but not for the menus attached to windows. It would work for menus attached to windows if you overrode WM_INITMENU and WM_INITMENUPOPUP and prevented the default processing and overrode OnIdle() in your application class and prevented the default processing. I wouldn't recommend doing this though, because it may break other parts of the program.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I tried at:
void CAlarmWnd::OnUpdateFrameMenu(HMENU hMenuAlt)
I will try as
void CAlarmWnd::OnInitMenu(CMenu* pMenu)
{
CFrameWnd::OnInitMenu(pMenu);
GetMenu()->GetSubMenu(1)
->EnableMenuItem(ID_BT_AL_RISED, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
// TODO: Add your message handler code here
}
_____________________
and -not works.
Surely - such a method must be presented - for any kind of menu
(or any pixel) - so is design of MFC.
|
|
|
|
|
works if to change to BY_POSITION action
GetMenu()->GetSubMenu(1)
->EnableMenuItem(postion, POSITION | MF_DISABLED | MF_GRAYED);
|
|
|
|
|
what is a message identifier?
ranjani
|
|
|
|
|
Hi,
MSDN say
==
message identifier
A unique value that identifies a message. System-defined messages use named constants, such as WM_PAINT, as message identifiers. Windows CE reserves message-identifier values in the range 0x0400 through 0x7FFF for application-defined messages.
==
Vitali
|
|
|
|
|
hello ranjani
In modular programming like C++ and VC++ the control o fprogram passes from one area to another based on certain conditions . usually u do it with goto function in C but here in OOPS the control transfers from one line to another by message ids . ie when the user clicks on a menu a message like WM_COMMAND(menuitem , handler) -- here the first param in the WM_COMMAND is the menu item which the user clicked and the second item is the function name which will be fired once the message is fired . So U write whatever u want to do in the menu item here inside the handler that way the control of program gets transferred to the handler function . also other type of messages are also there like
system messages like WM_CLOSE , ON_FILE_OPEN like that but the handlers r already written for them . another type is POST_THREAD_MESSAGE ( MESSAGE) here the message can be posted by any object of a Class CWinThread and the handler function can be written for this mesasge also as mentioned above . hope u will find more info from msdn ( clumsy huh??) dharanibabus@hotmail.com
|
|
|
|
|
Hi there,
I need to select multiple files in an openfiledialog in MFC, but I use this:
CFileDialog *cfd=new CFileDialog, true, ...., NULL, OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT, .... , NULL)<br />
<br />
CString x;<br />
cfd->DoModal();<br />
x=cfd->GetPathName();<br />
How can I convert this code to get more then one file???
|
|
|
|
|
Hi student
To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.
Vitali
|
|
|
|
|
Talik wrote:
Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.
I don't understand this part (I've read it to in the MSDN); that's why I put it on CP. Can you give me some code, jsut for initializing the buffer, and filling it with those files?
|
|
|
|
|
Dear BoudewijnEctor,
Look at the following link with full src code and sample:
http://www.codeproject.com/dialog/PJA_MultiSelect.asp
Vitali
|
|
|
|
|
|
Try these two previous discussions:
http://www.codeproject.com/script/comments/forums.asp?msg=574273&forumid=1647&mode=all&userid=52727#xx573787xx
http://www.codeproject.com/script/comments/forums.asp?msg=574178&forumid=1647&mode=all&userid=52727#xx573924xx
|
|
|
|
|
Hi,I am a beginner in MFC of VisualC++.now i have a problem to be solved.
Somebody can help me?
I want to draw some text in CEditView via DrawText function,but it display nothing on CEditView.
some code below:
void CTPlatformView::OnDraw(CDC* pDC)
{
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rect;
GetClientRect(&rect);
pDC->DrawText("hello",&rect,DT_LEFT);
}
Thanks!!
|
|
|
|
|
Hi,
Look what MSDN say about:
==
virtual int DrawText( LPCTSTR lpszString, int nCount, LPRECT lpRect, UINT nFormat );
...
This member function uses the device context’s selected font, text color, and background color to draw the text. Unless the DT_NOCLIP format is used, DrawText clips the text so that the text does not appear outside the given rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is given.
If the selected font is too large for the specified rectangle, the DrawText member function does not attempt to substitute a smaller font.
If the DT_CALCRECT flag is specified, the rectangle specified by lpRect will be updated to reflect the width and height needed to draw the text.
==
Hope, now youself can do checks and find answer.
Vitali
|
|
|
|
|
Thank you Vitali!
if i let CMyView to derive from CView,it can directly display "hello".but it cann't if derived from CEditView.
why?
|
|
|
|
|
Check under debugger what values have settings pointed above
in the first and second variants.
hope it will help.
Vitali
|
|
|
|
|
I think you should use the GetEditCtrl () method to acces the CEdit object associated with the CEditView . Then write text in the CEditView just like you were using CEdit .
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
OnDraw() doesn't get called for a class derived from CCtrlView , such as CEditView . You have to do it in OnPaint() .
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,Ryan Binns and all of you
Thank you very much! I've solved it via OnPaint() function.
|
|
|
|
|
Hi,
I've created a directory selection dialog (thanks to some people here at CP), but I thought it's nice to have some of creating a folder from this dialog. I you can't, you have to creat one yourslef, using explorer. I know how to create a folder in MFC, but you can use that function from the dialog!
Help me please,
|
|
|
|
|
Why can't you create a folder? What is happening?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
No,
I just need to get a button (called new directorie, or something) to create a new directory, without having to rewrite this diialog.
So, do you know wether there is some kind of flag to enable this sort of feature?
|
|
|
|
|
What dialog are you using?
A standard one or a homegrown dialog?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|