Control
Wisej.Web.Control
Namespace: Wisej.Web
Assembly: Wisej.Framework (2.5.0.0)
Base class for all Wisej controls.
C#
VB.NET
1
public class Control : IWisejControl, IWisejComponent, IBindableComponent, IWisejSerializable, IHasPropertyStore, IHasResponsiveProfiles
Copied!
1
Public Class Control
2
Inherits IWisejControl
3
Implements IWisejComponent, IBindableComponent, IWisejSerializable, IHasPropertyStore, IHasResponsiveProfiles
Copied!

Constructors

Control()

Initializes a new instance of the Control class.

Properties

AccessibleDescription

String: Returns or sets the description that will be reported to accessibility client applications. It is assigned to the "alt" attribute of the browser element.

AccessibleName

String: Returns or sets the name of the control for use by accessibility client applications. It is assigned to the "name" attribute of the browser element.

AccessibleRole

AccessibleRole: Returns or sets the accessible role of the control that will be reported to accessibility client applications. It is assigned to the "role" attribute of the browser element.

AllowDrag

Boolean: Returns or sets whether the control can initiate a drag-drop operation.

AllowDrop

Boolean: Returns or sets whether the control can accept data that the user drags onto it.

Anchor

AnchorStyles: Returns or sets the edges of the container to which a control is bound and determines how a control is resized with its parent.

Anonymous

Boolean: Returns or sets whether the control receives pointer events. Anonymous controls let pointer events bubble to their parents.

BackColor

Color: Returns or sets the background color for the control.

BackgroundImage

Image: Returns or sets the background image displayed in the control.

BackgroundImageLayout

ImageLayout: Returns or sets the background image layout as defined in the ImageLayout enumeration.

BackgroundImageSource

String: Returns or sets the background image displayed in the control.

BecomingActiveControl

Boolean: Returns a flag indicating that the control is becoming the active control.

CanExecute

Boolean: Determines whether the control can execute a command.

CanFocus

Boolean: Returns whether the control can receive focus.

CausesValidation

Boolean: Returns or sets whether the control causes validation to be performed on controls that require to be validated when this control receives focus.

ClientEvents

ClientEventCollection: Returns a collection of client events and JavaScript listeners. You may attach multiple listeners to same event.
You can use this collection at design time or in code or through the listener methods:

ContainsFocus

Boolean: Indicates whether the control, or one of its child controls, has the input focus.

ContextMenu

ContextMenu: Returns or sets the shortcut menu associated with the control.

Controls

ControlCollection: Returns the collection of controls contained within the control.

CssClass

String: Returns or sets additional CSS class names to add to the widget.
Use this property to add or remove custom CSS classes that you may add to your application as standard css files or through the StyleSheet extender. You can assign multiple class names separated by a space and you can manage this property using the related methods:

CssStyle

String: Returns or sets the custom CSS styles to add to the widget.
You can use any CSS style string.
1
// set the border radius to 100% and make the control round.
2
this.button1.CssStyle = "border-radius:100%";
Copied!

Cursor

Cursor: Returns or sets the cursor that is displayed when the mouse pointer is over the control.

DataBindings

ControlBindingsCollection: Returns the data bindings for the control.

DefaultBackColor

Color: Returns the default background color of the control.

DefaultFont

Font: Returns the default font of the control.

DefaultForeColor

Color: Returns the default background color of the control.

DisplayRectangle

Rectangle: Returns the rectangle that represents the virtual display area of the control.

Dock

DockStyle: Returns or sets which control borders are docked to its parent control and determines how a control is resized with its parent.

Enabled

Boolean: Returns or sets whether the control can respond to user interaction.

EnableNativeContextMenu

Boolean: Enables or disables the browser's context menu.

Focusable

Boolean: Returns or sets whether the control can gain the focus.

Focused

Boolean: Returns a value indicating whether the control has input focus.

Font

Font: Gets or sets the font of the text displayed by the control.

ForeColor

Color: Returns or sets the text color of the control.

Handle

IntPtr: Returns the unique server-side id (handle) for this component.

HasDataBindings

Boolean: Returns whether the control specifies data bindings.

HasResponsiveProfiles

Boolean: Check if the control defines any responsive profile without forcing the creation of the collection.

HasUserData

Boolean: Checks if the UserData dynamic object was created and has any value.

Height

Int32: Returns or sets the height of the control.

InitScript

