Jskad/extensions/calpa/Docs/html/guide-Prog-answers.html
2003-07-05 22:13:17 +00:00

103 lines
3.4 KiB
HTML

<HTML>
<BODY bgcolor=ffffff>
<A name=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD>
<FONT size=-1><B>CalHTMLPane v2.0 Guide</B></FONT>
</TD>
<TD align=right>
<FONT size=-1><B>Programming Answers</B></FONT>
</TD>
</TR>
</TABLE>
<HR width=100% size=1 color=black>
<H2 align=center>Programming Answers</H2>
<BLOCKQUOTE>
<P>
<HR>
<P>
<A name="1"><B>1. I don't want hyperlinks to be marked as visited and I can't see
a method in CalHTMLPreferences to turn this feature off.</FONT></B>
<P>
The easiest way to turn this off is simply to set the default color of
visited links to that of unvisited links. You can do this through a
method in CalHTMLPreferences.
So your code will look something like this:
<pre>
CalHTMLPreferences pref = new CalHTMLPreferences();
pref.setDefaultColor(CalCons.A_VLINK, pref.getDefaultColor(CalCons.A_LINK));
CalHTMLPane pane = new CalHTMLPane(pref, null, null);
</pre>
<BR>
<A name="2"><B>2. CalPane uses THREEDEE style form components as default. I'd like
to have LOOKANDFEEL components as default. How do I do this?</B></A>
<P>
You can make all components render in the current Look And Feel by
setting a property in CalHTMLPreferences:
<pre>
CalHTMLPreferences pref = new CalHTMLPreferences();
pref.setFormRenderingStyle(CalCons.USE_LOOK_AND_FEEL);
CalHTMLPane pane = new CalHTMLPane(pref, null, null);
</pre>
<BR>
<A name="3"><B>3. Is it possible to do something like hyperlink-hover which you see in
some help systems?</B>
<P>
Yes, there's a method in CalHTMLPreferences that enables you to do this:
<pre>
CalHTMLPreferences pref = new CalHTMLPreferences();
pref.setShowHyperlinkOnMouseFocus(true);
CalHTMLPane pane = new CalHTMLPane(pref, null, null);
</pre>
<BR>
<A name="4"><B>4. I'm including some form components in a table. Each component is
in its own table cell and the cell has got a border. I want the component to fill the cell,
but there's always a gap above it. How can I get rid of this? </B></A>
<P>
Change the alignment of the form component to something other than its default, which is a few
pixels below the text baseline. For example:
<P>
&lt;TD&gt;&lt;INPUT type=text align=top&gt;&lt;/TD&gt;
<P>
<BR>
<A name="5"><B>5. I've got a document which has many form controls, each of which has its
own id. I get the the CalPane to load this document and then I call the getIDComponents()
method to access the components. However the Hashtable returned from this call is empty.
Here's my code:</B>
<pre>
pane.showHTMLDocument(url);
pane.getIDComponents(null);
</pre>
The CalPane will load the document <EM>asynchronously</EM>, so the showHTMLDocument() method will return
immediately, and you are consequently making the call to get the components before they
have been created. You need to ensure that the document has loaded before you try and get the components. You can
either do this by using CalHTMLObserver callbacks to monitor document loading, or you can force
the document to load synchronously with the setLoadSynchronously() method like this:
<pre>
pane.setLoadSynchronously(true);
pane.showHTMLDocument(url);
pane.setLoadSynchronously(false);
pane.getIDComponents(null);
</pre>
<TABLE align=center width=50%>
<TR>
<TD align=center>
<A href="../CalGuide.html">Guide Index</A> &nbsp;&#124;
<A href="../javadoc/overview-tree.html">&nbsp;JavaDoc</A> &nbsp;&#124;
<A href="guide-Misc-float.html">&nbsp;Previous</A> &nbsp;&#124;
<A href="guide-Tables-background.html">&nbsp;Next</A>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>