This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Get values of custom control
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2009
05:45 PM
Get values of custom control
I'm using AskOptions with EXCLUSIVE, because I want all radio buttons, however I modified the dialog to have 1 checkbox close to the bottom of the dialog.
I assume I use CtrlGetState to get the value of that checkbox, but that requires the dialog name as the first param. I'm unable to give it the right value I guess, since it always comes back an error. Based on example code using CtrlGetState, they use it only when creating custom dialog boxes so that they can use EzDefineDialog(). Since I modified the dialog, I'm using that ID as the define below, attempted that way and still get the same error.
#define RES_DIALOG_ID 10105 // ID of the custom dialog
...
szDialogName = "ExDialog";
nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
if (CtrlGetState ( szDialogName, 1201 ) = BUTTON_CHECKED) then
MessageBox("Checked", INFORMATION);
endif;
I tried using Err.Description, but it comes up empty.. However the Err.Number gives me -2147467259 and Err.LastDllError gives me 1400. When I look up "-2147467259" for IS, it shows its an error that has to do with IIS7, which my project has nothing to do with IIS. So I'm a bit confused there.
mk:@MSITStore:C:\Program%20Files\InstallShield\2009\Program\0409\HelpLib.chm::/IISVersions.htm
How do I get that value for that checkbox? Am I on the right track? Am I just over thinking this and there is a simpler way?
I assume I use CtrlGetState to get the value of that checkbox, but that requires the dialog name as the first param. I'm unable to give it the right value I guess, since it always comes back an error. Based on example code using CtrlGetState, they use it only when creating custom dialog boxes so that they can use EzDefineDialog(). Since I modified the dialog, I'm using that ID as the define below, attempted that way and still get the same error.
#define RES_DIALOG_ID 10105 // ID of the custom dialog
...
szDialogName = "ExDialog";
nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
if (CtrlGetState ( szDialogName, 1201 ) = BUTTON_CHECKED) then
MessageBox("Checked", INFORMATION);
endif;
I tried using Err.Description, but it comes up empty.. However the Err.Number gives me -2147467259 and Err.LastDllError gives me 1400. When I look up "-2147467259" for IS, it shows its an error that has to do with IIS7, which my project has nothing to do with IIS. So I'm a bit confused there.
mk:@MSITStore:C:\Program%20Files\InstallShield\2009\Program\0409\HelpLib.chm::/IISVersions.htm
How do I get that value for that checkbox? Am I on the right track? Am I just over thinking this and there is a simpler way?
(18) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2009
06:43 PM
Sounds like the right track. The InstallShield directory includes the source for built-in dialog boxes, so if you're modifying a predefined dialog you'll typically make a private copy of the corresponding dialog source in your project, and then modify that copy to reflect the new controls...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2009
02:56 AM
AskOptions itself creates a dialog. you are again defining this dialog. i think thats why its giving the error message.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2009
09:47 AM
Thanks for both your responses..
RobertDickau, I was thinking the same thing, but AskOptions doesn't give me the option to have both Radio Buttons and Check Boxes, so I have to modify the dialog to have single check box. AskOptions has the BOOL (int) params references that are return the values of either EXCLUSIVE or NONEXCLUSIVE. if I'm mix matching them and call AskOptions with EXCLUSIVE, I don't have the option to get the BOOL (int) reference pointer anymore for the NONEXCLUSIVE values.
So how to I get the NONEXCLUSIVE value?
RobertDickau, I was thinking the same thing, but AskOptions doesn't give me the option to have both Radio Buttons and Check Boxes, so I have to modify the dialog to have single check box. AskOptions has the BOOL (int) params references that are return the values of either EXCLUSIVE or NONEXCLUSIVE. if I'm mix matching them and call AskOptions with EXCLUSIVE, I don't have the option to get the BOOL (int) reference pointer anymore for the NONEXCLUSIVE values.
So how to I get the NONEXCLUSIVE value?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2009
02:52 PM
No one here uses both radio buttons and check boxes on the same screen?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2009
04:08 PM
I've just about given up on this.. This seems to be a little thing I over looking in a huge way.. I've now tried two other ways of doing it with no success.
#define RES_DIALOG_ID 12020 // ID of the custom dialog
....
szDialogName = "InstallUpgrade";
nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);
// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
SetWindowText (hwndDlg, "Select Options");
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, ID_STA_DESC,
"Select and/or clear options. Then click Next.");
// Options are cleared by default, so select Options 1 and 2.
if (CtrlSetState (szDialogName, ID_OP1_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("First call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
elseif (CtrlSetState(szDialogName, ID_OP2_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("Second call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
endif;
case RES_PBUT_NEXT:
bDone = TRUE;
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
case RES_PBUT_BACK:
bDone = TRUE;
endswitch;
until bDone;
switch (CtrlGetState ( szDialogName, ID_OP1_CHECK ))
case BUTTON_CHECKED:
MessageBox("Checked", INFORMATION);
case BUTTON_UNCHECKED:
MessageBox("UnChecked", INFORMATION);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, INFORMATION);
endswitch;
Well, this allows me to use CtrlGetState, but always has 4 checkboxes on it, I can't add a radio button or remove 2 of the checkboxes I don't want..
Second way......
So me being a logical thinker, right clicked on "SdFinishUpdateReboot", cloned, renamed to "igt_MyDlg". Thinking I can modify this up, get the basic functionality that I'm wanting, but now I'm finding IS doesn't know what igt_MyDlg is.. What good is cloning, renaming, if I can't access it the same way?
Looks like that the help is missing half the functionality I need to use. I guess I'll just stick with Wise. This is just too frustrating trying to use a language with a lack of documentation and it's just not intuitive. Sad too, because I really liked the flexibility. Guess after software has been around for as many years as IS, that they forget about the guy that hasn't used their product or have anyone to help direct the situation.
#define RES_DIALOG_ID 12020 // ID of the custom dialog
....
szDialogName = "InstallUpgrade";
nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);
// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
SetWindowText (hwndDlg, "Select Options");
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, ID_STA_DESC,
"Select and/or clear options. Then click Next.");
// Options are cleared by default, so select Options 1 and 2.
if (CtrlSetState (szDialogName, ID_OP1_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("First call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
elseif (CtrlSetState(szDialogName, ID_OP2_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("Second call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
endif;
case RES_PBUT_NEXT:
bDone = TRUE;
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
case RES_PBUT_BACK:
bDone = TRUE;
endswitch;
until bDone;
switch (CtrlGetState ( szDialogName, ID_OP1_CHECK ))
case BUTTON_CHECKED:
MessageBox("Checked", INFORMATION);
case BUTTON_UNCHECKED:
MessageBox("UnChecked", INFORMATION);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, INFORMATION);
endswitch;
Well, this allows me to use CtrlGetState, but always has 4 checkboxes on it, I can't add a radio button or remove 2 of the checkboxes I don't want..
Second way......
So me being a logical thinker, right clicked on "SdFinishUpdateReboot", cloned, renamed to "igt_MyDlg". Thinking I can modify this up, get the basic functionality that I'm wanting, but now I'm finding IS doesn't know what igt_MyDlg is.. What good is cloning, renaming, if I can't access it the same way?
Looks like that the help is missing half the functionality I need to use. I guess I'll just stick with Wise. This is just too frustrating trying to use a language with a lack of documentation and it's just not intuitive. Sad too, because I really liked the flexibility. Guess after software has been around for as many years as IS, that they forget about the guy that hasn't used their product or have anyone to help direct the situation.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
08:20 AM
Quite right that the implementation details of the predefined dialogs aren't documented. In this case, it's probably simpler to implement what you're describing from scratch, rather than tweaking the AskOptions internals. The help topic "Using InstallScript to Implement Custom Dialogs" might be the best brief walkthrough.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
09:22 AM
Thanks, well, I tried that and again this help is under the assumption I've been doing this a while or it's missing some steps.
I created the CustomDialog.rul, I then added the following lines..
---------
prototype NUMBER CustomDialog( );
// control identifiers
function NUMBER CustomDialog( )
begin
end;
---------
I then added #include "CustomDialog.rul" to my setup.rul. So far so good..
Then I add the following to my CustomDialog.rul.
---------
#define BUTTON_NEXT 1
#define BUTTON_BACK 12
#define BUTTON_CANCEL 9
---------
So now it looks like this:
---------
#define BUTTON_NEXT 1
#define BUTTON_BACK 12
#define BUTTON_CANCEL 9
prototype NUMBER CustomDialog( );
// control identifiers
function NUMBER CustomDialog( )
begin
end;
---------
Now here is well the Help assumes I know what I'm doing. It's talking about the dialog editor, which ok, I can get to the preset dialogs, but I don't see how to get to the dialog editor for this custom dialog.
Also when I define BUTTON_NEXT as 1, is it always 1. If so where do I find the numeric values for all controls? When I search BUTTON_NEXT it takes me to "InstallScript Language Reference". So I'm assuming I can name this define anything as long as it's defined as 1? Which as a C++ developer, this would just blow my mind.
I created the CustomDialog.rul, I then added the following lines..
---------
prototype NUMBER CustomDialog( );
// control identifiers
function NUMBER CustomDialog( )
begin
end;
---------
I then added #include "CustomDialog.rul" to my setup.rul. So far so good..
Then I add the following to my CustomDialog.rul.
---------
#define BUTTON_NEXT 1
#define BUTTON_BACK 12
#define BUTTON_CANCEL 9
---------
So now it looks like this:
---------
#define BUTTON_NEXT 1
#define BUTTON_BACK 12
#define BUTTON_CANCEL 9
prototype NUMBER CustomDialog( );
// control identifiers
function NUMBER CustomDialog( )
begin
end;
---------
Now here is well the Help assumes I know what I'm doing. It's talking about the dialog editor, which ok, I can get to the preset dialogs, but I don't see how to get to the dialog editor for this custom dialog.
Also when I define BUTTON_NEXT as 1, is it always 1. If so where do I find the numeric values for all controls? When I search BUTTON_NEXT it takes me to "InstallScript Language Reference". So I'm assuming I can name this define anything as long as it's defined as 1? Which as a C++ developer, this would just blow my mind.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
10:16 AM
Looking at the help topics in the TOC under Creating Installations > Defining the End-User Experience > Working with Dialogs > ... should help move things along. To create the new, blank, script-based dialog, for example, please see "Creating New Dialogs in InstallScript and InstallScript MSI Projects". The dialog editor should show the ID for any dialog or control.
And yes, the #define names are unimportant as long as the numeric IDs line up.
And yes, the #define names are unimportant as long as the numeric IDs line up.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
10:24 AM
Thanks, but I'm now going back to my original problem. Creating a new dialog like this is the same as right clicking and saying clone. However, the new Resource I created, based on "Using InstallScript to Implement Custom Dialogs", is not part of this dialog, nor can I access the check box / radio buttons within it.
I'm missing a step, I know I am, just not finding the link.
I'm missing a step, I know I am, just not finding the link.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
10:28 AM
I'm looking at the help, "Creating Custom Dialogs for an InstallScript or InstallScript MSI Project". This follows the same steps your speaking of.
Create the new dialog, Add Control, Use InstallScript. However, I'm not seeing the tie between the script and the dialog.
Create the new dialog, Add Control, Use InstallScript. However, I'm not seeing the tie between the script and the dialog.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
10:41 AM
The dialog resource ID you pass to EzDefineDialog and the control resource IDs you pass to the CtrlGetZzzz and CtrlSetZzzz functions are what associate the dialog editor work with the script.
To indicate when to invoke your custom dialog at run time, you'll add a call to your custom dialog function in OnFirstUIBefore or the like.
To indicate when to invoke your custom dialog at run time, you'll add a call to your custom dialog function in OnFirstUIBefore or the like.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
11:32 AM
Yea.. I thought I was onto something there for 20 min or so.. I think I'm on the right track, just missing something still.
On the new dialog I created, I see it says the ID for this dialog is 12010. However, based on help it says I'm supposed to use 0 for the DIALOG_ID used in EzDefineDialog(). Tried both ways and they fail.
So I difined:
--------------------
#include "CustomDialog.rul"
#define RES_DIALOG_ID 12010 // ID of the custom dialog
#define RES_PBUT_BACK 1327 // ID of Back button
#define RES_PBUT_NEXT 1328 // ID of Next button
#define RES_PBUT_CANCEL 1329 // ID of Cancel button
#define ID_OP1_RADIO 1324 // ID of Option 1 radio button
#define ID_OP2_RADIO 1354 // ID of Option 2 radio button
#define ID_OP1_CHECK 1326 // ID of Option 1 check box
#define ID_STA_DESC 1330 // ID of static text description
--------------------
Based on the controls within the custom dialog, the numbers above are correct.
I then later in the Setup script used:
--------------------
szDialogName = "CustomDialog";
nResult = EzDefineDialog (szDialogName, "", szDialogName, RES_DIALOG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, SEVERE);
abort;
case DLG_INIT:
// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);
// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
SetWindowText (hwndDlg, "Select Options");
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, ID_STA_DESC,
"Select and/or clear options. Then click Next.");
// Options are cleared by default, so select Options 1 and 2.
if (CtrlSetState (szDialogName, ID_OP1_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("First call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
elseif (CtrlSetState(szDialogName, ID_OP1_RADIO, BUTTON_CHECKED) < 0) then
MessageBox ("Second call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
endif;
case RES_PBUT_NEXT:
switch (CtrlGetState ( szDialogName, ID_OP1_CHECK ))
case BUTTON_CHECKED:
MessageBox("Checked", INFORMATION);
case BUTTON_UNCHECKED:
MessageBox("UnChecked", INFORMATION);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, INFORMATION);
endswitch;
bDone = TRUE;
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
case RES_PBUT_BACK:
bDone = TRUE;
endswitch;
until bDone;
--------------------
nResult returns a DLG_ERR right off the bat.
On the new dialog I created, I see it says the ID for this dialog is 12010. However, based on help it says I'm supposed to use 0 for the DIALOG_ID used in EzDefineDialog(). Tried both ways and they fail.
So I difined:
--------------------
#include "CustomDialog.rul"
#define RES_DIALOG_ID 12010 // ID of the custom dialog
#define RES_PBUT_BACK 1327 // ID of Back button
#define RES_PBUT_NEXT 1328 // ID of Next button
#define RES_PBUT_CANCEL 1329 // ID of Cancel button
#define ID_OP1_RADIO 1324 // ID of Option 1 radio button
#define ID_OP2_RADIO 1354 // ID of Option 2 radio button
#define ID_OP1_CHECK 1326 // ID of Option 1 check box
#define ID_STA_DESC 1330 // ID of static text description
--------------------
Based on the controls within the custom dialog, the numbers above are correct.
I then later in the Setup script used:
--------------------
szDialogName = "CustomDialog";
nResult = EzDefineDialog (szDialogName, "", szDialogName, RES_DIALOG_ID);
// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, SEVERE);
abort;
case DLG_INIT:
// Get the dialog's window handle.
hwndDlg = CmdGetHwndDlg (szDialogName);
// Set the window title. SetWindowText is prototyped
// in Winsub.h and defined in Winsub.rul.
SetWindowText (hwndDlg, "Select Options");
// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, ID_STA_DESC,
"Select and/or clear options. Then click Next.");
// Options are cleared by default, so select Options 1 and 2.
if (CtrlSetState (szDialogName, ID_OP1_CHECK, BUTTON_CHECKED) < 0) then
MessageBox ("First call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
elseif (CtrlSetState(szDialogName, ID_OP1_RADIO, BUTTON_CHECKED) < 0) then
MessageBox ("Second call to CtrlSetState failed.", SEVERE);
bDone = TRUE;
endif;
case RES_PBUT_NEXT:
switch (CtrlGetState ( szDialogName, ID_OP1_CHECK ))
case BUTTON_CHECKED:
MessageBox("Checked", INFORMATION);
case BUTTON_UNCHECKED:
MessageBox("UnChecked", INFORMATION);
case DLG_ERR:
MessageBox(Err.Source + " (" + Err.Number + ") " + Err.LastDllError + ": " + Err.Description, INFORMATION);
endswitch;
bDone = TRUE;
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
case RES_PBUT_BACK:
bDone = TRUE;
endswitch;
until bDone;
--------------------
nResult returns a DLG_ERR right off the bat.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
11:42 AM
Do you know where I can find an example of a simple script that has a custom dialog with 2 radio buttons and a checkbox and the code on how to access them? If that existed, I could figure out my missing link.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
11:48 AM
I think I got it.. doh.. Added ISUSER to the EzDefineDialog call. Seems help on EzDefineDialog says I can leave it blank and IS will figure it out, but I guess it doesn't.
I want to thank you for spending so much time with this. Talking to someone through this helps. I just about gave up on all of it.
I want to thank you for spending so much time with this. Talking to someone through this helps. I just about gave up on all of it.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
12:24 PM
Great news! I'm glad things are moving forward; thanks for following up...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2009
02:33 PM
I've created a dialog example for those that were trying to follow this and are just as, if not more confused. I did find I didn't need the CustomDialog class at all. Wasn't being used for nothing. I deleted it from the project and everything seem to work the same way.
I've added Images, Step 1 through 7. Just screen shots.
http://www.chizl.com/chizl/downloads/InstallShield_MyDialogTest.zip - (740kb)
I'll most likely will write something up later with more detail for people to see, because now I'm going to get quested by coworkers etc.. Hopefully this will help someone else going through the same issues..
I've added Images, Step 1 through 7. Just screen shots.
http://www.chizl.com/chizl/downloads/InstallShield_MyDialogTest.zip - (740kb)
I'll most likely will write something up later with more detail for people to see, because now I'm going to get quested by coworkers etc.. Hopefully this will help someone else going through the same issues..
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 11, 2009
09:33 AM
I get what the Class is for now. To help clean up the code a bit. Call one function instead of handling the custom dialog from the main function.
Thanks for all your help.
Thanks for all your help.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 11, 2009
10:05 AM
After creating this custom dialog, get my results, I call EndDialog().. However if they hit back within this custom dialog, then next, the dialog isn't the skin dialog anymore. It looses all graphics and color, however it has all the same information on it. What did I do wrong?