PDA

View Full Version : Dialog Sequencing



Rakesh_mahajan
06-10-2004, 05:05 AM
Hi all,

I am new to installshield X.
I am creating a universal Installer..
I want to conditionaly show the dialog..
I have created 4 dialog..
Main dialog will check for a condition and according to it it will show second or third dialog ..
Pl anybody suggest me how can i do that?

Thanks and Regards,
Rakesh

CharlesW
06-10-2004, 11:45 AM
In your "main dialog", set a "flag" such as a java system property if your condition is met. You can then place a string comparison condition on the other dialogs which checks for the existance of this flag. If the flag is set, then the dialog will display. Otherwise, the string comparison condition will evaluation to false, and the dialog will be skipped.

Rakesh_mahajan
06-11-2004, 12:56 AM
Thanks Charles....
Where and how i can declare a string variable and how i can use this in condition?
Please also tell me about the event where i will have to create this variable which i am going to use into condition of a dialog...

If you can give me some code snipplet then it will be very helpful to me..
Thanks again for quick response..

CharlesW
06-11-2004, 11:26 AM
Attached, you will find a sample project. This project consists of 4 dialogs. On the first dialog you will find 2 check boxes. If check box A is selected, then panel A will display. If check box B is selected, then panel B will display. The event code illustrates how to set a system property and a variable.

When looking at the project, look at the conditions placed on panelA and panelB under the sequences view. In addition, look at the event code for the start panel under the dialogs view (select the swing events tab)

Hopefully, this should be enough to get you started.

Rakesh_mahajan
06-14-2004, 01:52 AM
Hi,
I downloaded the project but while trying to open it getting following error:

ProjectException: An error occurred parsing the project.(com.jxml.quick.QPE:java.lang.IllegelArgumentException:array element type mismatch)

It may be because evaluation version of Installhield X ?

Can you pl tell me in words how can i put a string condition on dialog and where this variable(which will be used in string condition) is to be declared?

Thanks & Regards,
Rakesh

darkestsky
06-15-2004, 09:03 AM
Hi,

i m working on a similar problem. I downloaded the uip and was able to open it but i do not see the queryExit event , neither the place where the settings for variables had been made.

kindly clarify.

thnx.

CharlesW
06-15-2004, 09:29 AM
The code I used was as follows:

/*Approach A: Set system property "showA" this will later be queried by the string comparison placed on Panel A. If checked, showA will be set to true, otherwise false. To resolve system property in condition, use $J(propertyName)*/

ISCheckBox checkA = (ISCheckBox)arg0.getISPanel().getControl("ISCheckBoxDef1");
if (checkA.isSelected())
System.setProperty("showA", "true");
else
System.setProperty("showA", "false");


//Approach B: OR you can set a variable. To resolve variable in condition, use $V(variableName)
ISCheckBox checkB = (ISCheckBox)arg0.getISPanel().getControl("ISCheckBoxDef2");

try {
if (checkB.isSelected())
arg0.getServices().getISDatabase().setVariableValue( "showB", "true");
else
arg0.getServices().getISDatabase().setVariableValue( "showB", "false");

}catch (Exception e) {
arg0.getServices().logEvent(this, Log.ERROR, e);
}

Of course, your "if" statement would probably vary depending upon what you wished to check. In this case, I was checking the selected state of a checkbox control.

To add this code, go under "user interface->Dialogs" and select your dialog. By default, you will see the layout view of the panel. Select the "swing events" tab and in the "event" drop down list, select queryExit. Keep the default settings when prompted.

After adding the code, go to "behavior and logic->sequences" and select the panel which you wish to conditionally display. Select the "conditions" property and add a string comparison condition. Use the following property values for the condition:

IF using approach A:
Evaluate=Must be met
Immutable = false
Compare text = true
Operation= Equals - Case Insensitive
Source= $J(showA)

IF using approach B:
Evaluate=Must be met
Immutable = false
Compare text = true
Operation= Equals - Case Insensitive
Source= $V(showB)

darkestsky
06-15-2004, 10:40 AM
thanx, it was very much explainatory but my scenario is that i am not creating the feature dialog, its system generated . i only gave the featrue name.

this is snippet of swing panel :

package com.installshield.pegarules_process_simulator.event.dialog.swing;


import java.util.Vector;

import com.installshield.event.*;
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;
import com.installshield.product.service.product.*;
import com.installshield.product.*;
import com.installshield.util.*;

