|
Hi!!
It has added to my project.
Very Nice!!
My personal computer OS was changed into Windows2000 from Windows98.
Windows98 is satisfactory.
It cannot be used in Windows2000.
It does not work when a dropdown button is pushing.
I propose it.
A supplementary code is added to CMultiColumnComboBox.cpp.
void CMultiColumnComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ASSERT(m_TotalColumn > 1);
CPen* OldPenPointer;
CDC* DeviceContextPointer = CDC::FromHandle(lpDrawItemStruct->hDC);
CWnd* DropDownWindowPointer = DeviceContextPointer->GetWindow();
BOOL IsHighLightText = lpDrawItemStruct->itemAction & ODA_FOCUS || lpDrawItemStruct->itemState & ODS_SELECTED;
CRect TextRectangle = lpDrawItemStruct->rcItem;
// **** Additional coding Start ****
if (DropDownWindowPointer == NULL)
{
if((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWN)
{
DropDownWindowPointer = GetWindow (GW_CHILD);
}
if((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWNLIST)
{
DropDownWindowPointer = GetWindow (GW_HWNDFIRST);
}
}
// **** Additional coding End ****
..............
Was it repaired this?
Can it be work on Windows2000 and Windows98?
:-DMy program does not have a problem.
By Hiromitsu Hotta
Thanks
Add Message:
When investigating the bulletin board well, Jason Good had shown previously.
I did not know.
It is the same idea.
Thanks Jason Good
|
|
|
|
|
good work.
but I have another problem , when draw down the box, the data can not be displayed correctly.
thanks,
|
|
|
|
|
Great!
Thanks
|
|
|
|
|
Hi
When I use the multicolumncombobox in XP with my
application using XP Visual Styles, the display for the combobox show all the items for the row selected in the edit box.
Basically if i select the combo, it will drop down the list
and i can select a row. After selecting the row, the edit box only displays the column of the row i wanted. Great.
Then i move my mouse over the combobox and it gets focus
automatically in XP using visual styles. As soon as it get focus the display changes to showing the entire row without
me clicking anything.
Another problem is when i click on the combo box and it
drops down the list, there is no headers. When i move my
mouse pointer over the second row, only then the headers appear.
I would be very grateful for any help.
Kevin
|
|
|
|
|
I modified the function :
void CMultiColumnComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
..............
if (lpDrawItemStruct->itemID != (UINT)-1)
{
//if (DropDownWindowPointer != this)
if (DropDownWindowPointer != this && DropDownWindowPointer != NULL)
{
.........
|
|
|
|
|
Before resizing the dialog, the combo works just fine. After resizing the dialog (the combo is just re-positioned), the dropdown list is displayed with zero height and the user can not see the rows (but can still scroll with up-down arrows). In case no reposition of the combo takes place with the resize of the dialog, then the aforementioned problem does not appear.
Any help shall be grreatly appreciated
|
|
|
|
|
Hi, this control is really great. Made anyone some improvements to change th columnwith interacively or automatically to match textsize ?
|
|
|
|
|
I can compile and run without errors, but my combo box only shows one column where it should show two, and it doesnt show column titles. I'm using it within a property page on windows XP using MFC 7.0. I'm using this code in OnInitDialog:
//m_EvalStatus is a CMultiColumnComboBox control
m_EvalStatus.FormatComboBox(2, 0, 1);
m_EvalStatus.SetColumnWidth(50, 50);
m_EvalStatus.SetColumnAlignStyle(DT_LEFT, DT_LEFT);
m_EvalStatus.SetColumnTitle("Column1", "Column2");
m_EvalStatus.AddRow("Test1", "Test2")
The dropdown box only shows 'Test1', and when I select that 'Test2' is shown in the edit box. How do I display both columns in the drop down box?
Any help is appreciated
|
|
|
|
|
Make sure your control is OWNERDRAW, Variable, has Strings.
patrick@michael-clarke.com
|
|
|
|
|
I added OnDblclk<widgetname>
That event is not posted, I don't know why...
Thanks for help
|
|
|
|
|
I could not even compile the project, got following errors:
--------------------Configuration: MCComboBoxSample - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
MCComboBoxSample.cpp
MCComboBoxSampleDlg.cpp
MultiColumnComboBox.cpp
C:\works\MCComboBoxSample\MultiColumnComboBox.cpp(142) : error C2666: '!=' : 2 overloads have similar conversions
C:\works\MCComboBoxSample\MultiColumnComboBox.cpp(165) : error C2666: '==' : 2 overloads have similar conversions
C:\works\MCComboBoxSample\MultiColumnComboBox.cpp(317) : error C2666: '!=' : 2 overloads have similar conversions
C:\works\MCComboBoxSample\MultiColumnComboBox.cpp(390) : error C2666: '!=' : 2 overloads have similar conversions
Generating Code...
Error executing cl.exe.
MCComboBoxSample.exe - 4 error(s), 0 warning(s)
Any HEEEEEELP is appreciated.
Thank,
|
|
|
|
|
Replace m_HeaderControl != NULL
with m_HeaderControl.m_hWnd != NULL
or something like that.
|
|
|
|
|
Thanks!
I encountered the same problem.
William
|
|
|
|
|
I have the same exact errors.
Jimmy
|
|
|
|
|
I've been using this control for almost 3 years now and for 2 of those, it has worked perfectly without any problems. As everyone knows by now, this control (as it was originally written) does not work in Windows 2000 (and I would imagine WinXP also), generating what used to be known as a "Dr. Watson" error when the user clicked on the drop-down arrow. After trying a couple of suggested fixes, I settled on one which seemed to work the best. Here's the code I used to replace the method used to obtain a pointer to the drop-down window in the DrawItem function:
if ((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWN)
DropDownWindowPointer = GetWindow(GW_CHILD);
if ((GetWindowLong(m_hWnd, GWL_STYLE) & 0x3) == CBS_DROPDOWNLIST)
DropDownWindowPointer = GetWindow(GW_HWNDFIRST);
This works great with one exception: If the right side of the drop-down exceeds the value of GetSystemMetrics(SM_CXSCREEN), the drop-down window is no longer moved to the left to prevent the right from going off of the screen. It seems that DropDownWindowPointer->GetWindowRect(WindowRectangle) returns a CRect which is relative to the dialog (property page, etc.) instead of being relative to the display. Therefore, when WindowRectangle.right is compared to GetSystemMetrics(SM_CXSCREEN), WindowRectangle.right is always less than GetSystemMetrics(SM_CXSCREEN) and therefore, the code which moves the window is never executed. Realizing this, I wrote some code which added the CRect.left values of the combo box and all its parents and then added this value to the WindowRectangle.right value. In my case, GetSystemMetrics(SM_CXSCREEN) returned 1152 and my total came out to be 1205. Using the original code from this point, the WindowRectangle was correctly offset by -13; however, to my surprise, the drop-down still did not move.
Does anyone out there have the same problem? If so, what did you do to fix it? Any help would be greatly appreciated.
Jason Good
|
|
|
|
|
Hi,
I have a version of your CMultiColumnComboBox ( I don´t know how old it is... ), and in Windows XP, when you drop down the list you have to pass the mouse over the items and then they are drawn ( if not it is shown empty).
Was this and old bug from that class ?, Thanks !
Braulio
|
|
|
|
|
Hello
Has anyone converted this class so it's compatible with PocketPC ?
|
|
|
|
|
This is purely esthetic, but the line of code that sets the text color uses COLOR_WINDOWTEXT when the control is disabled. I changed that to COLOR_GREYTEXT when the control is disabled and the control now displays the same as a normal combo when it is disabled.
The line of code is as follows
DeviceContextPointer->SetTextColor(GetSysColor(IsWindowEnabled() ? (IsHighLightText ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) : COLOR_WINDOWTEXT));
and I have changed it to
DeviceContextPointer->SetTextColor(GetSysColor(IsWindowEnabled() ? (IsHighLightText ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) : COLOR_GREYTEXT));
You can find this line in the DrawItem method of the class implementation file.
Chris Meech
|
|
|
|
|
when I use a UpdateData(FALSE)in a dialog through DDX_CBString,I can't see the string assigned at the edit of MultiColumnComboBox,It is NULL. Can anyone help me?
thanks in advance
ricky
|
|
|
|
|
I get this message after compiling on a Win 2000 machine and then trying to click on one of the drop downs. This error occurs immediately. Any ideas as to why?
Thanks
|
|
|
|
|
|
Even with the sample!
|
|
|
|
|
may i know how to incorporate a deletion function for the data in the comboboxs list
i tried to change the m_ColumnListItem. it reflected the list properly. but when i see the display it is not getting displayed properly. why?
Is there something to be done in the DrawItem function??
Thanks in advance
Regards
Jithu
Jithu
|
|
|
|
|
Check this out: http://www.exontrol.com/sg.jsp?content=products/excombobox
Mike
www.exontrol.com
|
|
|
|
|
Hi,
I think it´s not fear to add free advertisement inside a contribution.
The good combo that Xiao Wang gived to us is for free and with the source code. If you want to sell your things please spend your money on Marketing or whatever, if not some angry gurus at Codeproject, will begin to implement your controls for free with the source code... What do you think Chris or Nish or...
Bye !
Braulio
|
|
|
|