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

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