|
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()
|
|
|
|
|
I would like to know how can I display multiple records on any dialog box.Can I use Listview control to bind to the table in the oracle database?
if not how to show on the front-end from the oracle database at the front-end.In VB what I asked is simple thing using DBGrid Controls or MSFlexGrid Controls.
Waiting for your suggetion
V.Subramanyam
|
|
|
|
|
|
Here is a little bug ( and also a fix ):
If you select the last ( or first ) visible item in the listbox and move the mouse down ( or up ), all the items that scrolled into the listbox are marked selected and have a focus-rectangle.
Here is a fix that worked for me:
void CMultiColumnComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ASSERT(m_TotalColumn > 1); //You can use CComboBox class instead of this class
CPen* OldPenPointer;
CDC* DeviceContextPointer = CDC::FromHandle(lpDrawItemStruct->hDC);
CWnd* DropDownWindowPointer = DeviceContextPointer->GetWindow();
// BOOL IsHighLightText = lpDrawItemStruct->itemAction & ODA_FOCUS || lpDrawItemStruct->itemState & ODS_SELECTED;
// added te
bool bHasFocus = lpDrawItemStruct->itemState & ODS_FOCUS ? true : false;
bool bIsSelected = lpDrawItemStruct->itemState & ODS_SELECTED? true : false;
//
CRect TextRectangle = lpDrawItemStruct->rcItem;
DeviceContextPointer->SetTextColor(GetSysColor(IsWindowEnabled() ? (bIsSelected ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT) : COLOR_WINDOWTEXT));
DeviceContextPointer->SetBkColor(GetSysColor(IsWindowEnabled() ? (bIsSelected ? COLOR_HIGHLIGHT : COLOR_WINDOW) : COLOR_3DFACE));
DeviceContextPointer->FillRect(TextRectangle, &CBrush(DeviceContextPointer->GetBkColor()));
// changed te
if( true == bHasFocus /*IsHighLightText*/){
DeviceContextPointer->DrawFocusRect(TextRectangle);
}
if(lpDrawItemStruct->itemID != (UINT)-1)
{
if (DropDownWindowPointer != this) //Draw items in drop down list
{
if (TextRectangle.top == 0 && m_ComboBoxStyle != CBS_SIMPLE)
{ //Only "dropdwon" & "drop list" combo box can move their drop down window
CRect DropDownWindowRectangle;
DropDownWindowPointer->GetWindowRect(DropDownWindowRectangle);
if (DropDownWindowRectangle.right > GetSystemMetrics(SM_CXSCREEN)) //Move drop down window to left if its left side is out of screen
{
DropDownWindowRectangle.OffsetRect(GetSystemMetrics(SM_CXSCREEN) - DropDownWindowRectangle.right, 0);
DropDownWindowPointer->MoveWindow(DropDownWindowRectangle);
}
if (m_HeaderControl.GetSafeHwnd() != NULL)
{
CRect WindowRectangle;
GetWindowRect(WindowRectangle);
if (DropDownWindowRectangle.top - WindowRectangle.top < 39)
{
m_HeaderControl.SetWindowPos(&wndBottom, DropDownWindowRectangle.left, WindowRectangle.top + 21, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
DropDownWindowRectangle.top += 18;
/*Two lines added*/
if (DropDownWindowRectangle.bottom - DropDownWindowRectangle.top < 18){
DropDownWindowRectangle.bottom = DropDownWindowRectangle.top + 18;
}
DropDownWindowPointer->MoveWindow(DropDownWindowRectangle);
}
}
}
// changed te
if( false == bHasFocus /*!IsHighLightText*/)
{
OldPenPointer = DeviceContextPointer->SelectObject(&m_LightGrayPen);
DeviceContextPointer->MoveTo(TextRectangle.left, TextRectangle.bottom - 1);
DeviceContextPointer->LineTo(TextRectangle.right, TextRectangle.bottom - 1);
DeviceContextPointer->SelectObject(OldPenPointer);
}
// changed te
if( false == bIsSelected/*!IsHighLightText*/)
{
OldPenPointer = DeviceContextPointer->SelectObject(&m_LightGrayPen);
}
TextRectangle.left += LEFTMARGIN_OF_DROPDOWNLIST;
TextRectangle.right = TextRectangle.left;
for(INT ColumnIndex = 0; ColumnIndex < m_TotalColumn; ColumnIndex++)
{
TextRectangle.left = TextRectangle.right;
if (m_ColumnWidth[ColumnIndex] != 0)
{
if (ColumnIndex > 1 || (ColumnIndex == 1 && m_ColumnWidth[0] != 0))
{
TextRectangle.left += SPACE_BETWEEN_COLUMN;
// changed te
if (false == bIsSelected /*!IsHighLightText*/)
{ //draw vertical gray line
DeviceContextPointer->MoveTo(TextRectangle.left - SPACE_BETWEEN_COLUMN / 2, TextRectangle.top);
DeviceContextPointer->LineTo(TextRectangle.left - SPACE_BETWEEN_COLUMN / 2, TextRectangle.bottom);
}
}
TextRectangle.right = TextRectangle.left + m_ColumnWidth[ColumnIndex];
TextRectangle.left++;
// if vertical scrool bar is visible
// if ((ColumnIndex == m_TotalColumn - 1 || (ColumnIndex == m_TotalColumn - 2 && m_ColumnWidth[m_TotalColumn - 1] == 0)) && (DropDownWindowPointer->GetStyle() & WS_VSCROLL))
// TextRectangle.right -= GetSystemMetrics(SM_CXVSCROLL);
DeviceContextPointer->DrawText(m_ColumnItemList[ColumnIndex].GetAt(m_ColumnItemList[ColumnIndex].FindIndex(lpDrawItemStruct->itemID)), -1, TextRectangle,
m_ColumnAlignStyle[ColumnIndex] | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
}
}
// changed te
if( false == bIsSelected/*!IsHighLightText*/)
DeviceContextPointer->SelectObject(OldPenPointer);
}
else //Draw item in edit box control/static text control
{
TextRectangle.left += LEFTMARGIN_OF_CONTROL;
if( m_ColumnsInEditCtrl.GetSize() ){
CString strText;
POSITION Pos;
int nIndex;
for( int i = 0; i < m_ColumnsInEditCtrl.GetSize(); i++ ){
if( 0 != i ){
strText += " ";
}
nIndex = m_ColumnsInEditCtrl[i];
Pos = m_ColumnItemList[nIndex].FindIndex(lpDrawItemStruct->itemID);
strText += m_ColumnItemList[nIndex].GetAt(Pos);
}
DeviceContextPointer->DrawText(strText, -1, TextRectangle,DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
}
else if (m_ColumnWidth[m_BoundColumn] > 0)
DeviceContextPointer->DrawText(m_ColumnItemList[m_BoundColumn].GetAt(m_ColumnItemList[m_BoundColumn].FindIndex(lpDrawItemStruct->itemID)), -1, TextRectangle,
m_ColumnAlignStyle[m_BoundColumn] | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
else //Bound column is hidden
{
DeviceContextPointer->DrawText(m_ColumnItemList[m_ShowColumn].GetAt(m_ColumnItemList[m_ShowColumn].FindIndex(lpDrawItemStruct->itemID)), -1, TextRectangle,
m_ColumnAlignStyle[m_ShowColumn] | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
}
}
}
}
|
|
|
|
|
Try this: Add a title and then only add a single row. The row does not appear; instead, only the title will. The problem is that once a title is added, only n-1 rows will appear, always dropping the last one
|
|
|
|
|
Thank you for finding a error for me.
The dropdown window has to be resized for the title window. If its height is small than 18, the dropdown window cannot be seen. You can modify it like follow:
CRect WindowRectangle;
GetWindowRect(WindowRectangle);
if (DropDownWindowRectangle.top - WindowRectangle.top < 39)
{
m_HeaderControl.SetWindowPos(&wndBottom, DropDownWindowRectangle.left, WindowRectangle.top + 21, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
DropDownWindowRectangle.top += 18;
/*Two lines added*/
if (DropDownWindowRectangle.bottom - DropDownWindowRectangle.top < 18)
DropDownWindowRectangle.bottom = DropDownWindowRectangle.top + 18;
DropDownWindowPointer->MoveWindow(DropDownWindowRectangle);
}
|
|
|
|
|
When using a DROPDOWN list, any text entered in the edit control of the combobox is ignored. I tried typing in the "DropDown, Sort, Variable" combobox in the sample program, and the text appears in the edit control, but is not returned to the sample program when the dialog is closed. What happened to it, is it not being processed correctly?
|
|
|
|
|
Can anyone point me in the correct direction?
When using GetLBText, if the item you are retrieving has no length, GetBufferSetLength() is passed a -1 and causes an Assertion. Is anyone else seeing this?
TIA
Pat..
|
|
|
|
|
Hello all,
i have a problem using the control.
My SDI-App has 2 views in a static splitter, 1 treeview and 1 formview. A modeless property sheet in the formview display a number of property pages. On some of the pages i use more then 10 multicolumncombobox controls. Switching pages leads to an application crash. In the debug windows i get the following message:
HEAP: Invalid address specified to RtlSizeHeap(...);
Can anybody tell me why?
With kindest regards
Volker
------------------------------------------------------------------------
Volker Arendt mailto:arendt@wiwi.uni-wuppertal.de
Gaußstr. 20 Tel : +49(202)4392448
42097 Wuppertal, Germany Fax: +49(202)4392448
University of Wuppertal - Department of Economics (FB 6)
------------------------------------------------------------------------
|
|
|
|
|
I like this combobox. Great job!
A problem I noticed is that the dropdown height is reduced depending on the number of items in the list. If you only have 4 items, the height is reduced so that only 2 rows are displayed with scrollbars. Fewer than 2 or 3 rows and all you see is the header. I set the height using the Dialog Editor in the normal way.
How can you make the dropdown height fixed?
Also, if you make the font the same size as the text in the dropdown list, this reduces the height of the header control and leaves a gap at the bottom.
|
|
|
|
|
I have found the ploblem.
The dropdown window has to be resized for the title window. If its height is small than 18, the dropdown window cannot be seen. So if you want to make the dropdown height fixed, you can move it only. Please modify it like follow:
CRect WindowRectangle;
GetWindowRect(WindowRectangle);
if (DropDownWindowRectangle.top - WindowRectangle.top < 39)
{
m_HeaderControl.SetWindowPos(&wndBottom, DropDownWindowRectangle.left, WindowRectangle.top + 21, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
DropDownWindowRectangle.top += 18;
/*One line added*/
DropDownWindowRectangle.bottom += 18
//Move the dropdown window down, do not resize it
/*Two lines added*/
//if (DropDownWindowRectangle.bottom - DropDownWindowRectangle.top < 18)
//DropDownWindowRectangle.bottom = DropDownWindowRectangle.top + 18;
DropDownWindowPointer->MoveWindow(DropDownWindowRectangle);
}
|
|
|
|
|
Please modify these lines:
"m_HeaderControl == NULL" -> "m_HeaderControl.m_hWnd == NULL"
"m_HeaderControl != NULL" -> "m_HeaderControl.m_hWnd != NULL"
Then, the error 'C2666' is removed
|
|
|
|
|
could you compile it.. no i could'nt . I think u submitted wrong files
i noticed some problems in the code
first assertion error due to header control not beeing created in the first place 'coz you don't call SetColumnTitle("ID","DESCRIPTION") for m_ComboBoxControl3. so i added a function called CreateHeaderctrl in CMultiColumnComboBox
BOOL CMultiColumnComboBox::CreateHeaderCtrl()
{
CRect WindowRectangle;
GetWindowRect(WindowRectangle);
m_pHeaderControl->Create(HDS_BUTTONS | HDS_HORZ | WS_VISIBLE | WS_BORDER | WS_DISABLED, WindowRectangle, (m_ComboBoxStyle != CBS_SIMPLE) ? GetDesktopWindow(): this, 0);
if(m_pHeaderControl == NULL)
return FALSE;
else
return TRUE;
}
call this function before doing anthing with Header control like this
m_ComboBoxControl1.CreateHeaderCtrl();
m_ComboBoxControl2.CreateHeaderCtrl();
m_ComboBoxControl3.CreateHeaderCtrl();
m_ComboBoxControl4.CreateHeaderCtrl();
.........
m_ComboBoxControl1.FormatComboBox();
m_ComboBoxControl1.SetColumnWidth(30, 80);
m_ComboBoxControl1.SetColumnTitle("ID", "DESCRIPTION");
for (Index = 0; Index < 20; Index++)
{
ColumnString0.Format("ID%u", Index);
ColumnString1.Format("Description%u", Index);
m_ComboBoxControl1.AddRow(ColumnString0, ColumnString1);
}
.....
.....
.......
also removed redundant call in SetColumnTitle("ID","DESCRIPTION")
one more silly err is that m_Headercontrol should have been a pointer and other necessary changes
any way excellent effort
thanx
siv
|
|
|
|
|
I need to be able to handle the CBN_CLOSEUP on my dialog, but the CMultiColumnComboBox is already handling this event.
Is there a way for the CMultiColumnComboBox to 'resend' the message to its parent?
|
|
|
|
|