We need to select the first feature when all controls are created, otherwise they are not properly updated
From: Fabian Maurer dark.shadow4@web.de
We need to select the first feature when all controls are created, otherwise they are not properly updated
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56290 --- dlls/msi/dialog.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index ba8ca526266..0c17918b8d5 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -2415,10 +2415,9 @@ static LRESULT WINAPI MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wPara
static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WCHAR *parent, HTREEITEM hParent ) { - struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); MSIFEATURE *feature; TVINSERTSTRUCTW tvis; - HTREEITEM hitem, hfirst = NULL; + HTREEITEM hitem;
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -2446,9 +2445,6 @@ static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WC if (!hitem) continue;
- if (!hfirst) - hfirst = hitem; - seltree_sync_item_state( hwnd, feature, hitem ); seltree_add_child_features( package, hwnd, feature->Feature, hitem ); @@ -2457,10 +2453,6 @@ static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WC if ( feature->Display % 2 != 0 ) SendMessageW( hwnd, TVM_EXPAND, TVE_EXPAND, (LPARAM) hitem ); } - - /* select the first item */ - SendMessageW( hwnd, TVM_SELECTITEM, TVGN_CARET | TVGN_DROPHILITE, (LPARAM) hfirst ); - info->selected = hfirst; }
static void seltree_create_imagelist( HWND hwnd ) @@ -3498,6 +3490,20 @@ static UINT dialog_create_controls( MSIRECORD *rec, void *param ) return ERROR_SUCCESS; }
+static void select_first_feature( msi_dialog *dialog ) +{ + struct control* control; + + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) + { + if (!wcscmp(control->type, L"SelectionTree")) + { + HTREEITEM first_feature = (HTREEITEM)SendMessageW( control->hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_ROOT, 0 ); + SendMessageW( control->hwnd, TVM_SELECTITEM, TVGN_CARET | TVGN_DROPHILITE, (LPARAM) first_feature ); + } + } +} + static UINT dialog_fill_controls( msi_dialog *dialog ) { UINT r; @@ -3516,6 +3522,8 @@ static UINT dialog_fill_controls( msi_dialog *dialog )
r = MSI_IterateRecords( view, 0, dialog_create_controls, dialog ); msiobj_release( &view->hdr ); + + select_first_feature(dialog); return r; }