Library for GUI programming in Curry (based on Tcl/Tk).
This paper contains a description of the basic ideas
behind this library.
Version: November 2004
| Exported names: |
Datatypes:
TkCanvasItem
| TkConfCollection
| TkConfItem
| TkMenuItem
| TkRefType
| TkWidget
Constructors:
TkActive
| TkAnchor
| TkBackground
| TkBottom
| TkCanvas
| TkCenter
| TkCheckButton
| TkCol
| TkCText
| TkEntry
| TkFill
| TkFillX
| TkFillY
| TkForeground
| TkHandler
| TkHeight
| TkInit
| TkItems
| TkLabel
| TkLeft
| TkLine
| TkList
| TkListBox
| TkMatrix
| TkMButton
| TkMenu
| TkMenuButton
| TkMessage
| TkMMenuButton
| TkMSeparator
| TkOval
| TkPlainButton
| TkPolygon
| TkRectangle
| TkRef
| TkRight
| TkRow
| TkScale
| TkScrollH
| TkScrollV
| TkTcl
| TkText
| TkTextEdit
| TkTop
| TkWidth
Functions:
debugTcl
| forkWish
| openWish
| popup_message
| runConfigControlledWidget
| runControlledWidget
| runControlledWidgetInit
| runControlledWidgetOnPort
| runWidget
| runWidgetInit
| runWidgetOnPort
| runWidgetOnPortInit
| runWidgetPassive
| tkAddCanvas
| tkAppendTaggedValue
| tkAppendValue
| tkCAddCanvas
| tkCConfig
| tkCExit
| tkCFocus
| tkCGetValue
| tkConfig
| tkCSetValue
| tkCUpdate
| tkCVoid
| tkExit
| tkFocus
| tkGetValue
| tkSetValue
| tkUpdate
| tkVoid
| TkButton
| TkCanvasScroll
| TkCmd
| TkConfigButton
| TkConfigCmd
| TkEntryScroll
| TkTextEditScroll
| tkChooseColor
| tkGetOpenFile
| tkGetOpenFileWithTypes
| tkGetSaveFile
| tkGetSaveFileWithTypes
| Summary of exported functions: |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
The type of possible widgets in a GUI. "a" is the result type of event handlers, currently "IO ()" or "Success".
Constructors:
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: Int -> Int -> [TkConfItem a] -> TkWidget a
:: TkRefType -> [TkConfItem a] -> TkWidget a
:: TkRefType -> [TkConfItem a] -> TkWidget a
:: [TkConfItem a] -> TkWidget a
:: [TkConfCollection] -> [TkWidget a] -> TkWidget a
:: [TkConfCollection] -> [TkWidget a] -> TkWidget a
:: [TkConfCollection] -> [[TkWidget a]] -> TkWidget a
The data type for possible configurations of a widget.
Constructors:
:: Bool -> TkConfItem a
:: String -> TkConfItem a
:: String -> TkConfItem a
:: String -> TkConfItem a
:: ([(TkRefType,TkConfItem a)] -> Port SP_Msg -> a) -> TkConfItem a
:: Int -> TkConfItem a
:: String -> TkConfItem a
:: [TkCanvasItem] -> TkConfItem a
:: [String] -> TkConfItem a
:: [TkMenuItem a] -> TkConfItem a
:: TkRefType -> TkConfItem a
:: String -> TkConfItem a
:: Int -> TkConfItem a
:: TkConfItem a
:: TkConfItem a
:: TkConfItem a
:: String -> TkConfItem a
The data type for possible configurations of a collection of widgets.
Constructors:
:: TkConfCollection
:: TkConfCollection
:: TkConfCollection
:: TkConfCollection
:: TkConfCollection
The data type for specifying items in a menu.
Constructors:
:: (Port SP_Msg -> a) -> String -> TkMenuItem a
:: TkMenuItem a
:: String -> [TkMenuItem a] -> TkMenuItem a
The data type of items in a canvas. The last argument are further options in Tcl/Tk (for testing).
Constructors:
:: [(Int,Int)] -> String -> TkCanvasItem
:: [(Int,Int)] -> String -> TkCanvasItem
:: (Int,Int) -> (Int,Int) -> String -> TkCanvasItem
:: (Int,Int) -> (Int,Int) -> String -> TkCanvasItem
:: (Int,Int) -> String -> String -> TkCanvasItem
The (hidden) data type of references to a widget in a Tk window. Note that the constructor TkRefLabel will not be exported so that values can only be created inside this module.
Constructors:
| Exported functions: |
:: TkWidget a -> IO ()
:: String -> String -> IO ()
Initializes Tcl/Tk with some tcl text and ignores wish output.
:: String -> IO (Port SP_Msg)
Creates a new GUI window with a "title" for the top-level window (but unspecified contents). A GUI port is returned that can be used to start a GUI specification on this port (by the operations runWidgetOnPort, runWidgetOnPortInit, or runControlledWidgetOnPort).
:: String -> TkWidget (IO ()) -> IO ()
IO action to run a TkWidget in a new GUI window.
Example call: (runWidget title tkw)
title
- the title of the main window containing the widget
tkw
- the widget shown in the new window
:: String -> TkWidget (IO ()) -> (Port SP_Msg -> IO ()) -> IO ()
IO action to run a TkWidget in a new GUI window. The GUI events are processed after executing an initial action on the GUI.
Example call: (runWidgetInit title tkw initcmd)
title
- the title of the main GUI window
tkw
- the widget shown in the new GUI window
initcmd
- the initial command executed before activating the GUI
:: String -> TkWidget a -> IO (Port SP_Msg)
IO action to show a TkWidget in a new GUI window in passive mode, i.e., ignore all GUI events.
Example call: (runWidgetPassive title tkw)
title
- the title of the main window containing the widget
tkw
- the widget shown in the new window
:: String -> (TkWidget (IO ()),a -> Port SP_Msg -> IO ()) -> [a] -> IO ()
Runs a TkWidget in a new GUI window and process GUI events. In addition, an event handler is provided that process messages received from an external message stream. This operation is useful to run a GUI that should react on user events as well as messages sent to an external port.
Example call: (runControlledWidget title th msgs)
title
- the title of the main window containing the widget
th
- a pair (tkw,exth) where tkw is the widget shown in the
new window and exth is the event handler for external messages
msgs
- the stream of external messages (usually coming from
an external port)
:: String -> (TkWidget (IO ()),a -> Port SP_Msg -> IO [(TkRefType,TkConfItem (IO ()))]) -> [a] -> IO ()
Runs a TkWidget in a new GUI window and process GUI events. In addition, an event handler is provided that process messages received from an external message stream. This operation is useful to run a GUI that should react on user events as well as messages sent to an external port.
Example call: (runConfigControlledWidget title th msgs)
title
- the title of the main window containing the widget
th
- a pair (tkw,exth) where tkw is the widget shown in the
new window and exth is the event handler for external messages
that returns a list of widget reference/configuration pairs
which is applied after the handler in order to configure
some GUI widgets
msgs
- the stream of external messages (usually coming from
an external port)
:: String -> (TkWidget (IO ()),a -> Port SP_Msg -> IO ()) -> (Port SP_Msg -> IO ()) -> [a] -> IO ()
Runs a TkWidget in a new GUI window and process GUI events after executing an initial comment on the GUI window. In addition, an event handler is provided that process messages received from an external message stream. This operation is useful to run a GUI that should react on user events as well as messages sent to an external port.
Example call: (runControlledWidgetInit title th initcmd msgs)
title
- the title of the main window containing the widget
th
- a pair (tkw,exth) where tkw is the widget shown in the
new window and exth is the event handler for external messages
initcmd
- the initial command executed before starting the GUI
msgs
- the stream of external messages (usually coming from
an external port)
:: TkWidget Success -> Port SP_Msg -> Success
Runs a TkWidget on a GUI window that was previously created by the operation "openWish". This is useful to execute a GUI in parallel to other concurrent processes.
Example call: (runWidgetOnPort tkw wport)
tkw
- the widget shown in the new window
wport
- the wish port for the GUI
:: (TkWidget Success,a -> Port SP_Msg -> Success) -> [a] -> Port SP_Msg -> Success
Runs a TkWidget on a GUI window that was previously created by the operation "openWish". This is useful to execute a GUI in parallel to other concurrent processes. In addition, an event handler is provided that process messages received from an external message stream. Thus, one can run a GUI that should react on user events as well as messages sent to an external port.
Example call: (runControlledWidgetOnPort th msgs wport)
th
- a pair (tkw,exth) where tkw is the widget shown in the
new window and exth is the event handler for external messages
msgs
- the stream of external messages (usually coming from
an external port)
wport
- the wish port for the GUI
:: TkWidget Success -> Port SP_Msg -> (Port SP_Msg -> Success) -> Success
Runs a TkWidget on a GUI window that was previously created by the operation "openWish". This is useful to execute a GUI in parallel to other concurrent processes. The GUI is actually started after executing an initial command for the GUI.
Example call: (runWidgetOnPortInit tkw wport initcmd)
tkw
- the widget shown in the new GUI window
wport
- the wish port for the GUI
initcmd
- the initial command executed before starting the GUI
:: TkRefType -> TkConfItem a -> Port SP_Msg -> IO ()
Changes the current configuration of a widget (deprecated operation, only included for backward compatibility). Warning: does not work for TkCmd options!
:: TkRefType -> TkConfItem a -> Port SP_Msg -> Success
Changes the current configuration of a widget (deprecated operation, only included for backward compatibility). Warning: does not work for TkCmd options!
:: Port SP_Msg -> IO ()
An event handler that does nothing.
:: Port SP_Msg -> IO ()
An event handler for terminating the GUI.
:: TkRefType -> Port SP_Msg -> IO String
Gets the (String) value of a variable in a GUI.
:: TkRefType -> String -> Port SP_Msg -> IO ()
Sets the (String) value of a variable in a GUI.
:: (String -> String) -> TkRefType -> Port SP_Msg -> IO ()
Updates the (String) value of a variable w.r.t. to an update function.
:: TkRefType -> String -> Port SP_Msg -> IO ()
Appends a String value to the contents of a TextEdit widget and adjust the view to the end of the TextEdit widget.
:: TkRefType -> String -> String -> Port SP_Msg -> IO ()
This is an experimental function and might be changed in the future. Appends a String value with tags to the contents of a TextEdit widget and adjust the view to the end of the TextEdit widget.
:: TkRefType -> Port SP_Msg -> IO ()
Sets the input focus of this GUI to the widget referred by the first argument. This is useful for automatically selecting input entries in an application.
:: TkRefType -> [TkCanvasItem] -> Port SP_Msg -> IO ()
Adds a list of canvas items to a canvas referred by the first argument.
:: Port SP_Msg -> Success
An event handler that does nothing.
:: Port SP_Msg -> Success
An event handler for terminating the GUI.
:: TkRefType -> Port SP_Msg -> String -> Success
Gets the (String) value of a variable in a GUI.
:: TkRefType -> String -> Port SP_Msg -> Success
Sets the (String) value of a variable in a GUI.
:: (String -> String) -> TkRefType -> Port SP_Msg -> Success
Updates the (String) value of a variable w.r.t. to an update function.
:: TkRefType -> Port SP_Msg -> Success
Sets the input focus of this GUI to the widget referred by the first argument. This is useful for automatically selecting input entries in an application.
:: TkRefType -> [TkCanvasItem] -> Port SP_Msg -> Success
Adds a list of canvas items to a canvas referred by the first argument.
:: String -> IO ()
A simple popup message.
:: (Port SP_Msg -> a) -> TkConfItem a
A simple event handler that can be associated to a widget. The event handler takes a GUI port as parameter in order to read or write values from/into the GUI.
:: (Port SP_Msg -> IO [(TkRefType,TkConfItem (IO ()))]) -> TkConfItem (IO ())
An event handler that can be associated to a widget. The event handler takes a GUI port as parameter (in order to read or write values from/into the GUI) and returns a list of widget reference/configuration pairs which is applied after the handler in order to configure some GUI widgets.
:: (Port SP_Msg -> a) -> [TkConfItem a] -> TkWidget a
A button with an associated event handler which is activated if the button is pressed.
:: (Port SP_Msg -> IO [(TkRefType,TkConfItem (IO ()))]) -> [TkConfItem (IO ())] -> TkWidget (IO ())
A button with an associated event handler which is activated if the button is pressed. The event handler is a configuration handler (see TkConfigCmd) that allows the configuration of some widgets.
:: [TkConfItem a] -> TkWidget a
A text edit widget with vertical and horizontal scrollbars. The argument contains the configuration options for the text edit widget.
:: [TkConfItem a] -> TkWidget a
A canvas widget with vertical and horizontal scrollbars. The argument contains the configuration options for the text edit widget.
:: [TkConfItem a] -> TkWidget a
An entry widget with a horizontal scrollbar. The argument contains the configuration options for the entry widget.
:: IO String
Pops up a GUI for selecting an existing file. The file with its full path name will be returned (or "" if the user cancels the selection).
:: [(String,String)] -> IO String
Pops up a GUI for selecting an existing file. The parameter is a list of pairs of file types that could be selected. A file type pair consists of a name and an extension for that file type. The file with its full path name will be returned (or "" if the user cancels the selection).
:: IO String
Pops up a GUI for choosing a file to save some data. If the user chooses an existing file, she/he will asked to confirm to overwrite it. The file with its full path name will be returned (or "" if the user cancels the selection).
:: [(String,String)] -> IO String
Pops up a GUI for choosing a file to save some data. The parameter is a list of pairs of file types that could be selected. A file type pair consists of a name and an extension for that file type. If the user chooses an existing file, she/he will asked to confirm to overwrite it. The file with its full path name will be returned (or "" if the user cancels the selection).
:: IO String
Pops up a GUI dialog box to select a color. The name of the color will be returned (or "" if the user cancels the selection).