Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Resusing a custom dialog


7 replies to this topic

BobRouse

BobRouse
  • Members
  • 82 posts

Posted 10 May 2001 - 18:57

I am using InstallShield Professional WIE 2.0. I have created a custom dialog. It contains a login and masked password and I would like to use it several times in the install. I would like to:
a) Pre-load the text boxes in the dialog from the InstallScript.
b) Display the dialog box from the InstallScript.
c) Determine which button was clicked to close the dialog.
d) Retrieve the values from the text boxes.

Some questions:
1) Is this possible?
2) What do I use for the "Event" on the Back and Next buttons? If I get a Next, I may be loading the same dialog, with different values.
3) Since I have the text box text values "linked" to entries in the string table, can I change those values within the script (before loading up the box)? IE: Is it possible to change string table values "on the fly"?
4) Can I get the value of the button clicked (similar to using "SdShowDlgEdit2()") to determine my program flow?
5) The Custom Dialog functions refer to IDs for the dialog and controls. Where do I find these? The dialog is created within InstallShield.
6) Would the DLL to specify in EzDefineDialog() be "_isuser.dll"?

I know I'm asking a lot of questions here. Thanks in advance for any help.


BobRouse

BobRouse
  • Members
  • 82 posts

Posted 24 July 2001 - 15:37

In case anyone reading these postings is interested, here is what I ended up doing:
1) Created the dialog
2) Set the "Value" property for the controls I wanted to read from and write to at runtime to public properties, eg: [TITLE], [LOGIN]
3) Set the Prev, Next, and Cancel buttons to set a public property ([DIALOG_EXIT]), then to end the dialog.
4) In the script, set the properties using MsiSetProperty()
5) Displayed the dialog using MsiDoAction()
6) Retrieved the values from the screen properties and the value of DIALOG_EXIT by using MsiGetProperty().
I put all of this in a script function and passed the dialog values and "button pushed" as BYREF parameters. This made using the dialog in other script functions as simple as calling SdShowDlgEdit3().

Bob Rouse
Netuitive, Inc.


kc

kc
  • Members
  • 8 posts

Posted 10 October 2001 - 09:05

BobRouse,
In step 5, u mentioned using MsiDoAction to display the dialog. I tried the same but fail. any steps that I missed out? Pls help. Thanks

KC


BobRouse

BobRouse
  • Members
  • 82 posts

Posted 10 October 2001 - 14:30

Here is the code I used. My custom dialog box (named DBLoginInfo) gets login values, and has a masked edit box for the password. I put this code in a separate function to make it easier to reuse. I pass in hInstall, the desc, and instructions byval, and login and password byref.

// Set values into DBLoginInfo and display
MsiSetProperty(hInstall, "DB_DESC", svDesc);
MsiSetProperty(hInstall, "DB_INSTRUCTIONS", svInstruct);
MsiSetProperty(hInstall, "DB_USER", svLogin);
MsiSetProperty(hInstall, "DB_PSWD", svPswd);
       
// Display box and wait for result:
MsiDoAction(hInstall, "DBLoginInfo");

// Get button used to exit the dialog
MsiGetProperty(hInstall, "DIALOG_EXIT", svExitCode, nvSize);
nvSize = nvSize + 1;
Resize(svExitCode, nvSize);
MsiGetProperty(hInstall, "DIALOG_EXIT", svExitCode, nvSize);
switch(svExitCode)
   case "NEXT":
       nvDBLoginButton = NEXT;
   case "BACK":
       nvDBLoginButton = BACK;
   default:
       nvDBLoginButton = CANCEL;
endswitch;
 
// If NEXT, get values
if nvDBLoginButton = NEXT then
   // etc....    


BobRouse

BobRouse
  • Members
  • 82 posts

Posted 10 October 2001 - 16:50

One more thing. Make sure you have this line near the top of your script:

#include "CustomDlg.h"


kc

kc
  • Members
  • 8 posts

Posted 11 October 2001 - 10:52

Bob,
Thanks for your reply.

It works aft adding #include "CustomDlg.h" and calling the CA from UI sequence instead of Execute sequence. But I have another problem here.

Desired design: After the dialog is display, clicking OK button will trigger another CA that will perform values verification. If any value is incorrect, a new dialog will appear for correction.

The behaviour of the OK button is set as
Event             Argument    Condition
------------------------------------------
DoAction       MyCA            1
EndDialog    Return          1
But error msg appears.

I notice that the error only occurs if this behaviour is set at the dialog that is called up by a CA. If the dialog(with the same behaviour) is called from the UI seq, no error occurs.

Pls help. Thanks.

KC

(Edited by kc at 6:08 pm on Nov. 13, 2001)


BobRouse

BobRouse
  • Members
  • 82 posts

Posted 11 October 2001 - 15:56

There may be others here on this forum who can give you the reason for this problem. All I can offer is a suggested workaround. Try removing the
   DoAction MyCA
from the dialog, and do it in the CA that calls the dialog (after MsiDoAction completes). The net result should be the same. The downside to this is that it breaks the UI chain. Once you insert a CA into the UI sequence (rather than a dialog), you can no longer go backwards. This may not be problem for you, if you are already using a CA in your UI sequence.