Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
...but virtual PreSubclassWindow is already implemented in the code we download. ...
Perhaps...
But you haven't shown yet how exactly it is declared/defined in *your* project ...
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
...but virtual PreSubclassWindow is already implemented in the code we download. ...
Perhaps...
But you haven't shown yet how exactly it is declared/defined in *your* project ...
Re: Create Combobox with ToolTips
Of course I cannot post my code here because my company has rights on it. Anyway the code is more or less this:
Code:
CTooltipComboBox *pCombo = (CTooltipComboBox*)GetDlgItem( IDC_... ); // IDC_.... resource index of my combo
for( number of combo items )
{
pCombo->AddString( combo item name );
pCombo->SetItemTip( counter, tooltip text );
}
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
Of course I cannot post my code here because my company has rights on it. Anyway the code is more or less this:
Code:
CTooltipComboBox *pCombo = (CTooltipComboBox*)GetDlgItem( IDC_... ); // IDC_.... resource index of my combo
for( number of combo items )
{
pCombo->AddString( combo item name );
pCombo->SetItemTip( counter, tooltip text );
}
Are you kidding? :confused:
Where are the decaration/definition of PreSubclassWindow that "is not automatically called"?
Besides, why are you using GetDlgItem? didn't you implement the control member variable for your combobox? :confused:
Re: Create Combobox with ToolTips
Declaration/definition of PreSubclassWindow are in CTooltipComboBox.h/.cpp
Anyway, I've always used GetDlgItem instead of a control variable... I think it's the same...
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
Anyway, I've always used GetDlgItem instead of a control variable... I think it's the same...
I don't care what you have "lways used".
But my question is: do you only "think it's the same" or you are sure?
And how about the article you referred to:
Quote:
To use this combo box, follow the following steps:
- Include TooltipComboBox.h, TooltipComboBox.cpp, TooltipListCtrl.h and TooltipListCtrl.cpp in your project.
- In the resource editor create a droplist combobox.
- Create a control member variable for the combobox in VC's classwizard.
- Include TooltipComboBox.h and replace CComboBox with CTooltipComboBox in your .h file. Also include afxtempl.h to support CMap.
- To have your own tips, you can either use SetItemTip, SetComboTip functions, or replace GetItemTip function in CTooltipListCtrl, and GetComboTip function in CTooltipComboBox.
Re: Create Combobox with ToolTips
Ok, I'm trying to create a control member variable...
I use VS2010 => Class View => I find my dialog class => right click => then? (is this the right procedure?)
Re: Create Combobox with ToolTips
Re: Create Combobox with ToolTips
Ok... got it, now the application doesn't crash anymore (and I hit the breakpoint inside PreSubclassWindow()!) but now AddStrings() is no more working: I created an empty combo... I'm going to investigate...
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
... now AddStrings() is no more working: I created an empty combo...
What is AddStrings() and how do you call it?
Re: Create Combobox with ToolTips
Sorry, typo error, I mean CComboBox::AddString() (without "s")
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
Sorry, typo error, I mean CComboBox::AddString() (without "s")
Well, how, when, and where from do you call it?
Re: Create Combobox with ToolTips
Post #18 (of course without initial GetDlgItem()...)
That code is into MyDialog::OnInitDialog()
Re: Create Combobox with ToolTips
Quote:
Originally Posted by
symreds
Post #18 (of course without initial GetDlgItem()...)
Isn't copy/paste the actual code snippet easier for you than typing in this sentence? :confused:
Quote:
Originally Posted by
symreds
That code is into MyDialog::OnInitDialog()
Well, it can be everywhere, but it doesn't help us to see it!