Prev: HTML functions and variables Up: HTML Top: Top

9.2. HTML Widget object

Widget objects whose widget class is subclassed from html have the following additional methods:

AnchorToId (name)
Returns id. This function corresponds with HTMLAnchorToId. Convenience function to return the element id of the anchor based on the anchor NAME passed. Function returns id on success. If there is no such element, 0 is returned.
AnchorToPosition (name)
Returns (success, x, y). This function corresponds with HTMLAnchorToPosition. Convenience function to return the position of the anchor based on the anchor NAME passed. If there is no such element, x=0, y=0 and success=-1 is returned.
ClearSelection ()
Returns None. This function corresponds with HTMLClearSelection.
FreeImageInfo ()
Returns None. This function corresponds with HTMLFreeImageInfo.
GetHRefs ()
Returns href_list. This function corresponds with HTMLGetHRefs. Convenience function to return the HREFs of all active anchors in the document. Function returns a list of strings.
GetImageSrcs ()
Returns srcs_list. This function corresponds with HTMLGetImageSrcs. Convenience function to return the SRCs of all images in the document. Function returns a list of strings.
GetLinks ()
Returns link_list. This function corresponds with HTMLGetLinks. Convenience function to return the link information for all the <LINK> tags in the document. Function returns a list of tuples consisting of two strings, the href and role elements of a LinkInfo struct.
GetText (pretty[, url])
Returns text. This function corresponds with HTMLGetText. Convenience function to return the text of the HTML document as a plain ascii text string. Extra option flags "pretty" text to be returned. When pretty is two or larger, Postscript is returned. The font used is encoded in the pretty parameter: pretty = 2: Times; pretty = 3: Helvetica; pretty = 4: New century schoolbook; pretty = 5: Lucida Bright
GetTextAndSelection ()
Returns (text, start, end, insert). This function corresponds with HTMLGetTextAndSelection. Convenience function to return the text of the HTML document as a single white space separated string, with pointers to the various start and end points of selections.
GotoId (element_id)
Returns None. This function corresponds with HTMLGotoId. Convenience function to position the element based on the element id passed at the top of the viewing area. A passed in id of 0 means goto the top.
IdToPosition (element_id)
Returns (success, x, y). This function corresponds with HTMLIdToPosition. Convenience function to return the position of the element based on the element id passed in. If there is no such element, x=0, y=0 and success=-1 is returned.
PositionToId (x, y)
Returns element_id. This function corresponds with HTMLPositionToId. Convenience function to return the element id of the element nearest to the x,y coordinates passed in. If there is no element there, return the first element in the line we are on. If we are on no line, either return the beginning, or the end of the document.
SearchText (pattern, start, backward, caseless)
Returns (page, (start_id, start_pos), (end_id, end_pos)). This function corresponds with HTMLSearchText. Convenience function to search the text of the HTML document as a single white space separated string. Linefeeds are converted into spaces.

Takes a pattern, and the location to start the search from for incremental searching. Default start is the beginning of the document for forward searching, and the end of the document for backwards searching. The backward and caseless parameters I hope are self-explanatory.

Returns 1 on success (and the start and end positions of the match). Returns -1 otherwise.

SetSelection ((start_id, start_pos), (end_id, end_pos))
Returns None. This function corresponds with HTMLSetSelection. Set the current selection based on the ElementRefs passed in. Both refs must be valid.
SetText (text, header_text, footer_text[, element_id, target_anchor])
Returns None. This function corresponds with HTMLSetText. Convenience function to set the raw text into the widget. Forces a reparse and a reformat. If any argument is passed in as None that text is unchanged, if an argument is an empty string, that text is set to NULL; Also pass an element ID to set the view area to that section of the new text. Finally pass an anchor NAME to set position of the new text to that anchor.


Prev: HTML functions and variables Up: HTML Top: Top