threepenny-gui-0.9.0.0: GUI framework that uses the web browser as a display.

Safe HaskellNone
LanguageHaskell2010

Graphics.UI.Threepenny.Events

Contents

Synopsis

Synopsis

Events on DOM elements.

Convenience events

valueChange :: Element -> Event String Source #

Event that occurs when the user changes the value of the input element.

selectionChange :: Element -> Event (Maybe Int) Source #

Event that occurs when the user changes the selection of a select element.

checkedChange :: Element -> Event Bool Source #

Event that occurs when the user changes the checked status of an input element of type checkbox.

Standard DOM events

click :: Element -> Event () Source #

Mouse click.

contextmenu :: Element -> Event (Double, Double) Source #

Context menu event.

The mouse coordinates are relative to the upper left corner of the element.

mousemove :: Element -> Event (Double, Double) Source #

Event that periodically occurs while the mouse is moving over an element.

The event value represents the mouse coordinates relative to the upper left corner of the element.

Note: The body element responds to mouse move events, but only in the area occupied by actual content, not the whole browser window.

mousedown :: Element -> Event (Double, Double) Source #

Mouse down event.

The mouse coordinates are relative to the upper left corner of the element.

mouseup :: Element -> Event (Double, Double) Source #

Mouse up event.

The mouse coordinates are relative to the upper left corner of the element.

hover :: Element -> Event () Source #

Mouse enters an element.

leave :: Element -> Event () Source #

Mouse leaving an element.

focus :: Element -> Event () Source #

Element receives focus.

blur :: Element -> Event () Source #

Element loses focus.

keyup :: Element -> Event KeyCode Source #

Key released while element has focus.

keydown :: Element -> Event KeyCode Source #

Key pressed while element has focus. Returns the keycode (as opposed to the ASCII value) of any key, including SHIFT, CTRL and arrow keys.

keypress :: Element -> Event Char Source #

Key pressed while element has focus. Returns the actual character, taking into account SHIFT or CAPS LOCK.

Migration

roundCoordinates :: (Double, Double) -> (Int, Int) Source #

Round a pair of Double to the next integers. This function helps you migrate from previous versions of Threepenny-GUI.

The return types of mouse events (mousedown, mouseup, mousemove, contextmenu) have been redefined from long to double in the CSS Object Model View Model working draft, which browsers have begun to adopt.

See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent#Specifications

and https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX