Interactive graphics in window is handled through the definition of event handlers of the windowItems attached with the window. The actual event handling of the window items (realizing that they are clicked, the mouse is entering them, etc) is handled entirely by Lidskjalv. The refresh of window items are also handled entirely by Lidskjalv. Please note, that these interactive facilities applies for all subpatterns of windowItem (i.e. not only for subpatterns of figureItem). Figure items are merely used here for demonstrative purposes.
Selection of a windowItem is realized by specializing the onMouseDown event pattern in the appropriate windowItem. E.g.
ORIGIN '~beta/guienv/guienv'; INCLUDE '~beta/guienv/figureitems' --- program: descriptor --- guienv (# selectWindow: @window (# go: @oval (# open:: (# do (100, 100)->position; (50, 100)->size; #); eventhandler:: (# onMouseDown:: (# do 'Selected...'->puttext #) #) #); eventhandler:: (# onAboutToClose:: (# do terminate #) #); open:: (# do (100, 100)->position; (300, 300)->size; 'ovalSelect'->title; go.open #) #) do selectWindow.open #)
Dragging is specified using the drag pattern of windowItem. Dragging of e.g. a oval can specified as follows:
ORIGIN '~beta/guienv/guienv'; INCLUDE '~beta/guienv/figureitems' --- program: descriptor --- guienv (# dragWindow: @window (# go: @oval (# open:: (# do (100, 100)->position; (50, 100)->size; 7->pen.size #); eventhandler:: (# onMouseDown:: (# do drag #) #) #); eventhandler:: (# onAboutToClose:: (# do terminate #) #); open:: (# do (100, 100)->position; (300, 300)->size; 'ovalDrag'->title; go.open #) #) do dragWindow.open #)
Lidskjalv: User Interface Framework - Tutorial | © 1995-2004 Mjølner Informatics |
[Modified: Friday October 27th 2000 at 14:56]
|