home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / SCRPTEXM.PAK / MLIST.SPP < prev    next >
Encoding:
Text File  |  1997-05-06  |  1.2 KB  |  54 lines

  1. //--------------------------------------------------------------------------
  2. // Object Scripting
  3. // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
  4. //
  5. // MLIST.SPP: Multi-select List Window. Demonstrates a simple multiple-
  6. //   selection list window. Also shows how to position a popup window in
  7. //   the list.
  8. //--------------------------------------------------------------------------
  9. print typeid(module());
  10.  
  11. Items = {"Smoke", "String and cups", "Pony Express", "Wink", "Flare"};
  12.  
  13. List = new ListWindow(50, 5, 200, 300, "Multiple Select Lists are cooler",
  14.                       TRUE, FALSE, Items);
  15.  
  16. on List:>Accept()
  17. {
  18.   declare value;
  19.   iterate (value; .Data) {
  20.     print value;
  21.   }
  22.   pass();
  23. }
  24.  
  25. on List:>RightClick(xPos, yPos)
  26. {
  27.  
  28.   // Create a local menu.
  29.   //
  30.   declare choices = {"one", "two", "three"};
  31.   declare menu = new PopupMenu(xPos, yPos, choices);
  32.  
  33.   switch (menu.Track()) {
  34.     case "one":
  35.       print "Choice one";
  36.       break;
  37.  
  38.     case "two":
  39.       print "Choice two";
  40.       break;
  41.  
  42.     case "three":
  43.       print "Choice three";
  44.   }
  45. }
  46.  
  47. on List:>KeyPressed(keyName)
  48. {
  49.   print("Pressed key: " + keyName);
  50. }
  51.  
  52. List.Execute();
  53.  
  54.