cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
suzhoubeauty
Level 2

How to control input on customized dialog?

Edition: Installshield 2010
Project Type: installscript project

summary: I have designed a project which requires user to input serial number during installation, and I customized the dialog for input serial number. Everything has gone well, but there's one thing I feel not satisfied: I design 4 textfields(edit fields) for serial number, a serial number is of 16 digits, so every textfield, in a perfect status, should only be input 4 digits.

The problem is, how can I control the input for every textfield, for example, if user input 123456 in one textfield, 56 should be ingored; and how can put focus on the next textfield if one textfield has input 4 digits?
Labels (1)
0 Kudos
(3) Replies
mirik222
Level 5

Hi.

In InstallScript/InstallScript MSI dialogs you can catch LBN_SELCHANGE notification for edit boxes and after that change the control text back or move focus to another control.

nId = WainOnDialog(szDlg);
switch(nId)
...
case EDITBOXID:
if(CtrlGetSubCommand (szDlg) = EDITBOX_CHANGE) then
CtrlGetText(szDlg,EDITBOXID,szText);
if(StrLengthChars(szText) > 4) then
CtrlSetText(...);
hwndCtrl = GetDlgItem(hwndDlg,EDITBOXID_2);
SetFocus(hwndCtrl);
endif;
endif;
...
endswitch;
0 Kudos
chrislynn5
Level 6

why allow them to enter more characters than you want to allow? Maybe I'm missing something, the textbox has a property Max. Length..
As for focus, why move the focus. Why not just create a tab order that makes sense. Most UI designs struggle with moving a user automatically from one field to another (i.e. my favorite is phone number when a developer breaks it into 3 textboxes).
0 Kudos
mirik222
Level 5

If you can use Max Length and Tab Order you can go with it.
I just don't like MSI and try first to do everything with InstallScript.
0 Kudos