public class PanelFeature {

/**
* Called when panel is displayed in console mode when "options-record" or
* "options-template" command line option is used.
*/
public void generateOptionsEntriesFeature(ISOptionsContext context) {

ProductTree tree = null;
try {
ProductService service =
(ProductService)context.getService(ProductService.NAME);
tree =
service.getSoftwareObjectTree(
ProductService.DEFAULT_PRODUCT_SOURCE,
new String[] { "active", "displayName", "visible" });
}
catch (ServiceException e) {
LogUtils.getLog().logEvent(this, Log.ERROR, e);
return;
}

// assert tree != null
Vector entries = context.getOptionEntries();
ProductTreeIterator iter =
ProductTreeIteratorFactory.createFeatureIterator(tree.getRoot());

for (ProductBean cur = iter.getNext(iter.begin());
cur != iter.end();
cur = iter.getNext(cur)) {
// assert safe-cast
ProductFeature feature = (ProductFeature)cur;
String displayName =
context.resolveString(
"$P(" + feature.getBeanId() + ".displayName)");
// feature entry title
String title =
LocalizedStringResolver.resolve(
"com.installshield.product.i18n.ProductResources",
"FeaturePanel.oteTitle",
new String[] { displayName });
// setup type entry doc
String doc =
LocalizedStringResolver.resolve(
"com.installshield.product.i18n.ProductResources",
"FeaturePanel.oteDoc",
new String[] { displayName, feature.getBeanId()});
// setup type entry option
String option = "-P " + feature.getBeanId() + ".active=";
if (context.getValueType() == WizardBean.TEMPLATE_VALUE) {
option
+= LocalizedStringResolver.resolve(
"com.installshield.wizard.i18n.WizardResources",
"WizardBean.valueStr");
}
else {
option += feature.isActive();
}
entries.addElement(new OptionsTemplateEntry(title, doc, option));
}

}

So from here I couldn't judge what is the name of the checkbox. Also system is not recognising 'ISCheckBox' class. do we have to import any package for that?

CharlesW
06-15-2004, 11:16 AM
Are you trying to display a panel conditionally, based upon the selected features? If so, then you could simply use $P(featureID.active) in your string comparison condition. This will give you the active state of a featue. If a feature is active, then this will resolve to true; otherwise it will resolve to "false:. If this is the case, then your string comparison condition would have the following values:

Evaluate=Must be met
Immutable = false
Compare text = true
Operation= Equals - Case Insensitive
Source= $P(featureID.active)

Where "featureID" is the bean ID of the feature that you wish to check.

darkestsky
06-15-2004, 01:09 PM
thanx a ton charles, that did all the work ! ;-)

there is no need for coding if we can explore options !
But to edit/retrieve the inbuilt strings or button, we would need to go inside IDE code, i suppose.

I need to display "readme.txt" if the user wishes to after install. So i created a dialog with contents of my readme.txt(link to file) , but then do i need to add control buttons before its display n after it is displayed. Or else, I could just give an option"do u want to read the readme.txt" and after "yes" it should open it in notepad. But then how should i write the code for that.

Also when we select "typical " or "custom" for features, there is inbuilt string text displayed which i guess we are not allowed to alter "product resources" category. So do we need to create the complete dialog (with our choice of text ) for our own install type? But then it would be like creating our own application , isn't it?

please suggest an alternative.

thanx in advance.

CharlesW
06-15-2004, 01:30 PM
The easiest way to display a readme in notepad would be to use the exec action bean to launch notepad, passing the readme file in as an argument. On this action, you would place a string comparison condition. On the final panel, you could place a check box labeled "open readme". If checked, you could then use the code which I posted previously to set a flag which your string comparison condition would check.

There is no need to create a new install type dialog. If you wish to have an installation type other than "typical" or "custom" go to "organization->installation types" view and specify your new installation types. You can also delete the typical and custom types if desired.

darkestsky
06-15-2004, 03:29 PM
thnx again.

about the readme file, thats the best thing to do. i am having the IDE complaining abt the location , it cannot find the file there. I m looking into it.

the other part was not to have other options than 'typical' n 'custom' but to change the text which is written below it.
it is from String tables--> Product Resource category "SetupTypePanel.typicalDescription" , i found its occurance in console events in install type dialog. i replaced it (variable occurance with my text)at 2 places but it still wouldn't display it.

its not possible to intrude system defined strings/layouts, but my requirement was just to enter a more descriptive code beneath typical n custom for the features i m installing.

ne ideas ?

Rakesh_mahajan
06-15-2004, 11:41 PM
Thanks CharlesW..
My problem has been solved..

I want to ask you one more thing..
I want to run ant command on linux using my installation wizard how i can do that?

CharlesW
06-16-2004, 07:40 AM
Rakesh,
Under one of your components, add an ant target processor bean. Specify the Ant target, and the Ant script. This will allow you to run an Ant script at runtime.

Note: This is a new bean in InstallShield Universal.

Rakesh_mahajan
06-28-2004, 06:14 AM
I added an ant target processor bean. I Specified the Ant target, and the Ant script.
But ant script is not running at the time of installation.
I have a build.xml file.
In the ant script i specified the path of build.xml and in ant target i specified "all".

Can you pl tell me where i am going wrong?

CharlesW
07-07-2004, 10:18 AM
I assume that you have an ant target named "all" in your script? Also, are any of the ant tasks in the script from Ant v 1.6? InstallShield X includes Ant 1.5, so 1.6 tasks will not run.