String: Returns or sets an initialization script to execute when the widget is created (or reloaded) in the browser.
Use this property to add custom initialization JavaScript that is always executed when the client widget is created. The context (this) of the script is the instance of the widget. You can use the entire qooxdoo and wisej.js api. See #qx and wisej-js.
1
// change the background color of the internal label of the button widget.
2
this.button1.InitScript = "this.getChildControl('label').setBackgroundColor('red')";
3
4
// attach a JavaScript event handler.
5
this.textBox1.InitScript = @"this.addListener('keydown', function(e) {
6
if (e.getKeyIdentifier() == "PageDown") {
7
alert('You pressed PageDown.');
8
}
9
});
Copied!
You may also use the init script to attach events to the widget or to its internal children. Event handlers can also be attached using the ClientEvents collection and the client events methods:

IsHandleCreated

Boolean: Returns if the control has a server-side component id (handle) associated with it.

IsMirrored

Boolean: Returns whether the control is mirrored.

LayoutEngine

LayoutEngine: Returns the control's layout engine.

Left

Int32: Returns or sets the distance, in pixels, between the left edge of the control and the left edge of its container's client area.

Location

Point: Returns or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

Margin

Padding: Returns or sets the space between controls.

MaximumSize

Size: Returns or sets the maximum size for the control.

MinimumSize

Size: Returns or sets the minimum size for the control.

ModifierKeys

Keys: Returns a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.

MouseButtons

MouseButtons: Returns a value indicating which of the mouse buttons is in a pressed state.

MousePosition

Point: Returns the position of the mouse cursor in screen coordinates.

Movable

Boolean: Returns or sets whether the control can be moved by dragging.

Name

String: Gets or sets the name of the control.

Padding

Padding: Returns or sets padding within the control.

Parent

Control: Returns or sets the parent container of the control.

PreferredSize

Size: Returns the preferred size in which the control can fit.

ResizableEdges

AnchorStyles: Returns or sets the edges of the control that can be dragged to resize the control.

RightToLeft

RightToLeft: Returns or sets whether the control's elements are aligned right-to-left to support RTL languages.
When set to Inherit, the control inherits the value of this property from its parent. However, when the control is a top-level control (i.e. Window, Page, Desktop), and the value is set to Inherit, the right-to-left mode is automatically retrieved from the current language.
The behavior of this property is configurable in Default.json setting the "rightToLeft" property to "true", "false", or "auto". The default is "auto", causing the value to be retrieved from the current language.

ShowLoader

Boolean: Returns or sets whether the control is blocked by the ajax loader.

Size

Size: Returns or sets the height and width of the control.

States

String[]: Returns or sets additional theme states to the client widget.
Use this property to manage additional custom states that you may want to add to a widget. The state will update the visualization of the widget using the styles and properties set in the current theme and loaded theme mixins. You can also force the usage of built-in states. However, this property will not return the current states of the widget as updated by the client browser. It only returns the states set by the application.
1
// force the widget to update the UI as if it was hovered and focused.
2
this.button1.States = new [] { "hovered", "focused" };
3
4
// apply a custom state defined in a custom theme or theme mixing.
5
this.panel1.States = new [] { "alert" };
Copied!
In addition to setting this property directly, you can also manage it using the related methods:

TabIndex

Int32: Returns or sets the tab order of the control within its container.

TabStop

Boolean: Returns or sets whether the user can give the focus to this control using the TAB key and the Focusable property is set to true.

Tag

Object: Returns or sets the object that contains data about the control.

Text

String: Returns or sets the text associated with this control.
When AllowHtml is set to true, the text can contain HTML content. If the text contains new lines (CRLF) but doesn't contain HTML elements (at least one "<") all CRLF are automatically substituted with " ".

ToolTipText

String: Returns or sets the tooltip text to show for this control.
When using ToolTipText property you can only set the ToolTip text and cannot change the default ToolTip icon set in the theme. To change the ToolTip icon you can either create a custom theme, or a theme mixin, or use the ToolTip extender and the ToolTip property added by the extender. You can change the default ForeColor, AutomaticDelay, InitialDelay, AutoPopDelay, or enable HTML in ToolTipText by using a ToolTip extender also without setting the ToolTip property added by the extender.

Top

Int32: Returns or sets the distance, in pixels, between the top edge of the control and the top edge of its container's client area.

UserData

Object: Returns a dynamic object that can be used to store custom data in relation to this control.

