Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

So what really happens when you publish SetTargetPath?

30 views
Skip to first unread message

Tony

unread,
May 14, 2008, 9:21:28 PM5/14/08
to
I am using latest Wix 3 beta to create my dialogs and to publish
events but I believe the problem that I am encounterinmg is more
general (as always, the real problem is that Windows Installer
documentation is a special cypher, but that's already well known) :

can anybody point out any good, detailed introduction to creating and
using directory browser dialog?

The specific problem that I am having appears when using this
statement in Wix BrowseDlg:

<Control Id="OK" Type="PushButton" X="304" Y="243" Width="56"
Height="17" Default="yes" Text="[ButtonText_OK]">
<Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</
Publish>
<Publish Event="EndDialog" Value="Return">1></Publish>
</Control>

I get the error 2872: The argument of the CheckPath control event on
dialog [2] is invalid. Where "CheckPath" can be the CheckTargetPath,
SetTargetPath or the CheckExistingTargetPath control events.

In the MSI log I can see that _BrowseProperty is initialized to my
intended installation directory: "C:\Program Files\MyDir". The error
kind of makes sense because this directory does not exist yet. I
certainly haven't done anything to create it.

But I get the error 2872 even if I force _BrowseProperty to be just "C:
\Program Files". This directory exists.

SP what is developer supposed to do after publishing SetTargetPath
event with the path that does not exist? Who subscribes to that event?
What is supposed to be done by whom and when? Is some custom action
supposed to be invoked?

Richard [Microsoft Windows Installer MVP]

unread,
May 14, 2008, 11:10:30 PM5/14/08
to
[Please do not mail me a copy of your followup]

Tony <ton...@gmail.com> spake the secret code
<027bf946-5e73-4fd2...@r66g2000hsg.googlegroups.com> thusly:

> <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56"
>Height="17" Default="yes" Text="[ButtonText_OK]">
> <Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</
>Publish>

What happens if you change "[_BrowseProperty]" to "_BrowseProperty"?
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>

Tony

unread,
May 15, 2008, 10:13:39 AM5/15/08
to
On May 14, 11:10 pm, legalize+jee...@mail.xmission.com (Richard

[Microsoft Windows Installer MVP]) wrote:

> What happens if you change "[_BrowseProperty]" to "_BrowseProperty"?

If I do that then after a long wait a message box pops up saying:

The path INSTALLDIR is not valid. Please specify a valid path.

_BrowseProprty is initialized from INSTALLDIR property like this (this
is a modification of Wix sample):

<Publish Dialog="InstallDirDialog" Control="ChangeFolder"
Property="_BrowseProperty" Value="INSTALLDIR" Order="1">1</Publish>
<Publish Dialog="InstallDirDialog" Control="ChangeFolder"
Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

INSTALLDIR is the property that contains the path, rather than
containing the name of another property that keeps the path.

Tony

unread,
May 15, 2008, 10:32:43 AM5/15/08
to
Thanks for giving me idea what to try Richard - I finally got it to
work but I really don't understand why is all this path property
indirection necessary?!

What finally worked:

1) I changed "_BrowseProperty" back to "[_BrowseProperty]"

2) InstallDirDialog now uses indirected path property WIXUI_INSTALLDIR
like:


<Publish Dialog="InstallDirDialog" Control="ChangeFolder"

Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</
Publish>

3) Finally it refers to INSTALLDIR by adding <Property
Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" /> definition

Richard [Microsoft Windows Installer MVP]

unread,
May 15, 2008, 12:34:54 PM5/15/08
to
[Please do not mail me a copy of your followup]

Tony <ton...@gmail.com> spake the secret code

<8c847589-a0db-4c97...@27g2000hsf.googlegroups.com> thusly:

>Thanks for giving me idea what to try Richard - I finally got it to
>work but I really don't understand why is all this path property
>indirection necessary?!

The reason that SetTargetPath has a level of indirection to it is so
that you can reuse the same "browse for folder" dialog for many
different folders without having to duplicate the dialog.

In the ControlEvent table, a SetTargetPath event row expects the name
of the property containing the path in the Argument column. If the
Argument column contains [MyProperty] instead of just MyProperty, then
MyProperty contains the name of the property that will hold the path,
rather than the path itself.

0 new messages