'
'
' ######################
' ##### Progress #####
' ######################
'
FUNCTION Progress ()
$XuiProgress = 20
'
delta = 2
GetDisplayGrid ( @label )
'
' create window with XuiProgress grid
'
XuiCreateWindow (@grid, @"XuiProgress", 100, 256, 200, 80, 0, "")
XuiSendStringMessage ( grid, @"SetCallback", grid, &XuiQueueCallbacks(), -1, -1, $XuiProgress, -1)
XuiSendStringMessage ( grid, @"SetGridName", 0, 0, 0, 0, 0, @"Progress")
XuiSendStringMessage ( grid, @"SetValues", 50, 100, 0, 0, 0, 0)
XuiSendStringMessage ( grid, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
'
' convenience function message loop
'
DO
XgrProcessMessages (1)
DO WHILE XuiGetNextCallback (@grid, @message$, @v0, @v1, @v2, @v3, @kid, @r1$)
GOSUB Callback
LOOP
LOOP
RETURN
'
' callback
'
SUB Callback
win = kid >> 16
kid = kid AND 0xFF
SELECT CASE message$
CASE "CloseWindow" : QUIT (0)
CASE "Selection" : GOSUB Selection
CASE ELSE : DisplayCallback (grid, @message$, v0, v1, v2, v3, kid, @r1$)
XuiSendStringMessage (grid, @"GetValues", @v0, @v1, 0, 0, 0, 0)
v0 = v0 + delta
IF (v0 > 100) THEN v0 = v0 - delta - delta : delta = -delta
IF (v0 < 0) THEN v0 = v0 - delta - delta : delta = -delta
XuiSendStringMessage (grid, @"SetValues", v0, v1, 0, 0, 0, 0)
END SELECT
END SUB
'
' Selection message
'
SUB Selection
text$ = "XuiProgress"
text$ = text$ + "\n grid = " + HEX$ (grid,8)
text$ = text$ + "\n message = " + message$
text$ = text$ + "\n state = " + HEX$ (v0,8) + v0$
text$ = text$ + "\n v1 = " + HEX$ (v1,8)
text$ = text$ + "\n v2 = " + HEX$ (v2,8)
text$ = text$ + "\n v3 = " + HEX$ (v3,8)
text$ = text$ + "\n kid = " + HEX$ (kid,8)
text$ = text$ + "\n r1$ = " + r1$
XuiSendStringMessage (label, @"SetTextString", 0, 0, 0, 0, 0, @text$) ' set message text
XuiSendStringMessage (label, @"Redraw", 0, 0, 0, 0, 0, 0) ' redraw label
END SUB
END FUNCTION