zephyrer / advcombobox Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/advcombobox
Automatically exported from code.google.com/p/advcombobox
Remove VS6 project files from repository when finished.
Only VS2005, VS2008, and VS2010 should be maintained.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 2:27
1: http://www.codeproject.com/Messages/457856/Bug-report.aspx
It can be fixed in AdvComboBox.cpp Line 1348.
if( m_pDropWnd )
{
int nPos = m_pDropWnd->GetListBoxPtr()->GetCurSel();
if(nPos>=0)//Here the nPos should be checked.
SendMessage( WM_SELECTED_ITEM, (WPARAM)nPos );
}
2: http://www.codeproject.com/Messages/815022/Re-Bug-report.aspx
I had this problem too, and although leinwpu's suggestion prevents an
exception, it leaves the listbox hanging open for me after pressing enter if
GetCurSel failed. I made the following change in the referenced code in
CAdvComboBox::PreTranslateMessage:
int nPos = m_pDropWnd->GetListBoxPtr()->GetCurSel();
if (nPos != LB_ERR)
SendMessage( WM_SELECTED_ITEM, (WPARAM)nPos );
else
OnDestroyDropdownList(0,0);
If another change discussed below is made, I have only seen LB_ERR returned
when the dropwnd is open but the list is empty.
The real fix for me starts here. The problem that started the thread seems to
be caused in CAdvComboBox::CreateDropList by the line:
m_pDropWnd->GetListBoxPtr()->SetCurSel( m_nCurSel );
m_nCurSel appears to be an index into CAdvComboBox::m_list, the complete list,
although the actual list (droplist) could be the suggestlist, a subset, if
CreateDropList was called from OnUpdateEdit. This means that if the index of
the selected item in the full list was higher than the size of the suggestlist,
the SetCurSel call will fail, and subsequent GetCurSel calls will also fail
like that in PreTranslateMessage. Rather than try to correct the use of the
wrong index, I just added the following code:
if (m_nCurSel > ((int)droplist.size() - 1))
m_nCurSel = 0;
before the SetCurSel line in CAdvComboBox::CreateDropList. This won't entirely
solve all problems though if the m_nCurSel index isn't greater than the size of
the suggestlist, so I also changed some code in CAdvComboBox::OnUpdateEdit as
follows:
if( suggestlist.size() != 0 )
{
m_nCurSel = 0; // New
CreateDropList( suggestlist );
}
Incidentally, while I was tracking down the m_nCurSel index problem, I made a
small related change to CDropListBox::SetCurSel. This function is called from
CreateDropList, as noted above, when the droplist is being created. The
CDropListBox::SetCurSel function calls GetCurSel before CListBox::SetCurSel is
called, so GetCurSel returns LB_ERR because no item is selected at that point.
I don't know whether this would cause an error or not, because the return value
is used in processing disabled items in the listbox, which I haven't used.
Anyway, I made the following change in CDropListBox::SetCurSel:
int nCur = GetCurSel();
if (nCur < 0) // new
{
nCur = 0;
} // end new
I hope Mathias wasn't counting on nCur being -1 (LB_ERR) the first time
through! If so, I just broke it.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:26
http://www.codeproject.com/Messages/1163911/WinXP-and-Classic-Theme-selection.as
px
Hi,
if you select classic under xp theme selection the buttons of the combobox are
not drawn.
I have changed "UseVisualStyles()" in the following way:
BOOL CVisualStylesXP::UseVisualStyles()
{
static BOOL bUse = -1;
if( bUse != -1 )
return bUse;
HINSTANCE hinstDll;
DLLVERSIONINFO dvi;
ZeroMemory(&dvi, sizeof(dvi));
hinstDll = LoadLibrary(TEXT("comctl32.dll"));
if(hinstDll)
{
DLLGETVERSIONPROC pDllGetVersion;
pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
if(pDllGetVersion)
{
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
(*pDllGetVersion)(&dvi);
}
FreeLibrary(hinstDll);
}
if( dvi.dwMajorVersion == 6 && dvi.dwMinorVersion == 0 )
{
WCHAR szName [256];
WCHAR szColor [256];
if(!GetCurrentThemeName(szName, 255, szColor, 255, NULL, 0))
{
CString strWinXPThemeColor = szColor;
if(strWinXPThemeColor.CompareNoCase (_T("normalcolor")) == 0 ||
strWinXPThemeColor.CompareNoCase (_T("homestead")) == 0 ||
strWinXPThemeColor.CompareNoCase (_T("metallic")) == 0)
{
bUse = TRUE;
return IsAppThemed() && m_hThemeDll; // No need to test HTHEME, but...
}
}
bUse = FALSE;
return FALSE;
}
else
{
bUse = FALSE;
return FALSE;
}
}
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:32
http://www.codeproject.com/Messages/1114026/a-big-bug.aspx
When the drop down window is show and the scrollbar is not disabled,you click
the scrollbar and then click the dialog anywhere except the AdvComboBox, you'll
find that the drop down window can not be closed.
Possible solution:
CDropScrollBar.cpp Line 113 Add
case SB_ENDSCROLL: // End scroll.
ReleaseCapture();
GetParent()->PostMessage( WM_VRC_SETCAPTURE );
break
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:30
Style defs are wrong:
CBS_DROPDOWN 0x_____002
CBS_DROPDOWNLIST 0x_____003
CBS_AUTOHSCROLL 0x_____040
CBS_SORT 0x_____100
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:37
Thanks Mathias for a great component!
I made a few small changes.
I also deleted the following line from CAdvComboBox::CreateDropList, because it
does not appear to be used:
int nCount = m_list.size();
I wanted the text in the edit box to be selected when the combobox gets focus,
so the user can just start typing a new search without first deleting or
selecting what is there. To do this, I added the following to
CAdvComboBox::OnSetfocusEdit right after the GetFocus line:
if (m_pEdit)
{
m_pEdit->PostMessage(EM_SETSEL, 0, -1);
}
Finally, I wanted the dropdown list to close when the combobox loses focus, so
I added the following to the end of CAdvComboBox::OnKillfocusEdit:
if (m_pDropWnd)
{
OnDestroyDropdownList(0,0);
}
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:26
#ifdef _UNICODE
typedef wstring tstring
#else
typedef string tstring
#endif
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:23
After selecting an item from the listbox, the control would update the editbox
then display a single-item listbox with the item just selected.
I worked around this by modifying CAdvComboBox::OnUpdateEdit() as follows:
if( suggestlist.size() != 0 )
changed to:
if( suggestlist.size() > 1 )
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:31
It have no pourpose resizing it to so small rect, just to a grip.
The same idea is to max vertical dropdown size. It should be (if auto size
selected) equal to max items size or if there are many items equal to rect
(from combo bottom to screen bottom).
http://www.codeproject.com/Messages/814977/Re-Suggestion.aspx
I agree with one_eddie's suggestion, and I edited CDropWnd::OnMouseMove
accordingly. I started by storing the listbox width and height calculated in
CDropWnd::OnCreate. I created two new variables in the private section of the
CDropWnd declaration in DropWnd.h as follows:
int m_nMaxX;
int m_nMaxY;
I initialize them in the CDropWnd::CDropWnd constructor to a large default
number (I chose 1000 - bad form, I know). I set them in CDropWnd::OnCreate just
before the SetWindowPos call as follows:
m_nMaxX = nW;
m_nMaxY = nH;
SetWindowPos( &wndTopMost, nX, nY, nW, nH, SWP_SHOWWINDOW|SWP_NOZORDER );
I then edited CDropWnd::OnMouseMove, replacing the following if-else blocks:
if( point.x + m_nMouseDiffX >= ::GetSystemMetrics(SM_CXVSCROLL) )
{...}
and
if( point.y + m_nMouseDiffY >= ::GetSystemMetrics(SM_CYVSCROLL) )
{...}
with the following code:
CRect rcCombo;
m_pComboParent->GetWindowRect( &rcCombo );
if( point.x + m_nMouseDiffX < rcCombo.Width())
{
rcWnd.right = rcWnd.left + rcCombo.Width();
}
else if (point.x + m_nMouseDiffX > m_nMaxX)
{
rcWnd.right = rcWnd.left + m_nMaxX;
}
else
{
rcWnd.right = rcWnd.left + point.x + m_nMouseDiffX;
}
and
if( point.y + m_nMouseDiffY < :: GetSystemMetrics(SM_CYVSCROLL) )
{
rcWnd.bottom = rcWnd.top + ::GetSystemMetrics(SM_CXVSCROLL) +1;
}
else if ( point.y + m_nMouseDiffY > m_nMaxY )
{
rcWnd.bottom = rcWnd.top + m_nMaxY;
}
else
{
rcWnd.bottom = rcWnd.top + point.y + m_nMouseDiffY +2;
}
I'm certainly not sure that this is the best way to do it, but it works for me.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:22
http://www.codeproject.com/Messages/1789805/CListCtrl-instead-of-CListBox-will-h
elp.aspx
Thanks for sharing this excellent control. I like it very much. I use it in
many of my applications.
Just a thought for improvement.
CDorpListBox, if derived from CListCtrl (instead of CListBox) then
it may make possible following
- to have multi-columns
- support for virtual list
- better performance (virtual mode) in case of many combos in one form/dialog.
Thanks
Anand
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:38
Possibility to search for a substring in the middle, not just from the start of
a string.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:22
char* szTok = new char[nLen+5];
memset( szTok, 0, nLen+5 );
strcpy( szTok, (LPCTSTR)strItems );
token = strtok( szTok, seps );
while( token != NULL )
{
AddString( token );
token = strtok( NULL, seps );
}
[Need to delete the array!]
delete[] szTok;
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:13
http://www.codeproject.com/Messages/364745/Re-Focus-Movement.aspx
The API has changed for .NET. Just modify the sources to say
#if (_MSC_VER > 1200)
void CDropWnd::OnActivateApp(BOOL bActive, DWORD dwThreadID) {
CWnd::OnActivateApp(bActive, dwThreadID);
#else void CDropWnd::OnActivateApp(BOOL bActive, HTASK hTask) {
CWnd::OnActivateApp(bActive, hTask);
#endif if(!bActive) {
m_pComboParent->PostMessage(WM_DESTROY_DROPLIST);
}
}
in DropWnd.cpp, and
#if (_MSC_VER > 1200)
afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID);
#else afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
#endif
in DropWnd.h
_MSC_VER returns:
1100 for VC5
1200 for VC6
1300 for .NET
and so on, so the comparison to > 1200 might be changed to equals, because they
might change the API again, who knows....
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:20
Control are too slow when adding many items >500.
Native listbox are much faster.
Possible solution:
1. Slow speed are from using STL template 'list', and always sorting in the
AddString method of CAdvComboBox class. removing calling 'm_list.sort()' from
this method up speed to normal...
http://www.codeproject.com/Messages/311333/Re-Too-slow-and-background-problem.as
px
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:05
The static lib will be placed under downloads and on Codeproject page
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 2:24
http://www.codeproject.com/Messages/810079/Can-sharp180-t-compile.aspx
Solution:
http://www.codeproject.com/Messages/815052/Re-Can-t-compile.aspx
I'm using Visual Studio .net 2003 and had the same problem.
Change DropWnd.cpp, line 494, from:
void CDropWnd::OnActivateApp(BOOL bActive, HTASK hTask);
to:
void CDropWnd::OnActivateApp(BOOL bActive, DWORD hTask);
Change DropWnd.h, line 107, from:
afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
to:
afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:24
http://www.codeproject.com/Messages/1492472/Autocompletion-scrolling-problem.asp
x
Hello everyone and special regards to Mathias
for this really useful control. I have just put in my project and it fits all
needs. Thanks!
In the OnEditUpdate handler there is the code for the auto completion if a
unique match has been found. The core of the code is these two lines.
m_pEdit->SetWindowText( m_iter->strText.c_str() );
m_pEdit->SetSel(nEditLen, (int)m_iter->strText.length(), TRUE );
These lines are the one that are my problem. If the matched text is a long
string, taking a wider space than the edit control, the SetWindowText will move
the caret pos to the end of the text and doing so it scrolls the beginning of
the text (which the user has just typed) out of view.
I have tried several scrolling things or using a additional SetSel(0,0,) before
the second line, but it was of no use: on the second SetSel, the caret pos
always goes to the end of the selection and the scroll always occurs.
Help!
Thomas
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:34
http://www.codeproject.com/Messages/1678606/Why-not-emplemented-clear-method.asp
x
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:33
Nice control. Thanks for sharing.
I have one question.
To show more than 32736 items (beyond limit of MFC CComboBox), I need to show
CListCtrl as Virtual List and to hide inbuilt-listbox of ComboBox.
Any idea how to do that ?
Thanks
Ana
http://www.codeproject.com/Messages/1775457/Question-Virtual-List-for-more-than-
32736-items.aspx
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:35
Using the mouse, drop the list and scroll up or down using the scrollbar arrows
and the move the mouse outside the control to the right and then set focus to
another control.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:18
http://www.codeproject.com/Messages/713200/Problem-with-sorting.aspx
If the sort option is enabled and some item is already selected, after adding
new item into the list, combo box will may select another one in the list
itself.
Possible solution:
http://www.codeproject.com/Messages/713214/Re-Problem-with-sorting.aspx
int CAdvComboBox::AddString(LPCTSTR lpszString){ LIST_ITEM item; item.strText
= lpszString; item.bChecked = false; item.bDisabled = false; item.vpItemData
= NULL; if( GetStyle() & CBS_SORT ) { int Start = 0; int End =
m_list.size(); while(Start < End) { m_iter = m_list.begin();
advance(m_iter, (End+Start)/2); if (lpszString < m_iter->strText)
End = (End+Start)/2; else
Start = (End+Start+1)/2; } m_iter = m_list.begin(); advance(m_iter, End); if (End <= m_nCurSel) m_nCurSel++; m_list.insert(m_iter, item); return End; } else
{ m_list.push_back( item ); return m_list.size()-1; }
}
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:17
1: http://www.codeproject.com/Messages/653426/Combobox-Button-disappears.aspx
When I downloaded AdvComboBox_demo21.zip and started AdvComboBoxDemo.exe
provided in the archive the following occured (I have no option checked or
altered something else in the controls):
(1) When I move the mouse over the combobox button it disappears leaving a
white blank.
(2) When I push the combobox button (now the white blank) the dropdown listbox
shows with the gripper being only a rectangle with its (I suppose) client rect
transparent. When I now alter the size of the drop down box using the gripper
it's client rect (of the gripper, not the listbox) is not drawing, showing the
scrambled contents of the current background.
(3) I use two monitors. When I move the dialog to the second monitor and push
the drop down button the drop down box shows on the right egde of the first
monitor.
I use windows xp with the classic windows theme. I also installed the latest
plattform sdk (may be a reason for the behaviour? Don't now ...). As mentioned
I use two monitors. If you are interested write me a mail and I send you the
screen shots.
2:
http://www.codeproject.com/Messages/1025695/Re-Combobox-Button-disappears.aspx
I also see this same behavior.
What I have in common with your explanation is running classic theme on a winxp
os.
I have commented out all the "theme related stuff" in OnPaint and the control
paints correctly.
What I am seeing is that all DrawFrameControl calls somehow fail when the theme
code is run on XP os with classic theme enabled. If I switch to XP theme on XP
then control paints correctly.
What an annoying problem!
3:
http://www.codeproject.com/Messages/1025702/Re-Combobox-Button-disappears.aspx
Here is the fix:
find all:
g_xpStyle.UseVisualStyles()
replace with:
g_xpStyle.IsAppThemed()
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:12
Fixit!
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:20
ere is one problem in the function of the tnsertString(). I want to push the
datas one by one. But the second data is lost. I debug it again and find the
problem. When I push the data with the nIndex=1, and the list size=1, the
program jump the judge of "if( nIndex == -1 || (nIndex > m_list.size()) )". So,
the second data lost.
one example:
m_ctlAdvCombo.InsertString(0,"aaa");
m_ctlAdvCombo.InsertString(1,"bbb");//lost
m_ctlAdvCombo.InsertString(2,"ccc");
I modify ">" to be ">=". It work.
Calvin
http://www.codeproject.com/Messages/3344716/the-second-data-is-lost.aspx
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:44
The autoappend functionality is case sensitive. It should be insensitive.
Possible solution:
http://www.codeproject.com/Messages/582531/Re-Can-it-be-case-insensitive-Yes.asp
x
"
This is the code I used to make it case insensitive:
to make the autoappend case insensitive do this around line 1709, to make the
autosugges case insensitive do it again around 1764
replace:
item = *m_iter;
int nPos = m_iter->strText.find( str, 0 );
if( nPos == 0 )
{//..
with:
item = *m_iter;
bool bMatch = true;
if (nEditLen < m_iter->strText.length())
{
for (int i = 0; i < nEditLen; i++)
{
if (!((str[i] == m_iter->strText[i]) ||
(str[i] >= 'A' && str[i] <= 'Z' &&
str[i] + 'a' - 'A' == m_iter->strText[i]) ||
(str[i] >= 'a' && str[i] <= 'z' &&
str[i] - 'a' + 'A' == m_iter->strText[i])))
{
bMatch = false;
i = nEditLen;
}
}
}
else
bMatch = false;
"
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:10
Hello
Ist there any support available to compile the project under vs2005 or vs 2008
or vs2010
It would be great if we get some help or support for that problem.
Kind regards
Joerg Tiedemann
Mail: [email protected]
Original issue reported on code.google.com by [email protected]
on 27 Feb 2013 at 6:18
If I run my application on a secondary monitor the combobox is displayed at the
primary monitor.
http://www.codeproject.com/Messages/2903729/Re-Multiple-Monitors.aspx
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:39
...would be nice to have...
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:29
I'm sorry first for my poor English...
1.Run you demo
2.set AutoSuggest and AutoAppend as true
3.input "a" in the AdvComboBox
4.we can see"a Text",and " Text" was selected
5.hit key BackSpace,and "a" was left inde AdvComboBox,and no Item was selected
bellow
5.hit Enter key,and a crash will appear.
I guess this is because when no Item is selected(default index is -1),we hit
Enter,a crash will be appear.
Thanks
lonfee
China
http://www.codeproject.com/Messages/3326915/I-probablily-found-a-bug.aspx
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 1:42
http://www.codeproject.com/Messages/553926/some-suggestion-about-ACBS_AUTOSUGGES
T-style.aspx
if( nPos == 0 )
{
if (m_iter->strText != str) // xRadish
suggestlist.push_back( item );
}
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 8:28
http://www.codeproject.com/Messages/873176/Bug-with-ESC-key.aspx
The AdvComboBox - Version 2.1 has the focus and the drop down window is closed.
If you then hit the ESC- key the dialog is not closed.
It can easily fixed in CAdvComboBox.cpp Line 1362
if( pMsg->wParam == VK_ESCAPE ){ if( m_pDropWnd ) {
OnDestroyDropdownList(0,0); Invalidate(); } else { return
CWnd::PreTranslateMessage(pMsg); }}
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:28
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.