msi: Store value of the property with each listbox element.

This makes sure the property is set to the right value even when order in listbox is changed.
oldstable
Peter Oberndorfer 2007-02-06 20:01:08 +01:00 committed by Alexandre Julliard
parent 69448afdc7
commit 9afb0f39a8
1 changed files with 6 additions and 2 deletions

View File

@ -2100,13 +2100,15 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param )
struct msi_listbox_info *info = param;
LPCWSTR value, text;
static int index = 0;
int pos;
value = MSI_RecordGetString( rec, 3 );
text = MSI_RecordGetString( rec, 4 );
info->items[index] = strdupW( value );
SendMessageW( info->hwnd, LB_ADDSTRING, 0, (LPARAM)text );
pos = SendMessageW( info->hwnd, LB_ADDSTRING, 0, (LPARAM)text );
SendMessageW( info->hwnd, LB_SETITEMDATA, pos, (LPARAM)info->items[index] );
index++;
return ERROR_SUCCESS;
}
@ -2146,15 +2148,17 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog,
{
struct msi_listbox_info *info;
int index;
LPCWSTR value;
if( HIWORD(param) != LBN_SELCHANGE )
return ERROR_SUCCESS;
info = GetPropW( control->hwnd, szButtonData );
index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 );
value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 );
MSI_SetPropertyW( info->dialog->package,
control->property, info->items[index] );
control->property, value );
msi_dialog_evaluate_control_conditions( info->dialog );
return ERROR_SUCCESS;