UseWaitCursor

Boolean: Returns or sets whether to use the wait cursor for the current control and all child controls.

ValidationCancelled

Boolean: Returns a flag indicating that the validation has been canceled.

Visible

Boolean: Returns or sets whether the control and all its child controls are displayed.

WheelDelta

Int32: Returns a value indicating the wheel delta from the last wheel event.

Width

Int32: Returns or sets the width of the control.

Methods

AddClientEventListener(name, script)

Adds a new listener script to the event name to the client widget.
Parameter
Type
Description
name
String
Name of the client event to attach the listener to.
script
String
JavaScript code to execute when the event occurs.
Returns: Int32. An integer id that you can use to remove the listener from the event using RemoveClientEventListener or to retrieve the listener script code using GetClientEventListener.
The script will execute in the browser when the event name occurs. You can attach multiple listeners to the same event.

AddCssClass(name)

Adds the CSS class name to the widget element. If the class already exists in the CssClass it's not added.
Parameter
Type
Description
name
String
Name of the css class to add.
Returns: String. The new value of the CssClass property.

AddState(state)

Adds the specified theme state to the widget.
Parameter
Type
Description
state
String
Name of the custom state to add to the widget.
Returns: String[]. The new list of states stored in the States property.
You can also assign a new array of states to the States property.

BeginInvoke(method, args)

Executes the specified delegate asynchronously.
Parameter
Type
Description
method
Delegate
A delegate to a method that takes no parameters.
args
Object[]
An optional array of objects to pass as arguments to the specified method.
Returns: IAsyncResult. An IAsyncResult that represents the result of the asynchronous call.

BringToFront()

Brings the control to the front of the z-order.

Call(function, args)

Runs the JavaScript function within the component's context in the browser.
Parameter
Type
Description
function
String
The name of the JavaScript function to execute.
args
Object[]
The arguments to pass to the function.

Call(function, callback, args)

Runs the JavaScript function within the component's context in the browser and returns the value to the callback method.
Parameter
Type
Description
function
String
The name of the JavaScript function to execute.
callback
Action
Asynchronous callback method that receives the return value.
args
Object[]
The arguments to pass to the function.

CallAsync(function, args)

Asynchronously runs the JavaScript function within the component's context in the browser and returns an awaitable Task containing the value returned by the remote call.
Parameter
Type
Description
function
String
The name of the JavaScript function to execute.
args
Object[]
The arguments to pass to the function.
Returns: Task. An awaitable Task that represents the asynchronous operation.

CenterToParent()

Centers the position of the control within the bounds of the parent.

CenterToParent(horizontal, vertical)

Centers the position of the control within the bounds of the parent either horizontally, vertically or both.
Parameter
Type
Description
horizontal
Boolean
Center horizontally.
vertical
Boolean
Center vertically.

Contains(control)

Indicates whether the specified control is a child of this control.
Parameter
Type
Description
control
Control
The child Control to find.
Returns: Boolean. true if the specified control is a child of the control; otherwise, false.

CreateControl()

Creates and register this control and all its children.

DoDragDrop(data, allowedEffects)

Begins a drag-and-drop operation.
Parameter
Type
Description
data
Object
The data to drag.
allowedEffects
One of the DragDropEffects values.
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

DoDragDrop(data, allowedEffects, imageSource)

Begins a drag-and-drop operation.
Parameter
Type
Description
data
Object
The data to drag.
allowedEffects
One of the DragDropEffects values.
imageSource
String
The name or URL for an image to use as the drag cursor.
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

DoDragDrop(data, allowedEffects, imageSource, imageSize)

Begins a drag-and-drop operation.
Parameter
Type
Description
data
Object
The data to drag.
allowedEffects
One of the DragDropEffects values.
imageSource
String
The name or URL for an image to use as the drag cursor.
imageSize
Size
The size of the drag image specified in imageSource.
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

DoDragDrop(data, allowedEffects, image)

Begins a drag-and-drop operation.
Parameter
Type
Description
data
Object
The data to drag.
allowedEffects
One of the DragDropEffects values.
image
Image
An Image to use as the drag cursor.
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

DoDragDrop(data, allowedEffects, image, imageSize)

Begins a drag-and-drop operation.
Parameter
Type
Description
data
Object
The data to drag.
allowedEffects
One of the DragDropEffects values.
image
Image
An Image to use as the drag cursor.
imageSize
Size
The size of the drag image specified in image.
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.

