|
cs = s.c_str(); should work.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hi!
I've got a listbox (MFC app), and when i doubleclick on it i'd like to open a popupmenu.
I've got the CMenu popupMenu in my view class as a private atribute
this is the function:
void CJmnView::OnDblclkListContactos() <br />
{<br />
popupMenu.CreateMenu();<br />
popupMenu.LoadMenu(IDR_MENU_POPUP_CTACTOS);<br />
popupMenu.TrackPopupMenu(0, 100, 100,this);<br />
}
when i doubleclick on an item of the list i've got a Debug Assertion Failed! error.
any ideas?
another thing, there aren't many events for the listbox... for example, there is no onrightmousebuttonclick or something like that.
thanks!
|
|
|
|
|
kfaday wrote:
when i doubleclick on an item of the list i've got a Debug Assertion Failed! error.
any ideas?
And that assertion would be?? Have you looked at the line of code in question to see why the assertion is firing?
Is there a design reason why double clicking, instead of a right-click, brings up a menu?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i could fix the assertion.
DavidCrow wrote:
Is there a design reason why double clicking, instead of a right-click, brings up a menu?
in classwizzard, when i go to the list control, there are only 6 or 7 messages, and there isn't onrightclick.
now i've got another problem, i can see the pop up menu, but when i click anywhere else and it 'closes', if i doubleclick again it gives me another assertion error. here's the funtion:
<br />
void CJmnView::OnDblclkListContactos() <br />
{<br />
popupMenu.LoadMenu(IDR_MENU_POPUP_CTACTOS);<br />
CMenu* subMenu = popupMenu.GetSubMenu(0);<br />
<br />
CPoint ptPopup;<br />
GetCursorPos(&ptPopup);<br />
<br />
subMenu->TrackPopupMenu(TPM_LEFTALIGN, ptPopup.x, ptPopup.y, this);<br />
}<br />
<br />
|
|
|
|
|
kfaday wrote:
in classwizzard, when i go to the list control, there are only 6 or 7 messages, and there isn't onrightclick.
Sure there is. It's the NM_RCLICK notification. You might need to visit the Class Info tab first and make sure the Message filter: combobox has the correct item selected. Some messages/notifications come and go depending on that value.
kfaday wrote:
...it gives me another assertion error.
So what is the assertion that is firing?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm only able to see:
LBN_DBLCLK
LBN_ERRSPACE
LBN_KILLFOCUS
LBN_SELCANCEL
LBN_SELCHANGE
LBN_SETFOCUS
it doesn't matter what i select from the combobox.. i tried all combinations. i'm using vc++6.0
|
|
|
|
|
Those are listbox, not list control, notifications. You need to handle the WM_RBUTTONUP message for that control.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
would you mind telling me where could i read how to do that?
thanks!
|
|
|
|
|
Search MSDN for WM_RBUTTONUP and OnRButtonUp() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
i use visual C++.Net.
at starting a new form is formed automaticaly that's name is Form1.
but after i form the second form that is Form2, i cannot reach any variable or function in Form1.
since i write #include "Form2.h" in Form1.h so i can use any variable or function in Form2 but i don't write #include "Form1.h" in Form2.h so i cannot reach things that is in Form1.
when i write #include "Form2.h" in Form1.h and #include "Form1.h" in Form2.h after this the compiler give an error that is "multiple defined variables and functions".
so how can i reach the Form1 from Form2.
|
|
|
|
|
Look at the top of a .h file that ClassWizard creates. Notice that it adds both #if !defined and a #pragma once preprocessor directives. Those are to keep the file from being included more than once.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I need to inverts a rectangle. My drawing code is based on Gdi+, and Gdi+ doesn't provide any function to do this. so i used Windows API function ::InvertRect.
It works fine when direct draw to screen, but when i used double-buffer, the result was wrong. here is the code:
void CTestView::OnDraw(CDC* pDC)
{
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rc;
GetClientRect(&rc);
Bitmap bmp(rc.Width(), rc.Height());
Graphics* pGraphics = Graphics::FromImage(&bmp);
SolidBrush brush(Color(255, 255, 255));
pGraphics->FillRectangle(&brush, rc.left, rc.top, rc.Width(), rc.Height());
HDC hdc = pGraphics->GetHDC();
CRect rc1;
rc1.left = m_pt.x;
rc1.top = m_pt.y;
rc1.right = rc1.left + 10;
rc1.bottom = rc1.top + 10;
::InvertRect(hdc, &rc1);
pGraphics->ReleaseHDC(hdc);
Graphics g(pDC->GetSafeHdc());
g.DrawImage(&bmp, Point(0, 0));
delete pGraphics;
}
What's wrong?
|
|
|
|
|
Hi,
Is there a way to programatically add an icon for a contact ( in MS Outlook )?
Ex: for a contact which has an icq email address to put the icq icon.
Thanks
|
|
|
|
|
|
my application looks like
http://www.treetops.com.sg/before.jpg
when I fill an IC in patient IC textbox and click search button, it's supposed to query database and show what found in the right hand side listview. Everything seems ok by using mouse click, however if I want to use keyboard 'Enter' instead of mouse click what happen is all controls in this 'Patient Infomation' tab dispear:
http://www.treetops.com.sg/after.jpg
I have to manually switch to other tab then switch back, controls in Patient Infomation will appear. Anybody encountered this kind of problem before?
|
|
|
|
|
Well, I think you have for each tab a dialog and only one of them at a time is visible.
Normally, dialogs have an "OK" and a "Cancel" button. If you only delete them, the functionality still is in the dialog and "Enter" or "Esc" will close your dialog.
To avoid this, you should override (implement) the "OnOK" and "OnCancel" functions, but without calling its parent functions.
void CMySubDialog1::OnOK()
{
//CDialog::OnOK();
}
void CMySubDialog1::OnCancel()
{
//CDialog::OnCancel();
}
This should solve your problem.
|
|
|
|
|
Its sounds as though the Search button is not the default button. Does the property sheet have an OK button?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does anyone know if there's a relatively easy way of inserting the VERSIONINFO data into a C++ comment. I want to annotate my changes with the current build number. Any ideas?
Many thanks,
Robert Pickford
|
|
|
|
|
Robert Pickford wrote:
Does anyone know if there's a relatively easy way of inserting the VERSIONINFO data into a C++ comment.
Do you mean at compile time or run time?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I actually mean at edit time. What I really want is a Visual Studio add-in or macro that inserts a comment like:
.... // Modified R A Pickford [02-Jun-2004 Build 2108]
Doesn't have to be exactly that format but it's getting the build number in that is foxing me at the moment. I may have to write my own addin.
|
|
|
|
|
Robert Pickford wrote:
...but it's getting the build number in that is foxing me at the moment.
Isn't that number determined by you?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes and no. I use VERSIONINFO and increment the Build number on every major release build so I wanted to automatically put that number into my comments.
|
|
|
|
|
Use a version control package. Then consult the documentation for that package. In CVS you can use
/* $log$
*
*/
to place your change comments in the code, but if you don't use CVS that isn't helpful. There are other things too that you can add, some of which are suitable for assigning to a variable so you can manipulate the version in code.
|
|
|
|