Results 1 to 4 of 4

Thread: Tform

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Tform

    How to I make user inputed stuff effect variables with Tform text area and combo box, also how do I add items to combo box?

    Here is my code:

    Simba Code:
    Const
    FONTS = 7;
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel2,TLabel5,TLabel9,TLabel10,TLabel11,TLabel12,TLabel13,TLabel14,TLabel15,TLabel16,TLabel25,TLabel26,TLabel28,TLabel30: TLabel;
      username,password,Color,Hue,Sat,Tol,Uptext_1,Uptext_2,Uptext_3,Food_col,fooduptext: TEdit;
      TImage17: TImage;
      TListBox6,TListBox7: TListBox;
      TComboBox8,Food: TComboBox;
      bmps0: TMufasaBitmap;
      bmp0: TBitmap;
    const
      default = 'Comic Sans MS';



    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='DsgnForm';
          Left:=664;
          Top:=440;
          Width:=400;
          Height:=300;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='Login settings';
          Left:=43;
          Top:=13;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Username';
          Left:=14;
          Top:=40;
          Width:=49;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel2\\
     TLabel2:=TLabel.Create(DsgnForm);
      with TLabel2 do
        begin
          Parent:=DsgnForm;
          Caption:='Password';
          Left:=14;
          Top:=71;
          Width:=47;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel5\\
     TLabel5:=TLabel.Create(DsgnForm);
      with TLabel5 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster settings';
          Left:=133;
          Top:=120;
          Width:=81;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel9\\
     TLabel9:=TLabel.Create(DsgnForm);
      with TLabel9 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster';
          Left:=19;
          Top:=140;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel10\\
     TLabel10:=TLabel.Create(DsgnForm);
      with TLabel10 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=18;
          Top:=174;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel11\\
     TLabel11:=TLabel.Create(DsgnForm);
      with TLabel11 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Hue';
          Left:=19;
          Top:=202;
          Width:=59;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel12\\
     TLabel12:=TLabel.Create(DsgnForm);
      with TLabel12 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Sat';
          Left:=19;
          Top:=229;
          Width:=56;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel13\\
     TLabel13:=TLabel.Create(DsgnForm);
      with TLabel13 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Tolerance';
          Left:=20;
          Top:=253;
          Width:=87;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel14\\
     TLabel14:=TLabel.Create(DsgnForm);
      with TLabel14 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_1';
          Left:=181;
          Top:=175;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel15\\
     TLabel15:=TLabel.Create(DsgnForm);
      with TLabel15 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_2';
          Left:=182;
          Top:=202;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel16\\
     TLabel16:=TLabel.Create(DsgnForm);
      with TLabel16 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_3';
          Left:=183;
          Top:=232;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel25\\
     TLabel25:=TLabel.Create(DsgnForm);
      with TLabel25 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Settings';
          Left:=241;
          Top:=14;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel26\\
     TLabel26:=TLabel.Create(DsgnForm);
      with TLabel26 do
        begin
          Parent:=DsgnForm;
          Caption:='Food';
          Left:=159;
          Top:=42;
          Width:=25;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel28\\
     TLabel28:=TLabel.Create(DsgnForm);
      with TLabel28 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=153;
          Top:=75;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel30\\
     TLabel30:=TLabel.Create(DsgnForm);
      with TLabel30 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Uptext';
          Left:=154;
          Top:=101;
          Width:=61;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //username\\
     username:=TEdit.Create(DsgnForm);
      with username do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=38;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //username.MaxLength:=x;
    //username.PasswordChar:=*;
      end;
    //password\\
     password:=TEdit.Create(DsgnForm);
      with password do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=69;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //password.MaxLength:=x;
    //password.PasswordChar:=*;
      end;
    //Color\\
     Color:=TEdit.Create(DsgnForm);
      with Color do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=171;
          Width:=91;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Color.MaxLength:=x;
    //Color.PasswordChar:=*;
      end;
    //Hue\\
     Hue:=TEdit.Create(DsgnForm);
      with Hue do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=85;
          Top:=200;
          Width:=45;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Hue.MaxLength:=x;
    //Hue.PasswordChar:=*;
      end;
    //Sat\\
     Sat:=TEdit.Create(DsgnForm);
      with Sat do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=228;
          Width:=46;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Sat.MaxLength:=x;
    //Sat.PasswordChar:=*;
      end;
    //Tol\\
     Tol:=TEdit.Create(DsgnForm);
      with Tol do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=111;
          Top:=251;
          Width:=43;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Tol.MaxLength:=x;
    //Tol.PasswordChar:=*;
      end;
    //Uptext_1\\
     Uptext_1:=TEdit.Create(DsgnForm);
      with Uptext_1 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=232;
          Top:=175;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_1.MaxLength:=x;
    //Uptext_1.PasswordChar:=*;
      end;
    //Uptext_2\\
     Uptext_2:=TEdit.Create(DsgnForm);
      with Uptext_2 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=202;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_2.MaxLength:=x;
    //Uptext_2.PasswordChar:=*;
      end;
    //Uptext_3\\
     Uptext_3:=TEdit.Create(DsgnForm);
      with Uptext_3 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=231;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_3.MaxLength:=x;
    //Uptext_3.PasswordChar:=*;
      end;
    //Food_col\\
     Food_col:=TEdit.Create(DsgnForm);
      with Food_col do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=218;
          Top:=71;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Food_col.MaxLength:=x;
    //Food_col.PasswordChar:=*;
      end;
    //fooduptext\\
     fooduptext:=TEdit.Create(DsgnForm);
      with fooduptext do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=220;
          Top:=99;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //fooduptext.MaxLength:=x;
    //fooduptext.PasswordChar:=*;
      end;
    //TListBox6\\
     TListBox6:=TListBox.Create(DsgnForm);
      with TListBox6 do
        begin
          Parent:=DsgnForm;
          Left:=508;
          Top:=201;
          Width:=0;
          Height:=10;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TListBox7\\
     TListBox7:=TListBox.Create(DsgnForm);
      with TListBox7 do
        begin
          Parent:=DsgnForm;
          Left:=329;
          Top:=429;
          Width:=100;
          Height:=80;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TComboBox8\\
     TComboBox8:=TComboBox.Create(DsgnForm);
      with TComboBox8 do
        begin
          Parent:=DsgnForm;
          Left:=72;
          Top:=136;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //Food\\
     Food:=TComboBox.Create(DsgnForm);
      with Food do
        begin
          Parent:=DsgnForm;
          Left:=187;
          Top:=39;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;


    procedure ShowFormModal;
    begin
      DsgnForm.ShowModal;
    end;


    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;


    begin
      SafeInitForm;
      SafeShowFormModal;
    end.

  2. #2
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    545
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Simba Code:
    program new;
    Const
    FONTS = 7;
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel2,TLabel5,TLabel9,TLabel10,TLabel11,TLabel12,TLabel13,TLabel14,TLabel15,TLabel16,TLabel25,TLabel26,TLabel28,TLabel30: TLabel;
      username,password,Color,Hue,Sat,Tol,Uptext_1,Uptext_2,Uptext_3,Food_col,fooduptext: TEdit;
      TImage17: TImage;
      TListBox6,TListBox7: TListBox;
      Button: TButton;
      TComboBox8,Food: TComboBox;
      bmps0: TMufasaBitmap;
      bmp0: TBitmap;
    const
      default = 'Comic Sans MS';



    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;

    var
      FormFood, FormUser, FormHue: string;

    // username,password,Color,Hue,Sat,Tol,Uptext_1,Uptext_2,Uptext_3,Food_col,fooduptext: TEdit;
    procedure SaveFormInfo(Sender: TObject);
    begin
      FormUser := username.TEXT
      FormHue := Hue.TEXT;
      FormFood := Food.TEXT;                                                          // Saving the text, before we close the form
      DsgnForm.CLOSE;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='DsgnForm';
          Position := poMainFormCenter;
          Left:=664;
          Top:=440;
          Width:=400;
          Height:=300;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='Login settings';
          Left:=43;
          Top:=13;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Username';
          Left:=14;
          Top:=40;
          Width:=49;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel2\\
     TLabel2:=TLabel.Create(DsgnForm);
      with TLabel2 do
        begin
          Parent:=DsgnForm;
          Caption:='Password';
          Left:=14;
          Top:=71;
          Width:=47;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel5\\
     TLabel5:=TLabel.Create(DsgnForm);
      with TLabel5 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster settings';
          Left:=133;
          Top:=120;
          Width:=81;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel9\\
     TLabel9:=TLabel.Create(DsgnForm);
      with TLabel9 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster';
          Left:=19;
          Top:=140;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel10\\
     TLabel10:=TLabel.Create(DsgnForm);
      with TLabel10 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=18;
          Top:=174;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel11\\
     TLabel11:=TLabel.Create(DsgnForm);
      with TLabel11 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Hue';
          Left:=19;
          Top:=202;
          Width:=59;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel12\\
     TLabel12:=TLabel.Create(DsgnForm);
      with TLabel12 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Sat';
          Left:=19;
          Top:=229;
          Width:=56;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel13\\
     TLabel13:=TLabel.Create(DsgnForm);
      with TLabel13 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Tolerance';
          Left:=20;
          Top:=253;
          Width:=87;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel14\\
     TLabel14:=TLabel.Create(DsgnForm);
      with TLabel14 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_1';
          Left:=181;
          Top:=175;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel15\\
     TLabel15:=TLabel.Create(DsgnForm);
      with TLabel15 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_2';
          Left:=182;
          Top:=202;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel16\\
     TLabel16:=TLabel.Create(DsgnForm);
      with TLabel16 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_3';
          Left:=183;
          Top:=232;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel25\\
     TLabel25:=TLabel.Create(DsgnForm);
      with TLabel25 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Settings';
          Left:=241;
          Top:=14;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel26\\
     TLabel26:=TLabel.Create(DsgnForm);
      with TLabel26 do
        begin
          Parent:=DsgnForm;
          Caption:='Food';
          Left:=159;
          Top:=42;
          Width:=25;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel28\\
     TLabel28:=TLabel.Create(DsgnForm);
      with TLabel28 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=153;
          Top:=75;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel30\\
     TLabel30:=TLabel.Create(DsgnForm);
      with TLabel30 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Uptext';
          Left:=154;
          Top:=101;
          Width:=61;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //username\\
     username:=TEdit.Create(DsgnForm);
      with username do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=38;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //username.MaxLength:=x;
    //username.PasswordChar:=*;
      end;
    //password\\
     password:=TEdit.Create(DsgnForm);
      with password do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=69;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //password.MaxLength:=x;
    //password.PasswordChar:=*;
      end;
    //Color\\
     Color:=TEdit.Create(DsgnForm);
      with Color do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=171;
          Width:=91;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Color.MaxLength:=x;
    //Color.PasswordChar:=*;
      end;
    //Hue\\
     Hue:=TEdit.Create(DsgnForm);
      with Hue do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=85;
          Top:=200;
          Width:=45;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Hue.MaxLength:=x;
    //Hue.PasswordChar:=*;
      end;
    //Sat\\
     Sat:=TEdit.Create(DsgnForm);
      with Sat do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=228;
          Width:=46;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Sat.MaxLength:=x;
    //Sat.PasswordChar:=*;
      end;
    //Tol\\
     Tol:=TEdit.Create(DsgnForm);
      with Tol do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=111;
          Top:=251;
          Width:=43;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Tol.MaxLength:=x;
    //Tol.PasswordChar:=*;
      end;
    //Uptext_1\\
     Uptext_1:=TEdit.Create(DsgnForm);
      with Uptext_1 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=232;
          Top:=175;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_1.MaxLength:=x;
    //Uptext_1.PasswordChar:=*;
      end;
    //Uptext_2\\
     Uptext_2:=TEdit.Create(DsgnForm);
      with Uptext_2 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=202;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_2.MaxLength:=x;
    //Uptext_2.PasswordChar:=*;
      end;
    //Uptext_3\\
     Uptext_3:=TEdit.Create(DsgnForm);
      with Uptext_3 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=231;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_3.MaxLength:=x;
    //Uptext_3.PasswordChar:=*;
      end;
    //Food_col\\
     Food_col:=TEdit.Create(DsgnForm);
      with Food_col do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=218;
          Top:=71;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Food_col.MaxLength:=x;
    //Food_col.PasswordChar:=*;
      end;
    //fooduptext\\
     fooduptext:=TEdit.Create(DsgnForm);
      with fooduptext do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=220;
          Top:=99;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //fooduptext.MaxLength:=x;
    //fooduptext.PasswordChar:=*;
      end;
    //TListBox6\\
     TListBox6:=TListBox.Create(DsgnForm);
      with TListBox6 do
        begin
          Parent:=DsgnForm;
          Left:=508;
          Top:=201;
          Width:=0;
          Height:=10;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TListBox7\\
     TListBox7:=TListBox.Create(DsgnForm);
      with TListBox7 do
        begin
          Parent:=DsgnForm;
          Left:=329;
          Top:=429;
          Width:=100;
          Height:=80;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TComboBox8\\
     TComboBox8:=TComboBox.Create(DsgnForm);
      with TComboBox8 do
        begin
          Parent:=DsgnForm;
          Left:=72;
          Top:=136;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //Food\\
     Food:=TComboBox.Create(DsgnForm);
      with Food do
        begin
          Parent:=DsgnForm;
          Left:=187;
          Top:=39;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          Items.Add('Another item');                                                // This is how you add items to the combobox ;)
          //End items
          Text := Items[0];                                                         // Set the start value to the first string in Items
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
      Button := TButton.Create(DsgnForm);                                           // A button to click when the user is finished
      with Button do                                                                // with filling in the form
      begin
        Left := 180;
        Top := 260;
        Width := 120;
        Height := 30;
        CAPTION := 'Save';
        ONCLICK := @SaveFormInfo;
        Parent := DsgnForm;
      end;
      DsgnForm.SHOWMODAL;
      DsgnForm.Free;                                                                // Free the form, should always be used
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure TryStuff;
    begin
      SafeInitForm;
      writeln('Saved username: ' + FormUser);
      writeln('Saved Hue: ' + FormHue);
      writeln('Saved food: ' + FormFood);
    end;

    begin
      TryStuff;
    end.

    This saves some of the form's information, you'll probably figure out how it works by reading through the code.
    I've added some comments on important spots.

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Chris View Post
    Simba Code:
    program new;
    Const
    FONTS = 7;
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel2,TLabel5,TLabel9,TLabel10,TLabel11,TLabel12,TLabel13,TLabel14,TLabel15,TLabel16,TLabel25,TLabel26,TLabel28,TLabel30: TLabel;
      username,password,Color,Hue,Sat,Tol,Uptext_1,Uptext_2,Uptext_3,Food_col,fooduptext: TEdit;
      TImage17: TImage;
      TListBox6,TListBox7: TListBox;
      Button: TButton;
      TComboBox8,Food: TComboBox;
      bmps0: TMufasaBitmap;
      bmp0: TBitmap;
    const
      default = 'Comic Sans MS';



    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;

    var
      FormFood, FormUser, FormHue: string;

    // username,password,Color,Hue,Sat,Tol,Uptext_1,Uptext_2,Uptext_3,Food_col,fooduptext: TEdit;
    procedure SaveFormInfo(Sender: TObject);
    begin
      FormUser := username.TEXT
      FormHue := Hue.TEXT;
      FormFood := Food.TEXT;                                                          // Saving the text, before we close the form
      DsgnForm.CLOSE;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='DsgnForm';
          Position := poMainFormCenter;
          Left:=664;
          Top:=440;
          Width:=400;
          Height:=300;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='Login settings';
          Left:=43;
          Top:=13;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Username';
          Left:=14;
          Top:=40;
          Width:=49;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel2\\
     TLabel2:=TLabel.Create(DsgnForm);
      with TLabel2 do
        begin
          Parent:=DsgnForm;
          Caption:='Password';
          Left:=14;
          Top:=71;
          Width:=47;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel5\\
     TLabel5:=TLabel.Create(DsgnForm);
      with TLabel5 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster settings';
          Left:=133;
          Top:=120;
          Width:=81;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel9\\
     TLabel9:=TLabel.Create(DsgnForm);
      with TLabel9 do
        begin
          Parent:=DsgnForm;
          Caption:='Monster';
          Left:=19;
          Top:=140;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel10\\
     TLabel10:=TLabel.Create(DsgnForm);
      with TLabel10 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=18;
          Top:=174;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel11\\
     TLabel11:=TLabel.Create(DsgnForm);
      with TLabel11 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Hue';
          Left:=19;
          Top:=202;
          Width:=59;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel12\\
     TLabel12:=TLabel.Create(DsgnForm);
      with TLabel12 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Sat';
          Left:=19;
          Top:=229;
          Width:=56;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel13\\
     TLabel13:=TLabel.Create(DsgnForm);
      with TLabel13 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Tolerance';
          Left:=20;
          Top:=253;
          Width:=87;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel14\\
     TLabel14:=TLabel.Create(DsgnForm);
      with TLabel14 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_1';
          Left:=181;
          Top:=175;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel15\\
     TLabel15:=TLabel.Create(DsgnForm);
      with TLabel15 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_2';
          Left:=182;
          Top:=202;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel16\\
     TLabel16:=TLabel.Create(DsgnForm);
      with TLabel16 do
        begin
          Parent:=DsgnForm;
          Caption:='Uptext_3';
          Left:=183;
          Top:=232;
          Width:=46;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel25\\
     TLabel25:=TLabel.Create(DsgnForm);
      with TLabel25 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Settings';
          Left:=241;
          Top:=14;
          Width:=67;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel26\\
     TLabel26:=TLabel.Create(DsgnForm);
      with TLabel26 do
        begin
          Parent:=DsgnForm;
          Caption:='Food';
          Left:=159;
          Top:=42;
          Width:=25;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel28\\
     TLabel28:=TLabel.Create(DsgnForm);
      with TLabel28 do
        begin
          Parent:=DsgnForm;
          Caption:='Custom Color';
          Left:=153;
          Top:=75;
          Width:=65;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TLabel30\\
     TLabel30:=TLabel.Create(DsgnForm);
      with TLabel30 do
        begin
          Parent:=DsgnForm;
          Caption:='Food Uptext';
          Left:=154;
          Top:=101;
          Width:=61;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //username\\
     username:=TEdit.Create(DsgnForm);
      with username do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=38;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //username.MaxLength:=x;
    //username.PasswordChar:=*;
      end;
    //password\\
     password:=TEdit.Create(DsgnForm);
      with password do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=69;
          Top:=69;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //password.MaxLength:=x;
    //password.PasswordChar:=*;
      end;
    //Color\\
     Color:=TEdit.Create(DsgnForm);
      with Color do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=171;
          Width:=91;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Color.MaxLength:=x;
    //Color.PasswordChar:=*;
      end;
    //Hue\\
     Hue:=TEdit.Create(DsgnForm);
      with Hue do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=85;
          Top:=200;
          Width:=45;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Hue.MaxLength:=x;
    //Hue.PasswordChar:=*;
      end;
    //Sat\\
     Sat:=TEdit.Create(DsgnForm);
      with Sat do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=86;
          Top:=228;
          Width:=46;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Sat.MaxLength:=x;
    //Sat.PasswordChar:=*;
      end;
    //Tol\\
     Tol:=TEdit.Create(DsgnForm);
      with Tol do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=111;
          Top:=251;
          Width:=43;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Tol.MaxLength:=x;
    //Tol.PasswordChar:=*;
      end;
    //Uptext_1\\
     Uptext_1:=TEdit.Create(DsgnForm);
      with Uptext_1 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=232;
          Top:=175;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_1.MaxLength:=x;
    //Uptext_1.PasswordChar:=*;
      end;
    //Uptext_2\\
     Uptext_2:=TEdit.Create(DsgnForm);
      with Uptext_2 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=202;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_2.MaxLength:=x;
    //Uptext_2.PasswordChar:=*;
      end;
    //Uptext_3\\
     Uptext_3:=TEdit.Create(DsgnForm);
      with Uptext_3 do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=233;
          Top:=231;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Uptext_3.MaxLength:=x;
    //Uptext_3.PasswordChar:=*;
      end;
    //Food_col\\
     Food_col:=TEdit.Create(DsgnForm);
      with Food_col do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=218;
          Top:=71;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //Food_col.MaxLength:=x;
    //Food_col.PasswordChar:=*;
      end;
    //fooduptext\\
     fooduptext:=TEdit.Create(DsgnForm);
      with fooduptext do
        begin
          Parent:=DsgnForm;
          Text:='';
          Left:=220;
          Top:=99;
          Width:=80;
          Height:=21;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
    //fooduptext.MaxLength:=x;
    //fooduptext.PasswordChar:=*;
      end;
    //TListBox6\\
     TListBox6:=TListBox.Create(DsgnForm);
      with TListBox6 do
        begin
          Parent:=DsgnForm;
          Left:=508;
          Top:=201;
          Width:=0;
          Height:=10;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TListBox7\\
     TListBox7:=TListBox.Create(DsgnForm);
      with TListBox7 do
        begin
          Parent:=DsgnForm;
          Left:=329;
          Top:=429;
          Width:=100;
          Height:=80;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //TComboBox8\\
     TComboBox8:=TComboBox.Create(DsgnForm);
      with TComboBox8 do
        begin
          Parent:=DsgnForm;
          Left:=72;
          Top:=136;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          //End items
          OnClick:=@YourClickProcedure;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
    //Food\\
     Food:=TComboBox.Create(DsgnForm);
      with Food do
        begin
          Parent:=DsgnForm;
          Left:=187;
          Top:=39;
          Width:=100;
          Height:=21;
          //add your items here
          Items.Add('YourItem');
          Items.Add('Another item');                                                // This is how you add items to the combobox ;)
          //End items
          Text := Items[0];                                                         // Set the start value to the first string in Items
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=FONTS;
      end;
      Button := TButton.Create(DsgnForm);                                           // A button to click when the user is finished
      with Button do                                                                // with filling in the form
      begin
        Left := 180;
        Top := 260;
        Width := 120;
        Height := 30;
        CAPTION := 'Save';
        ONCLICK := @SaveFormInfo;
        Parent := DsgnForm;
      end;
      DsgnForm.SHOWMODAL;
      DsgnForm.Free;                                                                // Free the form, should always be used
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure TryStuff;
    begin
      SafeInitForm;
      writeln('Saved username: ' + FormUser);
      writeln('Saved Hue: ' + FormHue);
      writeln('Saved food: ' + FormFood);
    end;

    begin
      TryStuff;
    end.

    This saves some of the form's information, you'll probably figure out how it works by reading through the code.
    I've added some comments on important spots.
    Thanks! i'll look over it

  4. #4
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    Check out my script in the multiple skill section I use combo boxes in that scripts form and how to read the selected option im on phone now so ill update my post later if you can't find it yourself.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •