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
ckanywhere529
Level 4

Yves Kreis wrote:
Try the following:


Thanks for the quick reply Yves. I got it running.
I was being a moron and expecting GUIAccess gui to
be initialized in a (using a same named LOCAL variable named gui lol)

One thing I noticed is the X box is still active, but the CANCEL button is inactive.

Any clue if this is something editable (from the looks of it, it doesn't look like part of the open IA api.)

Also, the panel (Pre-installation summary) now reads "Next" instead of "Install" because of the custom panel used to do this.

If the last panel returns false on setupUI, you'd think IA would catch this and display "install" on the second to last panel....

A workaround is to put the disableCancelButtonPanel before Pre-installation summary.

~Chris.
0 Kudos
Yves_Kreis
Level 7

Dear ckanywhere529,

The X box cannot be disabled as far as I know. If you find something I would be pleased to know! However it should not work...

You can try to put the CustomCodePanel earlier in the pre-install tasks. This might solve the Next <-> Install problem. You can also try to return true.

Best Regards,
Yves
0 Kudos
genleo
Level 6

Hi all,
i followed Yves advice but it doesn't work 😞 😞 😞

I have these classes:


public class MyPanel extends CustomCodePanel {

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

public A() {
}

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;
}
}


and


public class DisableCancelDuringInstallAction extends CustomCodeAction {

/**
*
*/
public DisableCancelDuringInstallAction() {
// TODO Auto-generated constructor stub
}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#getInstallStatusMessage()
*/
@Override
public String getInstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#getUninstallStatusMessage()
*/
@Override
public String getUninstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#install(com.zerog.ia.api.pub.InstallerProxy)
*/
@Override
public void install(InstallerProxy arg0) throws InstallException {
try {
MyPanel.gui.setExitButtonEnabled(false);
} catch (Exception e) {
e.printStackTrace();
}


}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#uninstall(com.zerog.ia.api.pub.UninstallerProxy)
*/
@Override
public void uninstall(UninstallerProxy arg0) throws InstallException {
// TODO Auto-generated method stub

}

}


I put MyPanel just before Pre-Installation Summary and DisableCancelDuringInstallAction as first action in Install section... can you help me?

Thanks
0 Kudos
Yves_Kreis
Level 7

In class A, method setupUI you create a second variable gui, i.e. you don't assign the result to the static one!

Best Regards,
Yves
0 Kudos
genleo
Level 6

Sorry,
I have no class A, constructor public A() {} is public MyPanel() {}.

It doesn't work yet.
0 Kudos
Yves_Kreis
Level 7

Class MyPanel then instead of class A.
0 Kudos
genleo
Level 6

Yves Kreis wrote:
Class MyPanel then instead of class A.


I think I'm going crazy... could you post me some piece of code???

Thanks a lot
0 Kudos
Yves_Kreis
Level 7


(...)

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


Best Regards,
Yves
0 Kudos
genleo
Level 6

Thank you Yves,
finally I understood what the problem was. Now it works.

Best Regards
0 Kudos
nikhilgupta
Level 5

I am using IA 2008 VP1 and have not been successful in disabling cancel button. gui object is set in CustomPanel code but when CustomCodeAction executes, gui becomes null. I tried using static int which retains its value from panel code to customcode action.
Is there something changed in IA 2008/
0 Kudos
munsingh
Level 6

Well I have used the same code as provided in this thread and it works for me. I am using IA 2008 VP1.
0 Kudos
Gloria_Glickley
Level 3

(1) I followed the discussion of this thread, came out with custom panel code as below:

public class SetCustomPanel extends CustomCodePanel
{
CustomCodePanelProxy panelProxy = null;
public static GUIAccess gui = null;

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


Compiled it to SetCustomPanel.class as part of our IS_Installer.jar file.
I'm not sure how to call this custom panel other than through Execute Custom Code Action. Is this a correct assumption?
When I added this panel as custom code action before the Pre-Install Summary panel, I then kept getting error stating this class is UNAVAILABLE.

[PHP]com.ibm.filenet.is.install.SetCustomPanel
Status: ERROR
Additional Notes: ERROR - class com.ibm.filenet.is.install.SetCustomPanel unavailable.[/PHP]

What did I miss? Appreciate input to confirm.

(2) Also, for the 2nd part, the Custom Code to disable the Cancel button, to be called in the Install Task. The suggestion is to call as the first thing in the Install task. We have many visual trees in the Install Task like one for the USER_MAGIC_FOLER_x, one for User Install Folder, one for DO NOT INSTALL, etc. Should I add this custom code under the User Install Folder or it really doesn't matter?

PS - I'm actually using IA 2009 SP1. Sorry for the confusion since I want to continue using this thread instead of starting a new thread.
Regards, Gloria
0 Kudos
Yves_Kreis
Level 7

You need to include it as custom panel, not custom code!

Best Regards,
Yves
0 Kudos
Gloria_Glickley
Level 3

Thanks Yves.

I finally figured out on how to do the Custom Panel through Plugin.
Now I'm pretty sure both my custom panel in the preinstall and custom code in the install are called without errors. What my test shows that the 'Cancel' button is still showing as Enabled when the panel displays "Installing ... Java Runtime Environment'. Once this is done, the 'Cancel' button is finally Disabled when installer starts copying files.

Is this the best behavior I can get? Or is there any way to also disable the 'Cancel' button for installing the JRE?

Below is the excerpt of the code. Any comment is greatly appreciated.

This custom code panel is called right before the Pre-install Summary Panel.
public class SetCustomPanel extends CustomCodePanel
{
CustomCodePanelProxy panelProxy = null;
public static GUIAccess gui = null;

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


This Custom code is executed as the 1st step under the $USER_INSTALL_DIR$ Visual Tree.
public class DisableCancelAtInstall extends CustomCodeAction
{
public void install( InstallerProxy ip ) throws InstallException
{
try {
SetCustomPanel.gui.setExitButtonEnabled(false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
0 Kudos
sukrit007
Level 2

You may also disable X button , by de-registering the window listener. Assuming that you have guiAccess object,

Frame frame = guiAccess.getFrame();
Container parentContainer = frame;
if(parentContainer instanceof JFrame) {
JFrame jframe = (JFrame) parentContainer;
WindowListener [] listeners =jframe.getWindowListeners();
for(WindowListener listener: listeners) {
if(!listener.getClass().getName().startsWith("java")) {
jframe.removeWindowListener(listener);
}
}
}



ckanywhere529 wrote:
Thanks for the quick reply Yves. I got it running.
I was being a moron and expecting GUIAccess gui to
be initialized in a (using a same named LOCAL variable named gui lol)

One thing I noticed is the X box is still active, but the CANCEL button is inactive.

Any clue if this is something editable (from the looks of it, it doesn't look like part of the open IA api.)

Also, the panel (Pre-installation summary) now reads "Next" instead of "Install" because of the custom panel used to do this.

If the last panel returns false on setupUI, you'd think IA would catch this and display "install" on the second to last panel....

A workaround is to put the disableCancelButtonPanel before Pre-installation summary.

~Chris.
0 Kudos
ascans
Level 3

Hi,

I have implemented the solution suggested in this thread. I have confirmed the code is executed in my installer but the "Cancel" button still not being disabled (I think I saw a brief moment the Cancel button being gray out but enabled afterward). The only thing is that I am using IA2010, would it make a different. Please let me know if anyone run into same problem with IA2010 or have a solution for it.

Thanks
0 Kudos
pv7721
Level 20

Maybe this was a regression in IA2010, could you give it a try in the latest version, IA 2011?
0 Kudos
moniv22
Level 2

Is your solution working for InstallAnywhere 2011 too or am I doing something wrong? 😞

Thank you
0 Kudos