Eval(javaScript)

Runs the javaScript code within the component's context in the browser.
Parameter
Type
Description
javaScript
String
The JavaScript code to run on the client.

Eval(javaScript, callback)

Runs the javaScript code within the component's context in the browser and returns the value to the callback method.
Parameter
Type
Description
javaScript
String
The JavaScript code to evaluate on the client.
callback
Action
Asynchronous callback method that receives the return value.

EvalAsync(javaScript)

Asynchronously runs the javaScript code within the component's context in the browser and returns an awaitable Task that contains the value returned by the remote call.
Parameter
Type
Description
javaScript
String
The JavaScript code to evaluate on the client.
Returns: Task. An awaitable Task that represents the asynchronous operation.

FindForm()

Retrieves the form that the control is on.
Returns: Form.

FindPage()

Retrieves the page that the control is on.
Returns: Page.

Focus()

Sets input focus to the control.
Returns: Boolean. true if the input focus request was successful; otherwise, false.

GetChildAtPoint(pt, skipValue)

Retrieves the child control that is located at the specified coordinates, specifying whether to ignore child controls of a certain type.
Parameter
Type
Description
pt
Point
A Point that contains the coordinates where you want to look for a control. Coordinates are expressed relative to the upper-left corner of the control's client area.
skipValue
One of the values of GetChildAtPointSkip, determining whether to ignore child controls of a certain type.
Returns: Control. The child Control at the specified coordinates.

GetChildAtPoint(pt)

Retrieves the child control that is located at the specified coordinates.
Parameter
Type
Description
pt
Point
A Point that contains the coordinates where you want to look for a control. Coordinates are expressed relative to the upper-left corner of the control's client area.
Returns: Control. A Control that represents the control that is located at the specified point.

GetClientEventListener(id)

Returns the script associated to the listener identified by id .
Parameter
Type
Description
id
Int32
Id of the listener to retrieve the script for.
Returns: String. JavaScript associated with the listener.

GetClientEventListener(name)

Returns the scripts for all the listeners attached to the event name .
Parameter
Type
Description
name
String
Name of the event.
Returns: String[]. String array containing the scripts for the listeners attached to the event.

GetContainerControl()

Returns the next IContainerControl up the control's chain of parents.
Returns: IContainerControl. The parent IContainerControl.

GetNextControl(control, forward)

Retrieves the next control forward or back in the tab order of child controls.
Parameter
Type
Description
control
Control
The Control to start the search with.
forward
Boolean
true to search forward in the tab order; false to search backward.
Returns: Control. The next Control in the tab order.

GetStyle(flag)

Retrieves the value of the specified control style bit for the control.
Parameter
Type
Description
flag
The ControlStyles bit to return the value from.
Returns: Boolean. true if the specified control style bit is set to true; otherwise, false.

HasClientEventListener(name)

Checks whether the specified event name has any listener attached.
Parameter
Type
Description
name
String
Name of the client event to verify.
Returns: Boolean. True if the event name has any listener attached.

HasCssClass(name)

Returns true if the property CssClass contains the specified class name .
Parameter
Type
Description
name
String
Css class name to verify.
Returns: Boolean. True of the css class name is already included in CssClass.

HasState(state)

Checks whether the specified theme state is present in the States property.
Parameter
Type
Description
state
String
Name of the state to check.
Returns: Boolean. True if the widget already has the state .

Hide()

Conceals the control from the user.

Invalidate()

Causes the control to update the client side widget. When in design mode, causes the rendered control to update its entire surface in the designer.

Invalidate(invalidateChildren)

Causes the control to update the client side widget. When in design mode, causes the rendered control to update its entire surface in the designer.
Parameter
Type
Description
invalidateChildren
Boolean
When true, invalidates all the children of the control.

Invoke(method)

Executes the specified delegate.
Parameter
Type
Description
method
Delegate
A delegate that contains a method to be called in the control's thread context.
Returns: Object. The return value from the delegate being invoked, or null if the delegate has no return value.

Invoke(method, args)

Executes the specified delegate, on the thread that owns the control's underlying window handle, with the specified list of arguments.
Parameter
Type
Description
method
Delegate
A delegate to a method that takes parameters of the same number and type that are contained in the args parameter.
args
Object[]
An array of objects to pass as arguments to the specified method. This parameter can be null if the method takes no arguments.
Returns: Object. An Object that contains the return value from the delegate being invoked, or null if the delegate has no return value.

