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

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