PDA

View Full Version : Custom Validation & Calling Native Method



sbhuvane
07-30-2004, 06:31 AM
Hi

I have few doubts with Universal Installer Project

1) In Installshield Multiplatform, to validate date enter in text box, we have an option to link to a custom class(which extends UserInputValidator class) to validate the text box data.
Hope we dont have such an option in IS X UIP Projects. Could you please let me know whats the alternate of this custom validator in IS X ?


2) I have a Custom Class which invokes Native API from a C Dll
I just want to know how to bundle the Dll which should be available only during the installation time and load the same in the Custom Class.

At present, even if i specify some hard-corded path (say C:\sample.dll) in the Custom Class to load the dll and call the Method from Custom Class, then Dll is loaded but it throws the following Exception java.lang.reflect.InvocationTargetException. Hope this is at the point where Native API is called at the Custom class.
Could you please suggest a solution

Regards
Bhuvana

CharlesW
08-02-2004, 09:28 AM
Regarding 1: As you have noticed, the dialog editor does use validator classes. Instead, you will want to use the query exit event for the panel you are trying to validate. After adding the control to the dialog, click on the "swing" tab, and select "queryExit" in the event list box. Keep the "context" list box set to the name of your dialog. This will add a the query exit event to the event code for the dialog.

To prevent the user from advancing to the next panel, call the following line of code:

arg0.setReturnValue(false);

returning true will allow the user to advance to the next panel. Of course, you would set the return value conditionally, based upon the value that the user entered for a control. Take a look at the event code for the password dialog and destination dialog. In particular the queryExit method of each. Each gives an example on how to get the value of a control, and prevent the user from advancing to the next panel based upon this input.

The license dialog source will illustrate how to disable a button based upon the state of a control.