cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
genleo
Level 6

Get User Input

Hi all,
I'd like to validate text input from user, the length of a key for example. Is there a way to do it from InstallAnywhere directly or should I implement a custom panel?

Thanks in advance.

Gennaro
Labels (1)
0 Kudos
(8) Replies
pv7721
Level 20

You are using IA 2008 or an earlier version?
0 Kudos
purcellk24
Level 7

You can use a custom panel if you want to.

You should also be able to evaluate a rule after your original panel with either a custom rule or a regular expression.
0 Kudos
genleo
Level 6

I'm using IA 2008.
I've implemented a custom panel but I'm not able to add action listener (is it possible???) to the Next button of Installer Frame.
I tried to add a jButton to custom panel and I can get the input text from the user correctly... So, how can I add a listener to default Next button?

Thanks
0 Kudos
Yves_Kreis
Level 7

Yes you can:
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));
}


Best Regards,
Yves
0 Kudos
genleo
Level 6

Yves Kreis wrote:
Yes you can:
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));
}


Best Regards,
Yves


Ok, in which method should I put this code? And should I create a new NextListener class?

Thanks for your help!

Gennaro
0 Kudos
purcellk24
Level 7

When do you want to validate your text entry? I find it much easier to validate when the user clicks next. I put the validation code in the okToContinue() method of the CustomCodePanel. Then if the input is incorrect, I display a dialog explaining and have that method return false and make the user try again.
0 Kudos
genleo
Level 6

purcellk24 wrote:
When do you want to validate your text entry? I find it much easier to validate when the user clicks next. I put the validation code in the okToContinue() method of the CustomCodePanel. Then if the input is incorrect, I display a dialog explaining and have that method return false and make the user try again.


Thanks a lot... It works correctly!
0 Kudos
qqqqqq
Level 7

i tried the same thing to get the user input..
i have:
1)custom panel with oktocontinue method.. which checks the correctness of input.. and set the $var$ variable true/false..
2) then according to $var$.. i display error message dialog saying input is wrong 3)But after message appears and user clicks OK.. Just blank white screen comes without anything in it.. (the panel is not refreshed somehow 😞 )

But if i minimize and then maximize the installer window .. it appears again !..

please help !

thank you
0 Kudos