15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Weird Combo Box Problem

Tony Goodhew -- tonyg@gui.com.au
Friday, December 27, 1996

Environment: VC 4.2b, Windows 95

Guys,

I'm getting a weird Combo box behaviour. I've created a test program by
using the AppWizard and selected MDI, OLE Controls, ODBC Headers. The View
class is derived from CFormView.

I drop a single Combo Box with Dropdown list style selected onto the form.
Using the ClassWizard I associate a control variable with the combo box
called m_combo. I then execute the following code in the OnInitialUpdate
function:

m_combo.AddString("Test");

When I run the app the combo box displays but doesn't display any entries.
If I add more entries using the same line above and look at the return I
get the index of each entry but it still doesn't display.

I've then added a dialog box and performed the same code in the
OnInitDialog function and linked the launching of the box to a button on
the view form and it still doesn't display.

I've tried both English US & English Australian with my machine set for
both regional settings. Still nothing.

Any clues?

Thanks,

TonyG



Rail J. Rogut -- railro@earthlink.net
Friday, December 27, 1996

[Mini-digest: 2 responses]

Tony Goodhew wrote:
> 
> Environment: VC 4.2b, Windows 95
> 
> Guys,
> 
> I'm getting a weird Combo box behaviour. I've created a test program by
> using the AppWizard and selected MDI, OLE Controls, ODBC Headers. The View
> class is derived from CFormView.
> 
> I drop a single Combo Box with Dropdown list style selected onto the form.
> Using the ClassWizard I associate a control variable with the combo box
> called m_combo. I then execute the following code in the OnInitialUpdate
> function:
> 
> m_combo.AddString("Test");
> 
> When I run the app the combo box displays but doesn't display any entries.
> If I add more entries using the same line above and look at the return I
> get the index of each entry but it still doesn't display.
> 
> I've then added a dialog box and performed the same code in the
> OnInitDialog function and linked the launching of the box to a button on
> the view form and it still doesn't display.
> 
> I've tried both English US & English Australian with my machine set for
> both regional settings. Still nothing.
> 
> Any clues?
> 
> Thanks,
> 
> TonyG

Hi Tony,

This is a trap many of us have climbed out of...  In the resource editor
click on the down arrow of the combo box and you can set a size for the
drop down portion of the combo box.

Good luck.

	Rail
	Oceanway Recording
	railro@earthlink.net
-----From: Joe Willcoxson 

At 01:25 PM 12/27/96 +1100, you wrote:
>Environment: VC 4.2b, Windows 95
>
>Guys,
>
>I'm getting a weird Combo box behaviour. I've created a test program by
>using the AppWizard and selected MDI, OLE Controls, ODBC Headers. The View
>class is derived from CFormView.
>
>I drop a single Combo Box with Dropdown list style selected onto the form.
>Using the ClassWizard I associate a control variable with the combo box
>called m_combo. I then execute the following code in the OnInitialUpdate
>function:
>
>m_combo.AddString("Test");
>
>When I run the app the combo box displays but doesn't display any entries.
>If I add more entries using the same line above and look at the return I
>get the index of each entry but it still doesn't display.
>
>I've then added a dialog box and performed the same code in the
>OnInitDialog function and linked the launching of the box to a button on
>the view form and it still doesn't display.
>
>Any clues?
>
>Thanks,

The most common problem I've seen is that people try to do something with a
CWnd based control before the window handle (HWND) is valid.  Make sure you
call the base class OnInitialUpdate and OnInitDialog before trying to
manipulate the controls.  When debugging, make sure your m_combo has a
valid HWND.  What you mention that is strange to me is the fact that
AddString appears to be returning valid indices.  That's weird.

--
Gloria in excelsius Deo
Joe Willcoxson (joew@statsoft.com), Senior Software Engineer
Visit us: http://www.statsoft.com, Visit me: http://users.aol.com/chinajoe
#define STD_DISCLAIMER "I speak only for myself"
__cplusplus spoken here;





| Вернуться в корень Архива |