Advertisement
mixster

mixster

Aug 26th, 2009
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 7.19 KB | None | 0 0
  1. program MixstersBalls;
  2. type
  3.   Tplayer = record
  4.     tabs: TTabSheet;
  5.     check: array [0..3] of TCheckBox;
  6.     CheckBox5: TCheckbox;
  7.     ComboBox1,ComboBox2 : TComboBox;
  8.     label5: TLabel;
  9.     labels: array [0..3] of TLabel;
  10.     Bevel1 : TBevel;
  11.     edits: array of Tedit;
  12. end;
  13.  
  14. var
  15.   frmDesign: TForm;
  16.   Language: TComboBox;
  17.   visibles: TCheckBox;
  18.   Random: TButton;
  19.   FormName: TEdit;
  20.   playerswitch: TScrollBar;
  21.   Panel1: TPanel;
  22.   Progress: TProgressBar;
  23.   tab: TTabsheet;
  24.   TabC: TPageControl;
  25.   name: Tedit;
  26.   str: TStringArray;
  27.   player: array of TPlayer;
  28.   c: integer;
  29.  
  30. procedure ChangeName(Sender: TObject);
  31. begin
  32.   frmdesign.Caption := FormName.Text
  33. end;
  34.  
  35. procedure ChangeVisible(Sender: TObject);
  36. begin
  37.   if visibles.checked then
  38.     MakeWindowTransparent(frmDesign.Handle, 100)
  39.   else
  40.     MakeWindowTransparent(frmDesign.Handle, 255);
  41. end;
  42.  
  43. procedure ChangeLanguage;
  44. var lang: array [0..2] of TStringArray;
  45.   a, i: integer;
  46. begin
  47.   {english}lang[0] := ['Language', 'Visible?', 'Randomize!'{, tabc.tabs[0]}];
  48.   {spanish}lang[1] := [];
  49.   { Danish}lang[2] := [];
  50.   //a := tabc.tabindex;
  51.   Language.Text := lang[a][0];
  52.   Visibles.caption := lang[a][1];
  53.   random.caption := lang[a][2];
  54.   //tabc.tabs[0] := lang[a][4];
  55.   //for i := 1 to tabc.tabs.count do
  56.   //  tabc.tabs[i] := lang[a][5];
  57. end;
  58.  
  59. procedure FormatColor(sender:Tobject);
  60. begin
  61.   if Tedit(sender).text = '' then
  62.   begin
  63.     Tedit(sender).Font.color := clSilver;
  64.     Tedit(sender).Text := str[Tedit(sender).tag];
  65.   end;
  66. end;
  67.  
  68. procedure ChangeColours(Sender: TObject);
  69. begin
  70.   if Tedit(sender).text = str[Tedit(sender).tag] then
  71.   begin
  72.     Tedit(sender).Font.Color := clBlack;
  73.     Tedit(sender).Text := '';
  74.   end;
  75. end;
  76.  
  77. procedure Checkers(Sender: TObject);
  78. var i: integer;
  79. begin
  80.   if sender = Player[c].Checkbox5 then
  81.   begin
  82.     Player[c].Combobox1.visible := Player[c].Checkbox5.checked;
  83.     exit;
  84.   end;
  85.   for i := 0 to high(Player[c].Check) do
  86.     if sender = Player[c].check[i] then
  87.     begin
  88.       Player[c].edits[i].enabled := Player[c].check[i].checked;
  89.       break;
  90.     end;
  91. end;
  92.  
  93. procedure AddTab;
  94. var h, i: integer;
  95.   rects: array of TBox;
  96.   a: TStringArray;
  97. begin
  98.   SetArrayLength(player, GetArrayLength(Player) + 1);
  99.   h := high(Player);
  100.  
  101.   Player[h].tabs := ttabsheet.create(panel1);
  102.   Player[h].tabs.parent := panel1;
  103.   Player[h].tabs.caption := 'Player' + inttostr(h + 1);
  104.   Player[h].tabs.PageControl := tabc;
  105.  
  106.   Player[h].Label5 := TLabel.Create(player[h].tabs);
  107.   Player[h].Label5.Parent := player[h].tabs;
  108.   Player[h].Label5.SetBounds(160,11,203,13);
  109.   Player[h].Label5.Caption := 'Level you wish to stop cutting each tree at.';
  110.  
  111.   SetArrayLength(Player[h].edits, 6);
  112.   rects := [inttobox(160,32,33,21), inttobox(160,64,33,21), inttobox(160,96,33,21), inttobox(160,128,33,21), inttobox(10,10,121,21), inttobox(10,42,121,21)];
  113.   Str := ['Tree', 'Oak', 'Willow', 'Yew', 'Password', 'Username'];
  114.   for i := 0 to high(Player[h].edits) do
  115.   begin
  116.     Player[h].Edits[i] := TEdit.Create(player[h].tabs);
  117.     Player[h].Edits[i].Parent := player[h].tabs;
  118.     Player[h].Edits[i].SetBounds(rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
  119.     Player[h].Edits[i].Text := str[i];
  120.     Player[h].Edits[i].Font.Color := clsilver;
  121.     Player[h].Edits[i].OnEnter := @ChangeColours;
  122.     Player[h].Edits[i].OnExit := @FormatColor;
  123.     Player[h].Edits[i].tag := i;
  124.     if i < 5 then
  125.       Player[h].Edits[i].MaxLength := 2;
  126.   end;
  127.   Player[h].Bevel1 := TBevel.Create(player[h].tabs);
  128.   Player[h].Bevel1.Parent := player[h].tabs;
  129.   Player[h].bevel1.SetBounds(Player[h].Edits[5].left,Player[h].Edits[5].top + 32,121,7);
  130.   Player[h].Bevel1.Shape := bsBottomLine;
  131.  
  132.   Player[h].ComboBox2 := TComboBox.Create(player[h].tabs);
  133.   Player[h].ComboBox2.Parent := player[h].tabs;
  134.   Player[h].ComboBox2.SetBounds(Player[h].Edits[5].left,Player[h].bevel1.top + 21,121,21);
  135.   Player[h].ComboBox2.Text := 'Pick Type';
  136.   a := ['Bronze', 'Iron', 'Mithril', 'Adamant', 'Rune'];
  137.   for i := 0 to 4 do
  138.     Player[h].ComboBox2.Items.Add(a[i]);
  139.  
  140.   Player[h].CheckBox5 := TCheckBox.Create(player[h].tabs);
  141.   Player[h].CheckBox5.Parent := player[h].tabs;
  142.   Player[h].CheckBox5.SetBounds(Player[h].Edits[5].left,Player[h].ComboBox2.top + 32,97,17);
  143.   Player[h].CheckBox5.Caption := 'Bank?';
  144.   Player[h].CheckBox5.Checked := true;
  145.   Player[h].Checkbox5.OnClick := @Checkers;
  146.   Player[h].ComboBox1 := TComboBox.Create(player[h].tabs);
  147.   Player[h].ComboBox1.Parent := player[h].tabs;
  148.   Player[h].Combobox1.SetBounds(Player[h].Edits[5].left,Player[h].Checkbox5.top + 28,121,21);
  149.   Player[h].ComboBox1.Text := 'Bank';
  150.   a := ['Draynor', 'Edgeville', 'Falador', 'Lumbridge', 'Varrok'];
  151.   for i := 0 to 4 do
  152.     Player[h].ComboBox1.Items.Add(a[i]);
  153.  
  154.   for i := 0 to high(Player[h].check) do
  155.   begin
  156.     Player[h].Check[i] := TCheckBox.Create(player[h].tabs);
  157.     Player[h].Check[i].Parent := player[h].tabs;
  158.     Player[h].Check[i].SetBounds(200, 34 + i * 32, 17, 17);
  159.     Player[h].Check[i].Checked := true;
  160.     Player[h].Check[i].OnClick := @Checkers;
  161.   end;
  162. end;
  163.  
  164. procedure cc(Sender: TObject);
  165. begin
  166.   c := tabc.ActivePageIndex;
  167. end;
  168.  
  169. procedure InitForm;
  170. begin
  171.   frmDesign := CreateForm;
  172.   with frmDesign do
  173.   begin
  174.     AutoScroll := false;
  175.     frmdesign.SetBounds(0,0,696,480);
  176.     Position := poScreenCenter;
  177.     Caption := 'Balls of a Kind';
  178.   end;
  179.   Language := TComboBox.Create(frmDesign);
  180.   with Language do
  181.   begin
  182.     Parent := frmDesign;
  183.     SetBounds(0,0,145,21);
  184.     Text := 'Language';
  185.   end;
  186.   Visibles := TCheckBox.Create(frmDesign);
  187.   with Visibles do
  188.   begin
  189.     Parent := frmDesign;
  190.     SetBounds(Language.width,0,97,17);
  191.     Caption := 'Visible?';
  192.     OnClick := @ChangeVisible;
  193.   end;
  194.   random := TButton.Create(frmDesign);
  195.   with random do
  196.   begin
  197.     Parent := frmDesign;
  198.     SetBounds(Visibles.left + Visibles.width,0,75,25);
  199.     Caption := 'Randomize!';
  200.   end;
  201.   FormName := TEdit.Create(frmDesign);
  202.   with FormName do
  203.   begin
  204.     Parent := frmDesign;
  205.     SetBounds(random.left + random.width,0,121,21);
  206.     Text := 'Balls of a Kind';
  207.     OnChange := @ChangeName;
  208.   end;
  209.   playerswitch := TScrollBar.Create(frmDesign);
  210.   with playerswitch do
  211.   begin
  212.     Parent := frmDesign;
  213.     SetBounds(FormName.left + FormName.width,0,121,17);
  214.     PageSize := 0;
  215.   end;
  216.   Panel1 := TPanel.Create(frmDesign);
  217.   with panel1 do
  218.   begin
  219.     Parent := frmDesign;
  220.     Setbounds(0,24,frmdesign.width - 8,frmdesign.Height - 24 - 17 - 15);
  221.   end;
  222.   Progress := TProgressBar.Create(Panel1);
  223.   with Progress do
  224.   begin
  225.     Parent := Panel1;
  226.     Setbounds(0,panel1.height - 18,panel1.width,17);
  227.   end;
  228.   TabC := TPageControl.Create(Panel1);
  229.   tabc.Parent := Panel1;
  230.   tabc.SetBounds(0,0,panel1.Clientwidth, panel1.Clientheight - 17);
  231.   tabc.OnChange := @cc;
  232.   tab := ttabsheet.create(panel1);
  233.   tab.parent := panel1;
  234.   tab.caption := 'General';
  235.   tab.PageControl := tabc;
  236.  
  237.  
  238.  
  239.   AddTab;
  240. end;
  241.  
  242. procedure ShowFormModal;
  243. begin
  244.   frmDesign.ShowModal;
  245. end;
  246.  
  247. var
  248.   v: TVariantArray;
  249. begin
  250.   try
  251.     ThreadSafeCall('InitForm', v);
  252.     ThreadSafeCall('ShowFormModal', v);
  253.   finally
  254.     FreeForm(frmDesign);
  255.   except
  256.     WriteLn('Main form seems to not be working.');
  257.   end;
  258. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement