Advertisement
Guest User

Untitled

a guest
Jun 15th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.69 KB | None | 0 0
  1. type
  2.   TSlackyLine = record
  3.     Panel: TPanel;
  4.     DropDowns: array[0..2] of TComboBox;
  5.   end;
  6.  
  7. var
  8.   SlackyForm: TForm;
  9.   SlackyButton: TButton;
  10.   SlackyLines: array of TSlackyLine;
  11.  
  12. procedure addSlackyLine(Self, Sender: TObject);
  13. var
  14.   i: Int32;
  15.   Line: TSlackyLine;
  16. begin
  17.   Line.Panel.Init(SlackyForm);
  18.   Line.Panel.setParent(SlackyForm);
  19.   Line.Panel.SetAlign(alTop);
  20.  
  21.   for i := 0 to High(Line.DropDowns) do
  22.   begin
  23.     Line.DropDowns[i].Init(Line.Panel);
  24.     Line.DropDowns[i].SetParent(Line.Panel);
  25.     Line.DropDowns[i].SetAlign(alLeft);
  26.     Line.DropDowns[i].GetItems().Add('Click This');
  27.     Line.DropDowns[i].GetItems().Add('Click That');
  28.     Line.DropDowns[i].GetItems().Add('Or Maybe This');
  29.     Line.DropDowns[i].SetText('Click This');
  30.     Line.DropDowns[i].SetWidth(100);
  31.     Line.DropDowns[i].SetReadOnly(True);
  32.   end;
  33.  
  34.   Line.Panel.setBevelOuter(bvNone);
  35.   Line.Panel.setHeight(Line.DropDowns[0].GetHeight());
  36.  
  37.   SlackyLines += Line;
  38. end;
  39.  
  40. procedure ShowSlackyForm;
  41. var
  42.   i: Int32;
  43. begin
  44.   SlackyForm.Init(nil);
  45.   SlackyForm.setPosition(poScreenCenter);
  46.   SlackyForm.setWidth(300);
  47.  
  48.   SlackyButton.Init(SlackyForm);
  49.   SlackyButton.SetParent(SlackyForm);
  50.   SlackyButton.SetAlign(alTop);
  51.   SlackyButton.SetOnClick(@addSlackyLine);
  52.   SlackyButton.SetCaption('Add Operation');
  53.  
  54.   SlackyForm.ShowModal();
  55.  
  56.   for i := 0 to High(SlackyLines) do
  57.   begin
  58.     Client.WriteLn(
  59.                    SlackyLines[i].DropDowns[0].GetText() + ', ' +
  60.                    SlackyLines[i].DropDowns[1].GetText() + ', ' +
  61.                    SlackyLines[i].DropDowns[2].GetText()
  62.                   );
  63.   end;
  64.  
  65.   SlackyForm.Free();
  66. end;
  67.  
  68. begin
  69.   Sync(@ShowSlackyForm);
  70. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement