cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
henric
Level 3

How to disable the Cancel button

Is there a way to disable the Cancel button in InstallAnywhere?

I would like to do that since the user shouldn't be able to cancel the installation once the user has pressed Install and the installation has started.

Best regards
Henric
Labels (1)
0 Kudos
(38) Replies
pv7721
Level 20

Unfortunately, this is still not possible, even after 3 years since this feature request has been requested for the first time:

http://community.zerog.com/cgi-bin/ikonboard.cgi?s=4731965840afffff;act=ST;f=15;t=3656;hl=disable+and+cancel+and+button

Moreover, if the user hits the Cancel button, there is no rollback mechanism (for the files already installed, only the TEMP folder is cleaned).
0 Kudos
henric
Level 3

Thanks for the rapid response.

I agree that it's a pity that this hasn't been implemented yet. Disabling Cancel button or rollback funtionality would have been good to have in this case.

Best regards
Henric
0 Kudos
Yves_Kreis
Level 7

Everything is possible... it's Java!
You can disable the Cancel button using Custom code.

Best Regards,
Yves
0 Kudos
henric
Level 3

OK. How? Can you please supply some example code?

Best regards
Henric
0 Kudos
Yves_Kreis
Level 7

I don't have example code for this, but I can provide you the idea how to do it:
a) Write an extension to CustomCodePanel and register your own listener to the next button
Container guiContainer = ((GUIAccess) ccpp.getService(GUIAccess.class)).getFrame();
if (guiContainer instanceof JFrame) {
guiContainer = (Container) ((JFrame) guiContainer).getContentPane().getComponent(0);
JButton guiJButton = (JButton) ((Container) guiContainer.getComponent(3)).getComponent(2);
guiJButton.addActionListener(new NextListener(guiContainer));
}

b) In the listener, wait for the button text to be "Install" and afterwards disable the Cancel button.

I hope this helps.

Best Regards,
Yves
0 Kudos
henric
Level 3

Thanks for your help.
I wrote some test code based on your idea but it seems like this doesn't work. I got the code to execute every time the next button was pressed. When the text was Install I disabled the Cancel button. But it seems like InstallAnywhere enables the button once the installation starts again.

I also tried to put the Custom code Panel as the last step in Pre-installation. Then I didn't need to add the listener to any button. Even in this case the Cancel button seem to get enabled. :confused:

I have given up for now. Instead I hope that this will be fixed sometime in the future. In that case we may be able to our next release instead.;)
0 Kudos
Yves_Kreis
Level 7

Try to put the Custom Code Panel as first step in the Install section...

Best Regards,
Yves
0 Kudos
henric
Level 3

I tried to put a Custom Code Action in the install section but this didn't work. I am not sure how I put a custom code panel in the install section?

Best regards
Henric
0 Kudos
Yves_Kreis
Level 7

I will try to disable it today and let you know if I was successful...

Best Regards,
Yves
0 Kudos
vishald
Level 3

Hi henric
It is not possible to disable cancel button on the installing panel through the way suggested by Yves Kreis.
because the way Yves Kreis is saying to disable the cancel button will work only for that custom code panel
and installing panel is not shown as a panel in the installation project(as u have already seen) so u cant substitute it.

If u find any other way please let me know
0 Kudos
Yves_Kreis
Level 7

I still need to solve a problem with my installer, as soon as I am done with it I will try to get the idea I announced working and will let you know about the results... Its Java, everything can be done!

Best Regards,
Yvse
0 Kudos
Yves_Kreis
Level 7

Good morning,

Unfortunately it took me longer to test this as I thought; I had to solve important problems first. But nevertheless this one is quite easy:
a) Use a CustomCodePanel in Pre-Install and store the GUIAccess object in a static variable.
b) Use a CustomCodeAction as first action during Install step and use the enableExitButton(false) method on the previously stored GUIAccess object.

Hope this helps.

Best Regards,
Yves
0 Kudos
cristina
Level 3



Hi,
I was using IA7.5.
I did the following:
a) Use a CustomCodePanel in Pre-Install and store the GUIAccess object in a static variable.
b) Use a CustomCodeAction as first action during Install step and use the enableExitButton(false) method on the previously stored GUIAccess object.

It's 98% working because during the first 10-15 seconds of the Install step, where is shows:
"Installing.... Java Runtime Environment", the Cancel button is still enabled. But after that, the cancel/exit button is automatically disabled throughout the rest of the Install step.:o

Though in IA 2008 it's not working at all... 😞


0 Kudos
Kondalarao_n
Level 3