IsMnemonic(charCode, text)

Determines whether the specified character is the mnemonic character.
Parameter
Type
Description
charCode
Char
The character to test.
text
String
The string to search.
Returns: Boolean. true if the charCode character is the mnemonic character; otherwise, false.

PointToClient(point)

Computes the location of the specified screen point into client coordinates.
Parameter
Type
Description
point
Point
The screen coordinate Point to convert.
Returns: Point. A Point that represents the converted Point, point , in client coordinates.

PointToScreen(point)

Computes the location of the specified client point into screen coordinates.
Parameter
Type
Description
point
Point
The client coordinate Point to convert.
Returns: Point. A Point that represents the converted Point, point , in screen coordinates.

RectangleToClient(rect)

Computes the size and location of the specified screen rectangle in client coordinates.
Parameter
Type
Description
rect
Rectangle
The screen coordinate Rectangle to convert.
Returns: Rectangle. A Rectangle that represents the converted Rectangle, rect , in client coordinates.

RectangleToScreen(rect)

Computes the size and location of the specified client rectangle in screen coordinates.
Parameter
Type
Description
rect
Rectangle
The client coordinate Rectangle to convert.
Returns: Rectangle. A Rectangle that represents the converted Rectangle, rect , in screen coordinates.

Refresh()

Forces the control to update corresponding client widget. When in DesignMode it forces a full redraw of the designer surface for this control, including the non-client areas such as the caption of forms or panels.

Refresh(refreshChildren)

Forces the control to update corresponding client widget. When in DesignMode it forces a full redraw of the designer surface for this control and optionally of its children, including the non-client areas such as the caption of forms or panels.
Parameter
Type
Description
refreshChildren
Boolean
True to also refresh all the children of this control.

RemoveClientEventListener(id)

Detaches and removes the listener identified by id .
Parameter
Type
Description
id
Int32
Id of the listener to remove.
Returns: Boolean. True if the id specified a valid lister and it was removed; otherwise false if id is invalid.

RemoveClientEventListener(name)

Removes all the listeners attached to the event name .
Parameter
Type
Description
name
String
Name of the event.
Returns: Boolean. True if the event name has any listener that was removed.

RemoveCssClass(name)

Removes the specified css class name from the control's CssClass property.
Parameter
Type
Description
name
String
The css class name to remove.
Returns: String. The new value of the CssClass property.

RemoveState(state)

Removes the specified theme state from the widget.
Parameter
Type
Description
state
String
Name of the state to remove.
Returns: String[]. The new list of states stored in the States property.
You can also assign a new array of states to the States property.

ResetBindings()

Causes a control bound to the BindingSource to reread all the items in the list and refresh their displayed values.

ResumeLayout()

Resumes layout logic.

ResumeLayout(performLayout)

Resumes layout logic, optionally forcing an immediate layout of all pending layout requests.
Parameter
Type
Description
performLayout
Boolean
true to apply all pending layout requests; otherwise, false.

ScrollControlIntoView(alignX, alignY)

Scrolls the control into view in the container using the specified alignX and alignY preferences.
Parameter
Type
Description
alignX
Indicates the HorizontalAlignment preference. The final location of the control depends on the scrollable range and the available space. Note that Center will not scroll the control to the center, but will instead scroll it into the closest visible location with the minimum movement.
alignY
Indicates the VerticalAlignment preference. The final location of the control depends on the scrollable range and the available space. Note that Middle will not scroll the control to the middle, but will instead scroll it into the closest visible location with the minimum movement.

ScrollControlIntoView()

Scrolls the child control into view.

Select()

Activates a control.

SelectNextControl(control, forward, tabStopOnly, nested, wrap)

Activates the next control in the list according to the specified selection rules.
Parameter
Type
Description
control
Control
The Control at which to start the search.
forward
Boolean
true to move forward in the tab order; false to move backward in the tab order.
tabStopOnly
Boolean
true to ignore the controls with the TabStop property set to false; otherwise, false.
nested
Boolean
true to include nested (children of child controls) child controls; otherwise, false.
wrap
Boolean
true to continue searching from the first control in the tab order after the last control has been reached; otherwise, false.
Returns: Boolean. true if a control was activated; otherwise, false.

SendToBack()

Sends the control to the back of the z-order.