In the listbox, when the last item is selected and deleted, it still

appeared in the window.

Sheri Steeves <sheri@macadamian.com>
In LISTBOX_UpdateScroll(), if the listbox did not have the WS_SCROLL
style it would just return.  This left the horizontal scroll bar
uninitialized and it was appearing at the bottom of the listbox when
it did not have to.

Serge Ivanov <sergei@corel.com>
LISTBOX_SetColumnWidth adds extra 2 pixels to the passed column width
(it says it is for column margins). Obviously it is wrong, because
margins must be internal.
This commit is contained in:
Yuxi Zhang 2000-02-26 19:13:12 +00:00 committed by Alexandre Julliard
parent fc6d940424
commit f94c3c55c1
1 changed files with 21 additions and 7 deletions

View File

@ -188,7 +188,13 @@ static void LISTBOX_UpdateScroll( WND *wnd, LB_DESCR *descr )
{
SCROLLINFO info;
if (!(descr->style & WS_VSCROLL)) return;
/* Check the listbox scroll bar flags individually before we call
SetScrollInfo otherwise when the listbox style is WS_HSCROLL and
no WS_VSCROLL, we end up with an uninitialized, visible horizontal
scroll bar when we do not need one.
if (!(descr->style & WS_VSCROLL)) return;
*/
/* It is important that we check descr->style, and not wnd->dwStyle,
for WS_VSCROLL, as the former is exactly the one passed in
argument to CreateWindow.
@ -210,10 +216,12 @@ static void LISTBOX_UpdateScroll( WND *wnd, LB_DESCR *descr )
info.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
if (descr->style & LBS_DISABLENOSCROLL)
info.fMask |= SIF_DISABLENOSCROLL;
SetScrollInfo( wnd->hwndSelf, SB_HORZ, &info, TRUE );
if (descr->style & WS_HSCROLL)
SetScrollInfo( wnd->hwndSelf, SB_HORZ, &info, TRUE );
info.nMax = 0;
info.fMask = SIF_RANGE;
SetScrollInfo( wnd->hwndSelf, SB_VERT, &info, TRUE );
if (descr->style & WS_VSCROLL)
SetScrollInfo( wnd->hwndSelf, SB_VERT, &info, TRUE );
}
else
{
@ -224,7 +232,8 @@ static void LISTBOX_UpdateScroll( WND *wnd, LB_DESCR *descr )
info.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
if (descr->style & LBS_DISABLENOSCROLL)
info.fMask |= SIF_DISABLENOSCROLL;
SetScrollInfo( wnd->hwndSelf, SB_VERT, &info, TRUE );
if (descr->style & WS_VSCROLL)
SetScrollInfo( wnd->hwndSelf, SB_VERT, &info, TRUE );
if (descr->horz_extent)
{
@ -235,7 +244,9 @@ static void LISTBOX_UpdateScroll( WND *wnd, LB_DESCR *descr )
info.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
if (descr->style & LBS_DISABLENOSCROLL)
info.fMask |= SIF_DISABLENOSCROLL;
SetScrollInfo( wnd->hwndSelf, SB_HORZ, &info, TRUE );
if (descr->style & WS_HSCROLL)
SetScrollInfo( wnd->hwndSelf, SB_HORZ, &info, TRUE );
}
}
}
@ -1093,7 +1104,6 @@ static LRESULT LISTBOX_SetHorizontalExtent( WND *wnd, LB_DESCR *descr,
*/
static LRESULT LISTBOX_SetColumnWidth( WND *wnd, LB_DESCR *descr, UINT width)
{
width += 2; /* For left and right margin */
if (width == descr->column_width) return LB_OKAY;
TRACE("[%04x]: new column width = %d\n",
wnd->hwndSelf, width );
@ -1459,6 +1469,10 @@ static LRESULT LISTBOX_RemoveItem( WND *wnd, LB_DESCR *descr, INT index )
if (index == -1) index = descr->nb_items - 1;
else if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
/* We need to invalidate the original rect instead of the updated one. */
LISTBOX_InvalidateItems( wnd, descr, index );
LISTBOX_DeleteItem( wnd, descr, index );
/* Remove the item */
@ -1500,7 +1514,7 @@ static LRESULT LISTBOX_RemoveItem( WND *wnd, LB_DESCR *descr, INT index )
LISTBOX_SetSelection( wnd, descr, descr->selected_item + 1, TRUE, FALSE);
}
}
LISTBOX_InvalidateItems( wnd, descr, index );
if (descr->focus_item >= descr->nb_items)
{
descr->focus_item = descr->nb_items - 1;