msi: Add an initial implementation of the PathEdit control

James Hawkins truiken at gmail.com
Wed Aug 23 18:30:14 CDT 2006


Hi,

This is the first fix (of many) for bug 4403.
http://bugs.winehq.org/show_bug.cgi?id=4403

Changelog:
* Add an initial implementation of the PathEdit control.

 dlls/msi/dialog.c |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 67 insertions(+), 2 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 7eef61f..a8219a3 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -65,6 +65,7 @@ struct msi_control_tag
     float progress_current;
     float progress_max;
     WCHAR name[1];
+    DWORD attributes;
 };
 
 typedef struct msi_font_tag
@@ -1354,10 +1355,74 @@ static UINT msi_dialog_progress_bar( msi
 
 /******************** Path Edit ********************************************/
 
+static UINT msi_dialog_pathedit_handler( msi_dialog *dialog,
+                msi_control *control, WPARAM param )
+{
+    UINT sz, r;
+    LPCWSTR prop;
+    LPWSTR buf, indirect = NULL;
+
+    if( HIWORD(param) != EN_KILLFOCUS )
+        return ERROR_SUCCESS;
+
+    sz = 0x20;
+    buf = msi_alloc( sz*sizeof(WCHAR) );
+    while( buf )
+    {
+        r = GetWindowTextW( control->hwnd, buf, sz );
+        if( r < (sz-1) )
+            break;
+        sz *= 2;
+        buf = msi_realloc( buf, sz*sizeof(WCHAR) );
+    }
+
+    prop = control->property;
+    if ( control->attributes & msidbControlAttributesIndirect )
+    {
+        indirect = msi_dup_property( dialog->package, control->property );
+        prop = indirect;
+    }
+
+    /* FIXME: verify the new path */
+
+    MSI_SetPropertyW( dialog->package, prop, buf );
+
+    TRACE("edit %s contents changed, set %s\n", debugstr_w(control->name),
+          debugstr_w(prop));
+
+    msi_free( buf );
+    msi_free( indirect );
+
+    return ERROR_SUCCESS;
+}
+
 static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
 {
-    FIXME("not implemented properly\n");
-    return msi_dialog_edit_control( dialog, rec );
+    msi_control *control;
+    LPCWSTR prop;
+    LPWSTR val, indirect = NULL;
+
+    control = msi_dialog_add_control( dialog, rec, szEdit,
+                                      WS_BORDER | WS_TABSTOP );
+    control->handler = msi_dialog_pathedit_handler;
+    control->attributes = MSI_RecordGetInteger( rec, 8 );
+
+    prop = (LPWSTR)MSI_RecordGetString( rec, 9 );
+    if ( prop )
+        control->property = strdupW( prop );
+
+    if ( control->attributes & msidbControlAttributesIndirect )
+    {
+        indirect = msi_dup_property( dialog->package, control->property );
+        prop = indirect;
+    }
+
+    val = msi_dup_property( dialog->package, prop );
+    SetWindowTextW( control->hwnd, val );
+    msi_free( val );
+    msi_free( indirect );
+
+    return ERROR_SUCCESS;
 }
 
 /* radio buttons are a bit different from normal controls */
-- 
1.4.2


More information about the wine-patches mailing list