Comboboxex Editbox limit
-
Hello, Does anyone know how to have the character limit on the editbox of a comboboxex control removed or set very big ? Thanks David
Use
CComboBox::LimitText()
.
"Take only what you need and leave the land as you found it." - Native American Proverb
-
Hello, Does anyone know how to have the character limit on the editbox of a comboboxex control removed or set very big ? Thanks David
I guess you need to make your combo box hold text more than its width. You can do this by setting CBS_AUTOHSCROLL style of the combo box. You can do this by setting Auto property of combobox to true.
-
I guess you need to make your combo box hold text more than its width. You can do this by setting CBS_AUTOHSCROLL style of the combo box. You can do this by setting Auto property of combobox to true.
Sorry to say this but neither works As a test I wrote the following to see the limits and set the good styles: HWND hwndcombo = FindWindowEx( this->m_Hwnd, NULL, NULL, NULL ); SetWindowLong( hwndcombo, GWL_STYLE, GetWindowLong( hwndcombo, GWL_STYLE ) | CBS_AUTOHSCROLL ); int n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); char data[500]; wsprintf( data, "Limit : %d", n ); mIRCError( data ); SendMessage( hwndcombo, CB_LIMITTEXT, (WPARAM) 0, (LPARAM) 0 ); n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); wsprintf( data, "Limit : %d", n ); mIRCError( data ); Edit_LimitText( this->m_EditHwnd, 0 ); n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); wsprintf( data, "Limit : %d", n ); mIRCError( data ); The combo child of the comboboxex has its CBS_AUTOHSCROLL style, and the edit has its EM_AUTOHSCROLL style and the output of the above gives : Limit : 30000 Limit : 30000 Limit : 2147483646 So the initial limit is already 30000 chars so it isn't the culprit. I still hear the little ding sound when I get to the end of the editbox notifying I can't put more there even if the AutoHScroll style is there and the limit is way beyond the actual control limit.
-
Sorry to say this but neither works As a test I wrote the following to see the limits and set the good styles: HWND hwndcombo = FindWindowEx( this->m_Hwnd, NULL, NULL, NULL ); SetWindowLong( hwndcombo, GWL_STYLE, GetWindowLong( hwndcombo, GWL_STYLE ) | CBS_AUTOHSCROLL ); int n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); char data[500]; wsprintf( data, "Limit : %d", n ); mIRCError( data ); SendMessage( hwndcombo, CB_LIMITTEXT, (WPARAM) 0, (LPARAM) 0 ); n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); wsprintf( data, "Limit : %d", n ); mIRCError( data ); Edit_LimitText( this->m_EditHwnd, 0 ); n = SendMessage( this->m_EditHwnd, EM_GETLIMITTEXT, 0, 0 ); wsprintf( data, "Limit : %d", n ); mIRCError( data ); The combo child of the comboboxex has its CBS_AUTOHSCROLL style, and the edit has its EM_AUTOHSCROLL style and the output of the above gives : Limit : 30000 Limit : 30000 Limit : 2147483646 So the initial limit is already 30000 chars so it isn't the culprit. I still hear the little ding sound when I get to the end of the editbox notifying I can't put more there even if the AutoHScroll style is there and the limit is way beyond the actual control limit.
ClickHeRe wrote:
SetWindowLong( hwndcombo, GWL_STYLE, GetWindowLong( hwndcombo, GWL_STYLE ) | CBS_AUTOHSCROLL );
Why not set this style at design time? Many styles cannot be changed at run time.
ClickHeRe wrote:
Edit_LimitText( this->m_EditHwnd, 0 );
Why are you sending a message to the edit control? You should be using
CComboBox::LimitText()
instead?ClickHeRe wrote:
I still hear the little ding sound when I get to the end of the editbox notifying I can't put more there even if the AutoHScroll style is there and the limit is way beyond the actual control limit.
The
CB_LIMITTEXT
message limits only the text the user can enter. It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control when a string in the list box is selected.
"Take only what you need and leave the land as you found it." - Native American Proverb
-
ClickHeRe wrote:
SetWindowLong( hwndcombo, GWL_STYLE, GetWindowLong( hwndcombo, GWL_STYLE ) | CBS_AUTOHSCROLL );
Why not set this style at design time? Many styles cannot be changed at run time.
ClickHeRe wrote:
Edit_LimitText( this->m_EditHwnd, 0 );
Why are you sending a message to the edit control? You should be using
CComboBox::LimitText()
instead?ClickHeRe wrote:
I still hear the little ding sound when I get to the end of the editbox notifying I can't put more there even if the AutoHScroll style is there and the limit is way beyond the actual control limit.
The
CB_LIMITTEXT
message limits only the text the user can enter. It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control when a string in the list box is selected.
"Take only what you need and leave the land as you found it." - Native American Proverb
Good point, must I say that MSDN help sucks then ComboBoxEx Control Styles ComboBoxEx controls support only the following ComboBox styles: CBS_SIMPLE CBS_DROPDOWN CBS_DROPDOWNLIST WS_CHILD No where does it say it supports in the CreateWindow() CBS_AUTOHSCROLL Anyways, fixed, thanks