class htmlLink

superclass(es) customControl
subclass(es) -
description The htmlLink class is a button control that looks and reacts like an HTML link inside a web browser.

pl_img31.gif (1870 bytes)
If the mouse is moved over the control it's shape changes into a handpl_img32.gif (1667 bytes) to indicate that it can be clicked.
see also panel

tasks

The htmlLink button is useful when a user must perform a task when a button is pressed, if the task was successfully completed visual feedback is presented to the user by the different color of the text inside the htmlLink control. It is easy to see which tasks were completed and which tasks must still be done.

Like with a button control the callback onClick/1 can be used to react to a mouse over the button. What is different from the button control is that the htmlLink control can be in one of three states and each state can have it's own color. The three possible states are: normal, pressed and clicked.
The pressed state is entered if the user holds the mouse button over the control but has not yet released it, the clicked state is entered if a button was released over the control. If a mouse button is clicked over the control for the first time the control goes from the normal state to the pressed state and if the button was released to the clicked state.

normal state: pl_img29.gif (1863 bytes) clicked state: pl_img30.gif (1894 bytes). The colors of the three states be changed, see the methods: putColors/4, putNormalColor/2, putPressedColor/2 and putClickedColor/2. If a new instance of the htmlLink class is created the default colors that are used can set and queried by the methods putDefaultColors/3 and defaultColors/3.

With the method putBackgroundColor/1 it possible to set a different background color for the control window, this is useful if the control is placed on an ownerdraw panel window.

Two small bitmap images can also be associated with each htmlLink control, one is displayed if the button is in the normal state and the other is displayed if the button is in the clicked state. The methods imageBeforeClick/1 and imageAfterClick/1 return these images. The htmlLink control can display two default images, these default images look like:
default normal image:pl_img27.gif (1631 bytes) and default clicked image:pl_img28.gif (1630 bytes). The default images can be shown or hidden by calling the method putDefaultImages/3. It is also possible to use other images for the normal and clicked state, the method putImageBeforeClick/3 can be used to set the image for the normal state and with putImageAfterClick/3 the image of the pressed state can be set.

With putLinkText/1 it is possible to store a string per htmlLink control, this method could be used to store the name of a file or any other string.

methods

putDefaultImages(YesNo, Redraw, Output)

func Show or hide the default images of a htmlLink control instance, if YesNo is true the default images are shown, else if the variable is false the images are hidden. If Redraw is true the control is immediately redrawn.
pre The variables YesNo and Redraw must contain true or false.
post If the images were removed or hidden then true was assigned to the variable Output, if there was an error then false was assigned.

reset( Redraw )

func Put the htmlLink control in the normal state. If Redraw is true the control is immediately redrawn.
pre The variable Redraw must contain true or false.
post The control is in the normal state.

imageBeforeClick( OutputImage )

func Return the image instance that is displayed if the control is in the normal state.
pre TRUE
post The image instance associated with the normal state of the control was assigned to the variable OutputImage, if a default image is used or if no image was used then no value was assigned to the variable OutputImage.

putImageBeforeClick( Image, Redraw, Output )

func Assign an image instance ot the normal state of the control. If Redraw is true the control is immediately redrawn.
pre The variable Image must refer to an instance of the class image and Redraw must contain true or false.
post The contents of the Image variable was associated with the normal state if true was assigned to the variable Output, if there was an error then was false assigned.

imageAfterClick( OutputImage )

func Return the image instance that is displayed if the control is in the clicked state.
pre TRUE
post The image instance associated with the clicked state of the control was assigned to the variable OutputImage, if a default image is used or if no image was used then no value was assigned to the variable OutputImage.

putImageAfterClick( Image, Redraw, Output )

func Assign an image instance ot the clicked state of the control. If Redraw is true the control is immediately redrawn.
pre The variable Image must refer to an instance of the class image and Redraw must contain true or false.
post The contents of the Image variable was associated with the clicked state if true was assigned to the variable Output, if there was an error then was false assigned.

hideImages( Redraw )

func Hide the normal and clicked images of the htmlLink control. If Redraw is true the control is immediately redrawn.
pre The variable Redraw must contain true or false.
post The images of the htmlLink control are not visible anymore if the control was redrawn.

putLinkText( Input )

func Set the link text associated with the link control. This text is not visible, it is useful for associating some information (like the name of a file) with the control.
pre The variable Input must contain a string.
post The value of the parameter was stored.

linkText( Output )

func Return the link text associated with the control instance.
pre TRUE
post The stored value of the link text was assigned to the variable Output.

putBackgroundColor( clr(R,G,B), Redraw )

func Set the background color used for clearing the background of the control window. If the parameter Redraw contains the boolean value true then the control is redrawn immediate.
pre The variables R, G and B must contain an integer value in the range [0, 255]. The variable Redraw must contain true or false.
post The color value for drawing the background of the control was assigned the values of the color structure.

backgroundColor( clr(R,G,B) )

func Get the color used for drawing the background of the control window.
pre TRUE
post The variables of the color structure were assigned the color for drawing the background.

putDrawFocusRect( YesNo, Redraw )

func Determine if a control draws a focus rectangle if it has the keyboard focus. If YesNo is false then a focus rectangle is never drawn. If the parameter Redraw contains the boolean value true then the control is redrawn immediate.
pre The variables YesNo and Redraw must contain true or false.
post If YesNo was true then a focus rectangle is drawn if the control has the keyboard focus, else never.

drawFocusRect( Output )

func Check if a focus rectangle is drawn if the control has the keyboard focus or not.
pre TRUE
post The variable Output was assigned true if the control may draw a focus rectangle, else it was assigned false.

putColors( clr(R,G,B), clr(R1,G1,B1), clr(R2,G2,B2), Redraw )

func Set the colors for the three states of the control. The first color structure is for the normal state, the second for the pressed state and the third for the clicked state. If Redraw is true the control is immediately redrawn. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre The variables R, G, B, R1, G1, B1, R2, G2 and B2 must contain an integer value in the range [0, 255]. The variable Redraw must contain true or false.
post The color values of the htmlLink control were assigned the value of the arguments, the changes in the colors are visible if the control has redrawn itself.

putNormalColor( clr(R,G,B), Redraw )

func Set the color for the normal state of the control. If Redraw is true the control is immediately redrawn. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre The variables R, G and B must contain an integer value in the range [0, 255]. The variable Redraw must contain true or false.
post The color value of the normal state was assigned the values of the color structure.

normalColor( clr(R,G,B) )

func Get the color of the normal state of the control. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre TRUE
post The variables of the color structure were assigned the color of the normal state.

putPressedColor( clr(R,G,B), Redraw )

func Set the color for the pressed state of the control. If Redraw is true the control is immediately redrawn. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component. The pressed state is the state the htmlLink control is in when the control was clicked but the button of the input device was not yet released.
pre The variables R, G and B must contain an integer value in the range [0, 255]. The variable Redraw must contain true or false.
post The color value of the pressed state was assigned the values of the color structure.

pressedColor( clr(R,G,B) )

func Get the color of the pressed state of the control. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre TRUE
post The variables of the color structure were assigned the color of the pressed state.

putClickedColor( clr(R,G,B), Redraw )

func Set the color for the clicked state of the control. If Redraw is true the control is immediately redrawn. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component. The clicked state is the state the htmlLink control is in when the button of an input device was released.
pre The variables R, G and B must contain an integer value in the range [0, 255]. The variable Redraw must contain true or false.
post The color value of the clicked state was assigned the values of the color structure.

clickedColor( clr(R,G,B) )

func Get the color of the clicked state of the control. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre TRUE
post The variables of the color structure were assigned the color of the clicked state.

putDefaultColors( clr(R,G,B), clr(R1,G1,B1), clr(R2,G2,B2) )

func Set the default colors for the three states for all the instances of the class htmlLink control. The default colors are used when a new htmlLink control is created. The first color structure is for the normal state, the second for the pressed state and the third for the clicked state. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre The variables R, G, B, R1, G1, B1, R2, G2 and B2 must contain an integer value in the range [0, 255].
post The default color values for all instances of the clas htmlLink control were assigned the value of the arguments.

defaultColors( clr(R,G,B), clr(R1,G1,B1), clr(R2,G2,B2) )

func Get the default colors for the three states for all the instances of the class htmlLink control. The default colors are used when a new htmlLink control is created. The first color structure is for the normal state, the second for the pressed state and the third for the clicked state. The first argument of a color structure is the Red component of the color, the second the Green component and the last the Blue component.
pre TRUE
post The variables of the three color structures were assigned the default colors of the normal, pressed and clicked states.