> I have an owner draw listbox, in the DrawItem I draw the items.
> If the listbox doesn't contain any item I would like to display a message
> "no item found"
> but this is no item, so DrawItem is the wrong place.
> Where should I do this? OnPaint, OnEraseBkgnd?
> I thought I would be able to do something like this for a test (just paint
> the window blue)
> but it's always white
> BOOL CmyListbox::OnEraseBkgnd(CDC* pDC)
> if (m_pItemList.GetCount() < 1)
> CRect rc;
> return TRUE;
> how is this supoosed to be done?
OnEraseBackground is called before any drawing takes place (usually just
before on item draw). So what will happen with your code there will be
taht the entire background is drawn blue and then whatever code you have
in DrawItems will overwrite this. Also i'm not entirly sure
OnEraseBackground is actually called for owner draw... have you tried
stepping through it to make sure it's actually called?
What i've done in the past is simply add a dummy item called "No items"
or "List Empty", then when data arrives I remove that item again.