View Full Version : MSI Custom dialog question

Brandon Lowe
06-16-2008, 09:13 AM
I normall use the installscript installs but we are looking at doing some MSI installs so I'm prototyping some of the custom stuff we do and I have hit the first small speedbump.

I'm creating a custom dialog for our registration info and on that dialog our product key has 5 field of 5 charactors each. How do I make the cursor move the the nect field when the user has entered the 5 charators in the first field and then the next. I do not want the user to have to press the tab key I just want the cursor to move. I have a dialog in installscript that does this but cannot figure it out in MSI.


06-16-2008, 10:16 AM
There's no real way to do this in MSI dialogs. You might be able to hack it by finding the window and playing some tricks with messages, but it would be a rather fragile solution even if it can work. If you're strongly set on having this behavior, and want to do it right, you'll need to examine using an InstallScript or C++ (etc.) dialog, either one out of the sequence (risking size and position mismatches), or as part of a full external UI.

06-16-2008, 10:30 AM
One option might be to use a MaskedEdit control, about which please see the MSI help library...

06-16-2008, 10:37 AM
What about using the masked edit control? We use this with success in the basic MSI setup.

When you add a masked edit in design mode it looks like a single field - you have to sort of look beyond that. How you control the number 'boxes' displayed is by the Masked Edit format itself.

For instance the Masked Edit <^^^^-^^^^-^^^^-^^^^> will display four fields with hyphens between each field. The windows installer will move the cursor from one field to the next once the correct number of characters are in place.

Note that the implementation of the masked edit field is weak lacking any level of flexibility and limited control over the character set and such. For instance I do not have an effective way to prevent users from typing in the hyphen character. However, if all you need is a way to switch between fields automagically then the masked edit is your control of choice.

06-16-2008, 10:38 AM
Curses! Robert beat me to the post!

06-16-2008, 10:44 AM
Oh, the masked edit moves you from field to field automatically? I stand corrected. Much better solution than that which I alluded to above.

Brandon Lowe
06-16-2008, 05:00 PM
Sorry I'm feeling very new here again. How will a masked edit field move me from field to field automagicly?


06-17-2008, 03:50 AM
I am not sure I know enough about the masked edit control to explain how it works. I **think** it works because it is technically only ONE field. However, when you use a character that is considered a constant in the masked edit field, the masked edit control uses the constant as a separator for each visible field to the end user.

Look up in the InstallShield help MaskedEdit Control[Windows Installer]. It will give you the technical specs on the format characters and such.