public class PanelDisableCancel extends CustomCodeAction{

@Override
public String getInstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

@Override
public String getUninstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

@Override
public void install(InstallerProxy ruleProxy) throws InstallException {

setInstallerProxy(ruleProxy);
GUIAccess gui = (GUIAccess)ruleProxy.getService(GUIAccess.class);
System.out.println("Haiiiiiiiiiiiiiii");
System.out.println(gui);
gui.getFrame().setTitle("new title");

try{
gui.setExitButtonEnabled(false);
}catch (Exception e) {
e.printStackTrace();
}
try{
gui.setNextButtonEnabled(false);
}catch (Exception e) {
e.printStackTrace();
}
try{
gui.setPreviousButtonEnabled(false);
}catch (Exception e) {
e.printStackTrace();
}

}

@Override
public void uninstall(UninstallerProxy arg0) throws InstallException {
try {
String installDirStr = arg0.substitute("$USER_INSTALL_DIR$");
FileService fs = (FileService)arg0.getService(FileService.class);
File installDir = new File(installDirStr);
if (installDir.exists())
fs.deleteDirectory(installDirStr, false,
true);
} catch (Exception e) {
File f = new File("c:\\logUninstall5.txt");
FileOutputStream fis = null;
try{
fis = new FileOutputStream(f);
fis.write(e.getMessage().getBytes());
fis.flush();
fis.close();
}
catch (Exception e1) {
// TODO: handle exception
}
}

}
0 Kudos
vishald
Level 3

Hi Yves Kreis

Great work done

Thanks a lot it worked.
0 Kudos
Yves_Kreis
Level 7

You are welcome.

Best Regards,
Yves
0 Kudos
ckanywhere529
Level 4

Yves Kreis wrote:
Good morning,

Unfortunately it took me longer to test this as I thought; I had to solve important problems first. But nevertheless this one is quite easy:
a) Use a CustomCodePanel in Pre-Install and store the GUIAccess object in a static variable.
b) Use a CustomCodeAction as first action during Install step and use the enableExitButton(false) method on the previously stored GUIAccess object.

Hope this helps.

Best Regards,
Yves


Hello,

One thing that is confusing me on this method is how to store the GUIAccess object in a static variable at PRE-INSTALL time and access this variable at INSTALL time.

Would I create CLASS A that Extends customcodepanel and CLASS B that Extends customcodeaction?

I think the EVERY VARIABLE IS A STRING in IA methodology has confused me on as to how I'd share the GUIAccess object between two classes using IA...

Maybe it's the lack of sleep 😞 heh

Thanks,

CK
0 Kudos
Yves_Kreis
Level 7

public class a extends ... {
public static GUIAccess gui = ...
...
}
public class b extends ... {
...
a.gui.enableExitButton(false);
...
}
0 Kudos
ckanywhere529
Level 4

Yves Kreis wrote:
public class a extends ... {
public static GUIAccess gui = ...
...
}
public class b extends ... {
...
a.gui.enableExitButton(false);
...
}


My understanding of above:

public class a extends CustomCodePanel {

CustomCodePanelProxy panelProxy = null;
public static GUIAccess gui = null;

public disableCancelDuringInstallPanel() {
}

public boolean setupUI(CustomCodePanelProxy customCodePanelProxy) {
panelProxy = customCodePanelProxy;
GUIAccess gui = (GUIAccess)customCodePanelProxy.getService(GUIAccess.class);
return false;
}

@Override
public void panelIsDisplayed() {

}

@Override
public String getTitle() {
return "Installing...";
}

@Override
public boolean okToContinue() {
return true;
}

@Override
public boolean okToGoPrevious() {
return false;
}
}

public class b extends CustomCodeAction {

private a testPanel; <-- I feel here is my issue (how can I get class b to see the GUIAccess object from class a (inited at PRE-INSTALL) :confused:

public disableCancelDuringInstallAction () {
}

@Override
public void install(InstallerProxy ip) throws InstallException {

try {
testPanel.gui.setExitButtonEnabled(false);
} catch (Exception e) {
e.printStackTrace();
}
}

@Override
public void uninstall(UninstallerProxy up) throws InstallException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getInstallStatusMessage() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getUninstallStatusMessage() {
throw new UnsupportedOperationException("Not supported yet.");
}

}

}
0 Kudos
Yves_Kreis
Level 7

Try the following:
ckanywhere529 wrote:


public class b extends CustomCodeAction {

public disableCancelDuringInstallAction () {
}

@Override
public void install(InstallerProxy ip) throws InstallException {

try {
a.gui.setExitButtonEnabled(false);
} catch (Exception e) {
e.printStackTrace();
}
}

@Override
public void uninstall(UninstallerProxy up) throws InstallException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getInstallStatusMessage() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getUninstallStatusMessage() {
throw new UnsupportedOperationException("Not supported yet.");
}

}
0 Kudos