This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Disabling Text Field when a Radio Button is Selected
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
01:46 AM
Disabling Text Field when a Radio Button is Selected
I am trying to disable a text field when a radio button is selected. The selection of the radio button triggers the following event.
The following code doesn't disable the text field(proxy_server)
public void checkedproxy_server_no com.installshield.event.ui.ISControlContext arg0)
{
try{
ISFrame frame = ((SwingPanel)arg0.getISContainer()).getISFrame();
ISTextField field1 = frame.getTextField("proxy_server");
field1.setEnabled(false);
}catch(Exception ex){
arg0.getServices().logEvent(this, Log.ERROR, "Caught an exception........");
}
}
I am unable to figure out how to get a handle on the proxy_server in the event above, so I can just disable it by using setEnabled(false).
Any ideas?
The following code doesn't disable the text field(proxy_server)
public void checkedproxy_server_no com.installshield.event.ui.ISControlContext arg0)
{
try{
ISFrame frame = ((SwingPanel)arg0.getISContainer()).getISFrame();
ISTextField field1 = frame.getTextField("proxy_server");
field1.setEnabled(false);
}catch(Exception ex){
arg0.getServices().logEvent(this, Log.ERROR, "Caught an exception........");
}
}
I am unable to figure out how to get a handle on the proxy_server in the event above, so I can just disable it by using setEnabled(false).
Any ideas?
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
08:59 AM
Heres a snippet i use:
public void checkeddb_rb_existing_provider(com.installshield.event.ui.ISControlContext arg0)
{
ISTextField dsHelperTF = (ISTextField)arg0.getISContainer().getControl("db_tf_datasource_helper");
dsHelperTF.setEnabled(false);
dsHelperTF.setBackgroundColor(new Color(192,192,192));
setProviderConfig("existing", arg0);
}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
11:40 AM
This code doesn't work. I did't see a getISControl(String textFieldvariableName) when I did a . on getISContainer(). I used the getISHtmlControl() instead, as below.
public void checkedproxy_server_no(com.installshield.event.ui.ISControlContext arg0)
{
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getISHtmlControl("proxy_server");
prxysrvr.setEnabled(false);
prxysrvr.setBackgroundColor(new Color(192,192,192));
//setProviderConfig("existing",arg0);
}
When I stepped through the code, the execution came to a halt on Line 2 prxysrvr.setEnabled(false)
I also commented out setProviderConfig, as it was throwing compiler errors.
I am not sure what to do next..
Thanks
public void checkedproxy_server_no(com.installshield.event.ui.ISControlContext arg0)
{
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getISHtmlControl("proxy_server");
prxysrvr.setEnabled(false);
prxysrvr.setBackgroundColor(new Color(192,192,192));
//setProviderConfig("existing",arg0);
}
When I stepped through the code, the execution came to a halt on Line 2 prxysrvr.setEnabled(false)
I also commented out setProviderConfig, as it was throwing compiler errors.
I am not sure what to do next..
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
11:59 AM
Dont know man... This code does work, and has for a long time now. Dont know if you made a typo or what but it isnt getISControl(), its getControl()...
probably wont work because your trying to cast an ISHtmlControl to a ISTextfield. You should wrap everything in a try/catch and print out the exception...
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getISHtmlControl("proxy_server");
probably wont work because your trying to cast an ISHtmlControl to a ISTextfield. You should wrap everything in a try/catch and print out the exception...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
12:25 PM
Ok..I changed the code but the problem remains. Here is my updated code.
A NullPointerException is being thrown on line 2. Looks like "prxysrvr" is not getting initialized on Line 1 to some value before i do a . on it on Line 2.
try{
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getControl("proxy_server");
prxysrvr.setEnabled(false);
prxysrvr.setBackgroundColor(new Color(192,192,192));
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
Here is the complete trace:
null
java.lang.NullPointerException
at com.installshield.insite_2_0.event.dialog.swing.Panelinsite2_proxy_server.checkedproxy_server_no(Panelinsite2_proxy_server.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.invokeJavaMethod(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.executeAction(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.run(Unknown Source)
at com.installshield.event.ThreadPool.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
A NullPointerException is being thrown on line 2. Looks like "prxysrvr" is not getting initialized on Line 1 to some value before i do a . on it on Line 2.
try{
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getControl("proxy_server");
prxysrvr.setEnabled(false);
prxysrvr.setBackgroundColor(new Color(192,192,192));
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
Here is the complete trace:
null
java.lang.NullPointerException
at com.installshield.insite_2_0.event.dialog.swing.Panelinsite2_proxy_server.checkedproxy_server_no(Panelinsite2_proxy_server.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.invokeJavaMethod(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.executeAction(Unknown Source)
at com.installshield.event.ActionSequenceEngine$ActionTask.run(Unknown Source)
at com.installshield.event.ThreadPool.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
01:18 PM
In my experience that means that the current panel does not have a field by that name ("proxy_server"). Check your panel and make sure that the control is named accordingly. Im a previous post you said your method was
seems like that should be the name you would use:
proxy_server_no
seems like that should be the name you would use:
ISTextField prxysrvr = (ISTextField)arg0.getISContainer().getControl("proxy_server_no");
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 15, 2007
01:27 PM
Here is the right code.
try{
ISTextField proxy_server = arg0.getISContainer().getTextField("ISTextFieldDef2");
proxy_server.setEnabled(false);
proxy_server.setBackgroundColor(new Color(192,192,192));
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
try{
ISTextField proxy_server = arg0.getISContainer().getTextField("ISTextFieldDef2");
proxy_server.setEnabled(false);
proxy_server.setBackgroundColor(new Color(192,192,192));
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}