home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / dialgmgr.sit / Sample.p < prev    next >
Text File  |  1990-01-04  |  2KB  |  90 lines

  1. program Sample;
  2.  
  3.     uses
  4.         TObject, TDialogs;
  5.  
  6.     const
  7.         red = 5;
  8.         white = 6;
  9.         blue = 7;
  10.         young = 8;
  11.         old = 9;
  12.         smart = 10;
  13.         name = 3;
  14.         nameCheck = 11;
  15.         nameList = 4;
  16.         fun = 12;
  17.         job = 13;
  18.         popStatic = 16;
  19.         popMenuNum = 2000;
  20.         townList = 15;
  21.  
  22.     var
  23.         theDialog: TDialog;
  24.         theItem: Integer;
  25.         number: Integer;
  26.         text: Str255;
  27.         textRect: Rect;
  28.  
  29. begin
  30.     SetRect(TextRect, 5, 40, 500, 175);
  31.     SetTextRect(TextRect);
  32.     ShowText;
  33.  
  34.     new(theDialog);
  35.     theDialog.Init;
  36.     theDialog.Define(2001, [smart], fun);
  37.     theDialog.RadioGroup(white, [red, white, blue], 'Color', FALSE);
  38.     theDialog.RadioGroup(young, [young, old], 'Age', TRUE);
  39.     theDialog.TextGroup(nameCheck, name);
  40.     theDialog.PopMenu(nil, popMenuNum, popStatic, 7);
  41.     theDialog.KeyButton(CHR(returnCode), OK);
  42.     theDialog.KeyButton(CHR(enterCode), OK);
  43.     theDialog.KeyButton('o', OK);
  44.     theDialog.KeyButton('.', Cancel);
  45.     theDialog.ItemList(nameList, 3, 5);
  46.     theDialog.ItemListText('Tom');
  47.     theDialog.ItemListText('Dick');
  48.     theDialog.ItemListText('Harry');
  49.     theDialog.ItemListText('Sally');
  50.     theDialog.ItemListText('Susan');
  51.     theDialog.ItemListText('Alice');
  52.     theDialog.ItemList(townList, 2, 5);
  53.     theDialog.ItemListText('Natick');
  54.     theDialog.ItemListText('Boston');
  55.     theDialog.ItemListText('Cambridge');
  56.     theDialog.ItemListText('Salem');
  57.     theDialog.ItemListText('Seattle');
  58.     theDialog.ItemListText('Portland');
  59.     theDialog.ItemListText('San Diego');
  60.     theDialog.ItemListText('San Francisco');
  61.     theDialog.ItemListText('Marin');
  62.     theDialog.ItemListText('Orlando');
  63.  
  64.     theDialog.Display(TRUE);
  65.     theItem := theDialog.Accept;
  66.  
  67.     Writeln('Button Clicked ', theItem : 3);
  68.     theDialog.ItemListGet(1, number, text);
  69.     Writeln('Item list #1 ', number : 3, ' ', text);
  70.     theDialog.ItemListGet(2, number, text);
  71.     Writeln('Item list #2 ', number : 3, ' ', text);
  72.     theDialog.RadioGroupGet(1, number);
  73.     Writeln('Radio Group #1 ', number : 3);
  74.     theDialog.RadioGroupGet(2, number);
  75.     Writeln('Radio Group #2 ', number : 3);
  76.     theDialog.PopMenuGet(1, number, text);
  77.     Writeln('PopUp Menu #1 ', number : 3, ' ', text);
  78.     number := theDialog.GetLongintValue(name);
  79.     text := theDialog.GetStringValue(name);
  80.     Writeln('Item name: ', number : 3, ' ', text);
  81.     number := theDialog.GetLongintValue(fun);
  82.     text := theDialog.GetStringValue(fun);
  83.     Writeln('Item fun: ', number : 3, ' ', text);
  84.     number := theDialog.GetLongintValue(job);
  85.     text := theDialog.GetStringValue(job);
  86.     Writeln('Item job: ', number : 3, ' ', text);
  87.  
  88.     theDialog.Free;
  89.  
  90. end.