|
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
|
|
|
|
|
It's very good,but,I think it can change to flat?
please help me.
|
|
|
|
|
Used CMultiColumnComboBox in a dll and binded with dropdown-ownerdraw-variable-hasstring CCombobox, with DDX_CONTROL and a CString with DDX_CBString to handle the edit text, but it is critical to get the right content current in Edit box....updated some codes, then some comboboxes still can handle it correctly, but somes of them just got null strings.....lost the idea where I made the problem?
any help would be appreciate, how can I handle those edit content more sure and safety? will try to modify CMultiColumnComboBox slightly to get it, but, or, could it's caused because of some fault I never noticed with my application?
thanks in advance
Paul
|
|
|
|
|
I have a situation where I have setup a three column MCC such that there are multiple strings for column one that are the same, mulitple strings for column two are the same, and multiple strings for column three are the same. No matter what values I pass to FormatComboBox for the bound column and show column, after selecting an entry, when you next click for the drop down, it will be an incorrect entry that is high lighted in the drop down list. For an example consider a database table that has three columns titled Country, State, and City. The combination of all three will make a unique entry, but a list of all countries will certainly have duplicates, as will a listing of all states or cities. I tried to understand the code that high lights an item in the drop down list, but it was not clear how the list item id was determined. Whatever it is, I think the logic has difficulty dealing with duplicates in the bound column.
As an aside, I also discovered that if you pass a number for bound column to the FormatComboBox routine that is greater than the number of columns, in Debug mode you get an assertion failure of trying to subclass a window twice. I think somehow the CComboBoxEdit member trys to get subclass'ed twice.
Thanks.
Chris
|
|
|
|
|
Occasionally I have a problem whereby the column separators are askew i.e. the column widths of some rows are different than others! This only happens when running a release-built .exe. It doesn't happen when running from within Visual Studio. Can anyone help?
NH
|
|
|
|
|
I have downloaded the new version and tried adding Column header. Column header shows up nicely. Now if I select a particular item from the drop down list and pull up the drop down list again, scrolling to the selected item does not happen. Well, if I scroll down using mouse it shows the selection. However, this problem does not occur if I don't show the column header [i.e. if I don't use the function SetColumnTitle(...)]. Does anyone have any clue !
|
|
|
|
|
This control has been a great one for me. If you have upgraded to Win2K you can find a fix for this control at www.codeguru.com. I've modified this control to be able to edit the contents of a dropdown lists column in the edit box and have the dropdown list reflect the edit. In case anyone is interested.
Steve P.
|
|
|
|
|
By the way, a wonderful control -- thank you for providing it.
I am having a problem however, my combobox has 2 columns and 7 rows of data. I want the data from the first column to be displayed in the text box so I used 2,1,0 as the parameters for FormatComboBox(). This is what happens:
When I click on the last row it will not display in the text box.
After selecting either rows 5, 6, or 7 and then clicking on the text box's down arrow, the text in the text box instantly shows the data from the second row. I can still click on other rows and their data will display but a subsequent click on the text box's down arrow changes the text box contents immediately. That shouldn't happen until I select a row.
Any idea what's going on here or has anyone else seen this behavior? I have similar types of strange behavior for all combinations of arguments to FormatComboBox()
|
|
|
|