|
hi guys,
I m very new to using VC++.Can anybody tell me how can i add property pages to a dialog box, so that all the other controls also remain in place.
Aarti Vimal
Scientist 'B'
Defence research & Development Organisation,
Bangalore,
Karnataka,
India.
|
|
|
|
|
Describe more on what you are trying to accomplish.
Kuphryn
|
|
|
|
|
Hi guys,
I have a CListCtrl control inserted to my dialog app (MFC). I needed to customise the text display on the control and from Michael's suggestion (Thanks, Mr. Dunn!), I tried using LVN_GETDISPINFO message, which calls my OnGetDispInfo function. The problem is that the callback doesn't seem to get call when already using LPSTR_TEXTCALLBACK .
The message map is created as below:
<code>
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetDispInfo)
and the callback function is decalred in my CMyDlg class.
<code>
afx_msg void OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult);
I add items to the control (m_TaskList) using the way below:
<code>
m_TaskList.InsertItem(LVIF_TEXT|LVIF_STATE, itemCount, LPSTR_TEXTCALLBACK, LVIS_SELECTED, LVIS_SELECTED, 0, 0);
and the following callback function is never called,
<code>
void CMyDlg::OnGetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
if (pDispInfo->item.mask & LVIF_TEXT)
pDispInfo->item.pszText = _T("Testing");
*pResult = 0;
}
Can anyone spot where I have done wrong?
Thanks alot
|
|
|
|
|
What change?
You have to explicitly notify the list control upon a change. One example is LVM_INSERTITEM.
Kuphryn
|
|
|
|
|
Thanks for the reply Kuphryn,
I'm not quite sure if I understand what you mean. In MFC, when I'm calling InsertItem() on the CListCtrl control, it euqally means sending the notification LVM_INSERTITEM to the control. Doesn't it?
Thanks again.
|
|
|
|
|
You're not receiving the LVN_GETDISPINFO message, correct? I'm saying that you have to update the list control via sending its a message if you want to to make the change.
Kuphryn
|
|
|
|
|
Doesn't the call
<code>m_TaskList.InsertItem(LVIF_TEXT|LVIF_STATE, itemCount, LPSTR_TEXTCALLBACK, LVIS_SELECTED, LVIS_SELECTED, 0, 0);
mean sending a message (LVM_INSERTITEM) to the control and update it according to specified information?
LPSTR_TEXTCALLBACK tells the control the text is a callback item, so will call OnGetDispInfo()
Why do I have to explicitly send message to the control again? Am I missing something?
Thanks again
|
|
|
|
|
Don't use ON_NOTIFY_REFLECT. That macro would be used if you were trying to do this in a class that was derived from CListCtrl. Since you are catching this message in a dialog (I suppose, based on the name CMyDlg), use ON_NOTIFY.
Good luck,
Chris Richardson
|
|
|
|
|
Thanks Chris,
that works for me
|
|
|
|
|
How to intercept a WM_LBUTTONDOWN on the drop-down list of a combo box?
Without using sucky MFC.
Bikram Singh
|
|
|
|
|
would have loved to answer, but i dont care to experiment with SDK-programming. SDK-programming sucks big time. Stop using it dude! Give MFC a try, and you'll never come back to SDK-programming for any of your UI-related tasks. Infact, the only reason SDK is good is: none... Thats it. From a professional programmers perspective.
*laughter*
|
|
|
|
|
Good for you. I dont use SDK programming except for "lower-level" tasks such as this. I assure you, if you use C++ Builder once, you would probably know why I think MFC sucks.
Bikram Singh
|
|
|
|
|
Well, you said "without using MFC". Do you think this is a C++ Builder forum?
Now, as you don't seem very experienced, let me explain a few things:
MFC is a framework. You can use MFC with MSCVC++, but also CodeWarrior and the old Borland C++.
C++ Builder is a development environment. I don't know the name of the current underlying framework - in the pre-Builder days, it was OWL. VCL, perhaps?
Comparing the development environments, C++ Builder (which I have not used) was loosely built on Delphi, (which I have used). Delphi is a RAD-tool, and if you have difficulties with other development tools, you might want to stay with C++ Builder, and ask questions in appropriate foras. I'm sure that there are newsgroups targetted specifically to C++ Builder.
But of course, you are what is commonly called a troll, which I am - sad to say - currently feeding.
To summarize, my suggestion is that you either get a life, or haunt foras where you will actually get some answers. I have used more development environment than you can comfortably shake a stick at, so I think I'll leave your puerile suggestion where it belongs
|
|
|
|
|
Johan Rosengren wrote:
Do you think this is a C++ Builder forum?
Does the board say "Visual C++" or does it say "MFC"? Or cant you read?
Johan Rosengren wrote:
But of course, you are what is commonly called a troll, which I am - sad to say - currently feeding.
I guess you get your kicks out of abusing people. You obvisouly have a rigid mindset. I said "sucky MFC" not "sucky Mr. X so-and-so".
You need to grow up.
And finally,
Stop Flaming. Stick with the program.
Bikram Singh
|
|
|
|
|
bikram singh wrote:
Does the board say "Visual C++" or does it say "MFC"? Or cant you read?
I explained the difference between MFC and C++ Builder - which you seem to have gotten mixed up.
bikram singh wrote:
I guess you get your kicks out of abusing people.
Where did I abuse you?
bikram singh wrote:
You need to grow up.
And finally,
Stop Flaming. Stick with the program.
I'll leave this speaking for itself
|
|
|
|
|
|
|
Will handling CBN_DROPDOWN help?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yes, that would be the starting point I know, but i am unable to capture any mouse-events on the drop-down listbox itself...
Bikram Singh
|
|
|
|
|
Would CBN_SELCHANGE help? That notifies you when the active selection in the dropdown list changes. You get another notification (CBN_SELENDOK or CBN_SELENDCANCEL , depending on whether the user made a selection or pressed Esc) when the listbox closes.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
That doesnt work either
The only notification I'm getting on the dropped-down listbox is WM_CTLCOLORLISTBOX, which I get each time I do a mouse-over on an item.
Nothing else! I can "capture" a right-click on an item, using GetKeyState(VK_RBUTTON), but that only works bcos I change the item-selection while keeping the R button pressed, which causes a WM_CTLCOLORLISTBOX message , in which I call GetKeyState() as above.
But this isnt a solution for me!
Spy++ shows no messages except WM_CTLCOLORLISTBOX
And thank you for helping out !
Bikram Singh
|
|
|
|
|
Ultimately, I had to subclass the combobox' listbox.
Was wanting to avoid doing it though. But well, if you cant fight em join em i guess!
Bikram Singh
|
|
|
|
|
hi: all
my program is based on dialog,but i want to add menu for it, i insert a menu resource and with the instruction of classwizard select associate the menu with my dialog,but when i do this ,once runing i found no menu on dialog,why , please lend me a hand.
thx
|
|
|
|
|
would have loved to answer, but i dont care to experiment with MFC. MFC sucks big time. Stop using it dude! Give C++ Builder a try, and you'll never come back to VC++ for any of your UI-related tasks. Infact, the only reason VC++ is good is: fast "code-completion". Thats it. From a programmers perspective.
Bikram Singh
|
|
|
|
|