int comboStyle = m_combo->GetWindowStyle();
// this is the character equivalent of the code
- wxChar keychar=0;
- if ((keycode >= WXK_SPACE) && (keycode <=255) && (keycode != WXK_DELETE) && wxIsprint(keycode))
+ wxChar keychar = 0;
+ if ( keycode < WXK_START )
{
- keychar = (wxChar)keycode;
- }
- else if (unicode>0)
- {
- keychar = unicode;
+ if ( unicode > 0 )
+ {
+ if ( wxIsprint(unicode) )
+ keychar = unicode;
+ }
+ else if ( wxIsprint(keycode) )
+ {
+ keychar = (wxChar) keycode;
+ }
}
if ( keycode == WXK_DOWN || keycode == WXK_RIGHT )
value-=10;
StopPartialCompletion();
}
- else if ( comboStyle & wxCB_READONLY )
+ else if ( keychar && (comboStyle & wxCB_READONLY) )
{
// Try partial completion
}
m_strings.Insert(item,pos);
- m_clientDatas.Insert(NULL, pos);
+ if ( (int)m_clientDatas.size() >= pos )
+ m_clientDatas.Insert(NULL, pos);
m_widths.Insert(-1,pos);
m_widthsDirty = true;
for ( i=0; i<strings.GetCount(); i++ )
{
- if ( item.Cmp(strings.Item(i)) < 0 )
+ if ( item.CmpNoCase(strings.Item(i)) < 0 )
{
pos = (int)i;
break;
height = maxHeight;
int totalHeight = GetTotalHeight(); // + 3;
+
+ // Take borders into account on Mac or scrollbars always appear
+#if defined(__WXMAC__)
+ totalHeight += 2;
+#endif
if ( height >= totalHeight )
{
height = totalHeight;
void wxOwnerDrawnComboBox::DoDeleteOneItem(unsigned int n)
{
- wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
+ wxCHECK_RET( IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::Delete") );
if ( GetSelection() == (int) n )
SetValue(wxEmptyString);
wxString wxOwnerDrawnComboBox::GetString(unsigned int n) const
{
- wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
+ wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxOwnerDrawnComboBox::GetString") );
if ( !m_popupInterface )
return m_initChs.Item(n);
{
EnsurePopupControl();
- wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
+ wxCHECK_RET( IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::SetString") );
GetVListBoxComboPopup()->SetString(n,s);
}
{
EnsurePopupControl();
- wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Select") );
+ wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::Select") );
GetVListBoxComboPopup()->SetSelection(n);
for ( unsigned int i = 0; i < count; ++i )
{
- int n = GetVListBoxComboPopup()->Append(items[i]);
+ n = GetVListBoxComboPopup()->Append(items[i]);
AssignNewItemClientData(n, clientData, i, type);
}
if ( flags & wxODCB_PAINTING_CONTROL )
{
dc.DrawText( GetValue(),
- rect.x + GetTextIndent(),
+ rect.x + GetMargins().x,
(rect.height-dc.GetCharHeight())/2 + rect.y );
}
else