Use WiX browser dialog to set edit box value

前端 未结 6 2333
醉酒成梦
醉酒成梦 2020-12-15 18:11

I\'m trying to create a WiX installer dialog that provides a series of textboxes that users need to fill in with directory locations.

What I would like to do is put

6条回答
  •  借酒劲吻你
    2020-12-15 19:00

    I did end up finding a way to do it completely in Wix. Wix comes with a browse dialog called BrowseDlg. Here's what I did:

    1. I created a dialog that includes a PathEdit control and PushButton control. Notice that the PathEdit control has the Indirect property set to yes. This means that whatever you set Property to is just a pointer to something else.

          
              
                  {\WixUI_Font_Title}Please select the directory you want to backup.
              
              
              
              
              
              
              
                  1
              
              
                  
              
          
      
    2. The browse dialog (that we'll eventually get to) expects to set an object in the Directory table, so we need to create a Directory object that will only be used to hold the value we browse to. Since we won't put any components in it, nothing on the file system will change relating to the directory we choose. I call mine TARGETBACKUPDIRECTORY.

          
              
              
              ...
          
      
    3. Now we need to create a property that points to the Directory object.

      
      
    4. We now need to make sure that the _BrowserProperty property is properly bound to BACKUPDIRECTORY (because it points to the Directory object we want set) before this dialog opens. If you don't, you will get an error during the install process when you attempt to open the dialog. In my example, PrevDlg is a dialog that appears before BackupConfigDlg. What's happening here is that when the Next button is pushed, I set the _BrowserProperty property to BACKUPDIRECTORY, I then open the dialog. It must take place in that order so I use the Order property to enforce it. I do the same thing when the browse button is pushed, not sure I need to do, but I do it just for safe measure.

          1
          1
          
          
          
          
      

    That's what worked for me.

提交回复
热议问题