home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 August / PCWorld_2000-08_cd.bin / Software / TemaCD / xbasic / xbpro.exe / xb / app / tmess1.x < prev    next >
Text File  |  1995-08-11  |  4KB  |  119 lines

  1. '
  2. ' ####################
  3. ' #####  PROLOG  #####
  4. ' ####################
  5. '
  6. PROGRAM "tmess1"
  7. VERSION "0.0000"
  8. '
  9. IMPORT  "xst"
  10. IMPORT  "xgr"
  11. IMPORT  "xui"
  12. '
  13. INTERNAL FUNCTION  Message1B       ( )
  14. INTERNAL FUNCTION  GetDisplayGrid  ( @label )
  15. INTERNAL FUNCTION  DisplayCallback ( grid, message$, v0, v1, v2, v3, kid, r1$ )
  16. '
  17. '
  18. ' #######################
  19. ' #####  Message1B  #####
  20. ' #######################
  21. '
  22. FUNCTION  Message1B ()
  23.   $XuiMessage1B = 16
  24. '
  25.   GetDisplayGrid ( @label )
  26. '
  27. ' create window with XuiMessage1B grid
  28. '
  29.   XuiCreateWindow      (@grid, @"XuiMessage1B", 100, 256, 200, 80, 0, "")
  30.   XuiSendStringMessage ( grid, @"SetCallback", grid, &XuiQueueCallbacks(), -1, -1, $XuiMessage1B, -1)
  31.   XuiSendStringMessage ( grid, @"SetGridName", 0, 0, 0, 0, 0, @"Message1B")
  32.   XuiSendStringMessage ( grid, @"SetTextString", 0, 0, 0, 0, 1, @"XuiMessage1B")
  33.   XuiSendStringMessage ( grid, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
  34. '
  35. ' convenience function message loop
  36. '
  37.   DO
  38.     XgrProcessMessages (1)
  39.     DO WHILE XuiGetNextCallback (@grid, @message$, @v0, @v1, @v2, @v3, @kid, @r1$)
  40.       GOSUB Callback
  41.     LOOP
  42.   LOOP
  43.   RETURN
  44. '
  45. ' callback
  46. '
  47. SUB Callback
  48.   win = kid >> 16
  49.   kid = kid AND 0xFF
  50.   SELECT CASE message$
  51.     CASE "CloseWindow" : QUIT (0)
  52.     CASE "Selection"   : GOSUB Selection
  53.     CASE ELSE          : DisplayCallback (grid, @message$, v0, v1, v2, v3, kid, @r1$)
  54.   END SELECT
  55. END SUB
  56. '
  57. ' Selection message
  58. '
  59. SUB Selection
  60.   text$ = "XuiMessage1B"
  61.   text$ = text$ + "\n    grid = " + HEX$ (grid,8)
  62.   text$ = text$ + "\n message = " + message$
  63.   text$ = text$ + "\n   state = " + HEX$ (v0,8) + v0$
  64.   text$ = text$ + "\n      v1 = " + HEX$ (v1,8)
  65.   text$ = text$ + "\n      v2 = " + HEX$ (v2,8)
  66.   text$ = text$ + "\n      v3 = " + HEX$ (v3,8)
  67.   text$ = text$ + "\n     kid = " + HEX$ (kid,8)
  68.   text$ = text$ + "\n     r1$ = " + r1$
  69.   XuiSendStringMessage (label, @"SetTextString", 0, 0, 0, 0, 0, @text$)    ' set message text
  70.   XuiSendStringMessage (label, @"Redraw", 0, 0, 0, 0, 0, 0)                ' redraw label
  71. END SUB
  72. END FUNCTION
  73. '
  74. '
  75. ' ###############################
  76. ' #####  GetDisplayGrid ()  #####
  77. ' ###############################
  78. '
  79. FUNCTION  GetDisplayGrid ( label )
  80.   STATIC  grid
  81. '
  82.   IFZ grid THEN
  83.     XuiCreateWindow      (@grid, @"XuiLabel", 100, 100, 512, 128, 0, "")
  84.     XuiSendStringMessage ( grid, @"SetColor", $$BrightGreen, -1, -1, -1, 0, 0)
  85.     XuiSendStringMessage ( grid, @"SetAlign", $$AlignUpperLeft, 0, 0, 0, 0, 0)
  86.     XuiSendStringMessage ( grid, @"SetJustify", $$JustifyLeft, 0, 0, 0, 0, 0)
  87.     XuiSendStringMessage ( grid, @"SetIndent", 6, 4, 0, 0, 0, 0)
  88.     XuiSendStringMessage ( grid, @"DisplayWindow", 0, 0, 0, 0, 0, 0)
  89.   END IF
  90. '
  91.   label = grid
  92. END FUNCTION
  93. '
  94. '
  95. ' ################################
  96. ' #####  DisplayCallback ()  #####
  97. ' ################################
  98. '
  99. FUNCTION  DisplayCallback ( grid, message$, v0, v1, v2, v3, kid, r1$ )
  100. '
  101.   XgrGetGridType (grid, @gridType)
  102.   XgrGridTypeNumberToName (gridType, @gridType$)
  103. '
  104.   text$ = gridType$ + "\n"
  105.   text$ = text$ + "    grid = " + HEX$ (grid, 8) + "\n"
  106.   text$ = text$ + " message = " + message$ + "\n"
  107.   text$ = text$ + "      v0 = " + HEX$ (v0,8) + "\n"
  108.   text$ = text$ + "      v1 = " + HEX$ (v1,8) + "\n"
  109.   text$ = text$ + "      v2 = " + HEX$ (v2,8) + "\n"
  110.   text$ = text$ + "      v3 = " + HEX$ (v3,8) + "\n"
  111.   text$ = text$ + "     kid = " + HEX$ (kid,8) + "\n"
  112.   text$ = text$ + "     r1$ = " + r1$
  113. '
  114.   GetDisplayGrid (@label)
  115.   XuiSendStringMessage (label, @"SetTextString", 0, 0, 0, 0, 0, @text$)
  116.   XuiSendStringMessage (label, @"Redraw", 0, 0, 0, 0, 0, 0)
  117. END FUNCTION
  118. END PROGRAM