Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: Type mismatch

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

    Default Type mismatch

    I have no idea why I'm getting this:

    Code:
    [Error] C:\Simba\Scripts\test.simba(15:5): Type mismatch at line 14
    Compiling failed.
    Line 14:

    Simba Code:
    'Varrock':

    Whole script:

    Simba Code:
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel3: TLabel;
      TButton5: TButton;
      TComboBox2,TComboBox4: TComboBox;
      CityEnter,PurposeEnter:String;
      City,Purpose:TEdit;
    const
      default = 'Times New Roman';

    procedure i;
    begin
      Case LowerCase(City) Of
        'Varrock':
          Begin
            Case LowerCase(Purpose) Of
              '1':
              Writeln('Varrock.1');
              '2':
              Writeln('Varrock.2');
              '3':
              Writeln('3');
              '4':
              Writeln('4');
            End;
          End;
        'Fally':
        Begin
          Case LowerCase(Purpose) Of
              '1':
              Writeln('Fally.1');
              '2':
              Writeln('Fally.2');
              '3':
              Writeln('Fally.3');
              '4':
              Writeln('Fally.4');
            End;
        End;
        'Edgeville':
        Begin
          Case LowerCase(Purpose) Of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
            End;
        End;
        'Wilderness':
        Begin
          Case LowerCase(Purpose) Of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
            End;
        End;
        'Lumberidge':
        Begin
          Case LowerCase(Purpose) Of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
          End;
        End;
      End;
    End;
    procedure SaveFormInfo(Sender: TObject);
    begin
      City := CityEnter.TEXT;
      Purpose := PurposeEnter.TEXT;
      i;
      //DsgnForm.CLOSE;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='form';
          Left:=351;
          Top:=393;
          Width:=320;
          Height:=240;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='hi';
          Left:=83;
          Top:=15;
          Width:=114;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Location';
          Left:=20;
          Top:=47;
          Width:=41;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel3\\
     TLabel3:=TLabel.Create(DsgnForm);
      with TLabel3 do
        begin
          Parent:=DsgnForm;
          Caption:='Purpose';
          Left:=20;
          Top:=85;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TButton5\\
     TButton5:=TButton.Create(DsgnForm);
      with TButton5 do
        begin
          Parent:=DsgnForm;
          Caption:='start!';
          Left:=62;
          Top:=198;
          Width:=174;
          Height:=29;
          ONCLICK := @SaveFormInfo;
         // ONCLICK := @TryStuff;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox2\\
     TComboBox2:=TComboBox.Create(DsgnForm);
      with TComboBox2 do
        begin
          Parent:=DsgnForm;
          Left:=76;
          Top:=45;
          Width:=118;
          Height:=21;
          //add your items here
          Items.Add('Varrock');
          Items.Add('Fally');
          Items.Add('Edgeville');
          Items.Add('Wilderness');
          Items.Add('Draynor');
          Items.Add('Lumberidge');
          //End items

          Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox4\\
     TComboBox4:=TComboBox.Create(DsgnForm);
      with TComboBox4 do
        begin
          Parent:=DsgnForm;
          Left:=75;
          Top:=83;
          Width:=120;
          Height:=21;
          //add your items here
          Items.Add('1');
          Items.Add('2');
          Items.Add('3');
          Items.Add('4');
          //End items

          Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      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;
      DsgnForm.Free;
    end.

  2. #2
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Simba Code:
    City,Purpose:TEdit;
    The variable 'city' is a TEdit record.
    Simba Code:
    'Varrock'
    Is a string?

    Not really to sure what a TEdit record is though, because I've never messed with forms. I'll have a look..

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    A TEdit type cannot have string type case statements.

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

    Default

    Ok so i switched it to:

    Simba Code:
    CityEnter,PurposeEnter:TEdit;
      City,Purpose:String;

    and i got the"something went wrong with simba" error.

    And if A TEdit type cannot have string type case statements then how am i supposed to do this? lol, unless i am supposed to do like 60 if then statements

  5. #5
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    I'm probably not the best person to ask since I know little to nothing about forms, but what exactly are you trying to make a form for? And what tutorial are you following? I suggest this one http://villavu.com/forum/showthread....41418&p=520204

    Sorry, I don't think I can really help any further

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

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

    Default

    I don't see anything in it about cases inside of cases or cases like mine

  7. #7
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    I find it hard to believe that you didn't see anything relating to your TEdit problem (via the suggested helper link from -daazndagger-).

    Look under the section, TEdit;

    There happens to be an example that shows, TEdit1.Text, hmmmmmmmm

    -Lj

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

    Default

    Quote Originally Posted by Le Jingle View Post
    I find it hard to believe that you didn't see anything relating to your TEdit problem (via the suggested helper link from -daazndagger-).

    Look under the section, TEdit;

    There happens to be an example that shows, TEdit1.Text, hmmmmmmmm

    -Lj
    Actually the part in the tutorial that shows TEdit1.text is not using the combo box like in my code, and i read the part of the tut that deals with combo box and it still doe snot fix my problem by doing this:

    Simba Code:
    City:TComboBox;
      Purpose:TComboBox;
    and
    Simba Code:
    City.Items.Add('Varrock');
          City.Items.Add('Fally');
          City.Items.Add('Edgeville');
          City.Items.Add('Wilderness');
          City.Items.Add('Draynor');
          City.Items.Add('Lumberidge');

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

    Default

    bump

  10. #10
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Why not just use Cynicrus's form designer?...

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

    Default

    like i said in another thread you made afew days ago you would of found everything you needed from a script i stopped making in the multiple script section

    this is how you check which option is selected.

    Simba Code:
    case City.ItemIndex of
        1://Fally

        2://Edgeville

        3://Wilderness

        4://ect..
      end;
    Last edited by Mark; 02-18-2013 at 10:17 PM.

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

    Default

    Quote Originally Posted by CRU1Z1N View Post
    like i said in another thread you made afew days ago you would of found everything you needed from a script i stopped making in the multiple script section

    this is how you check which option is selected.

    Simba Code:
    case City.ItemIndex of
        1://Fally

        2://Edgeville

        3://Wilderness

        4://ect..
      end;
    OK thanks but now I am getting this error:


    Code:
    [Error] C:\Simba\Scripts/test.simba(86:21): Semicolon (';') expected at line 85
    Compiling failed.

    Line 85:

    Code:
    City := CityEnter.TEXT;

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

    Default

    Quote Originally Posted by rjj95 View Post
    OK thanks but now I am getting this error:


    Code:
    [Error] C:\Simba\Scripts/test.simba(86:21): Semicolon (';') expected at line 85
    Compiling failed.

    Line 85:

    Code:
    City := CityEnter.TEXT;
    you need to post your full code so i can see what your doing wrong i cant see any alteration you have made.

    edit: also make sure your city variable is to a string
    Last edited by Mark; 02-18-2013 at 11:05 PM.

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

    Default

    Simba Code:
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel3: TLabel;
      TButton5: TButton;
      TComboBox2,TComboBox4: TComboBox;
      CityEnter,PurposeEnter:String;
      City,Purpose:TEdit;
      //CityEnter,PurposeEnter:TEdit;
     // City,Purpose:String;
    const
      default = 'Times New Roman';

    procedure i;
    begin
      case City.Text of
        'Varrock':
          Begin
            case Purpose.Text of
              '1':
              Writeln('Varrock.1');
              '2':
              Writeln('Varrock.2');
              '3':
              Writeln('3');
              '4':
              Writeln('4');
            End;
          End;
        'Fally':
        Begin
          case Purpose.Text of
              '1':
              Writeln('Fally.1');
              '2':
              Writeln('Fally.2');
              '3':
              Writeln('Fally.3');
              '4':
              Writeln('Fally.4');
            End;
        End;
        'Edgeville':
        Begin
          case Purpose.Text of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
            End;
        End;
        'Wilderness':
        Begin
          case Purpose.Text of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
            End;
        End;
        'Lumberidge':
        Begin
          case Purpose.Text of
              '1':
              Writeln('Edgeville.1');
              '2':
              Writeln('Edgeville.2');
              '3':
              Writeln('Edgeville.3');
              '4':
              Writeln('Edgeville.4');
          End;
        End;
      End;
    End;
    procedure SaveFormInfo(Sender: TObject);
    begin
      City := CityEnter.TEXT;
      Purpose := PurposeEnter.TEXT;
      i;
      //DsgnForm.CLOSE;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='form';
          Left:=351;
          Top:=393;
          Width:=320;
          Height:=240;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='hi';
          Left:=83;
          Top:=15;
          Width:=114;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Location';
          Left:=20;
          Top:=47;
          Width:=41;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel3\\
     TLabel3:=TLabel.Create(DsgnForm);
      with TLabel3 do
        begin
          Parent:=DsgnForm;
          Caption:='Purpose';
          Left:=20;
          Top:=85;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TButton5\\
     TButton5:=TButton.Create(DsgnForm);
      with TButton5 do
        begin
          Parent:=DsgnForm;
          Caption:='start!';
          Left:=62;
          Top:=198;
          Width:=174;
          Height:=29;
          ONCLICK := @SaveFormInfo;
         // ONCLICK := @TryStuff;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox2\\
     TComboBox2:=TComboBox.Create(DsgnForm);
      with TComboBox2 do
        begin
          Parent:=DsgnForm;
          Left:=76;
          Top:=45;
          Width:=118;
          Height:=21;
          //add your items here
          TComboBox2.Items.Add('Varrock');
          TComboBox2.Items.Add('Fally');
          TComboBox2.Items.Add('Edgeville');
          TComboBox2.Items.Add('Wilderness');
          TComboBox2.Items.Add('Draynor');
          TComboBox2.Items.Add('Lumberidge');
          //End items

          TComboBox2.Text := 'City';
          //Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox4\\
     TComboBox4:=TComboBox.Create(DsgnForm);
      with TComboBox4 do
        begin
          Parent:=DsgnForm;
          Left:=75;
          Top:=83;
          Width:=120;
          Height:=21;
          //add your items here
          Items.Add('1');
          Items.Add('2');
          Items.Add('3');
          Items.Add('4');
          //End items

          Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      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;
      DsgnForm.Free;
    end.

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

    Default

    you had them wrong way

    CityEnter := City.TEXT;

    also the line below

    PurposeEnter := Purpose.TEXT;

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

    Default

    Quote Originally Posted by CRU1Z1N View Post
    you had them wrong way

    CityEnter := City.TEXT;

    also the line below

    PurposeEnter := Purpose.TEXT;
    Now i get the error message "something went wrong with simba press ok or cancel"

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

    Default

    your not using the combo box in your script so atm your script does nothing with the data you entered.
    Last edited by Mark; 02-18-2013 at 11:43 PM.

  18. #18
    Join Date
    Jan 2011
    Location
    Denver, CO
    Posts
    1,351
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    Instead of using the nested case statement, can't you just do:

    Simba Code:
    WriteLn(City.Text + '.' + Purpose.Text);
    Last edited by Echo_; 02-18-2013 at 11:49 PM.

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

    Default

    Quote Originally Posted by CRU1Z1N View Post
    your not using the combo box in your script so atm your script does nothing with the data you entered.
    What do you mean im not using the combo box, it's popping up?

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

    Default

    look at your code its not using any of the options selected from the combo box like i said earlier

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

    Default

    Simba Code:
    TComboBox4.Items.Add('1');
          TComboBox4.Items.Add('2');
          TComboBox4.Items.Add('3');
          TComboBox4.Items.Add('4');
    there I added that and it still gives the error, I don't get how it's "not using them"

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

    Default

    to make it easy as im tired and cant explain properly atm so here it is compare this to yours see where you went wrong line by line

    Simba Code:
    program new;
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel3: TLabel;
      TButton5: TButton;
      CityCombo,PurposeCombo: TComboBox;

      City,Purpose:TEdit;

    const
      default = 'Times New Roman';

    procedure i;
    begin
      case CityCombo.ITEMINDEX of
        0:
          Begin
            case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Varrock.1');
              1:
              Writeln('Varrock.2');
              2:
              Writeln('3');
              3:
              Writeln('4');
            End;
          End;
        1:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Fally.1');
              1:
              Writeln('Fally.2');
              2:
              Writeln('Fally.3');
              3:
              Writeln('Fally.4');
            End;
        End;
        2:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:Writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
            End;
        End;
        3:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
            End;
        End;
        4:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
          End;
        End;
      End;
    End;


    procedure SaveFormInfo(Sender: TObject);
    begin
      DsgnForm.ModalResult := mrOk;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='form';
          Left:=351;
          Top:=393;
          Width:=320;
          Height:=240;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='hi';
          Left:=83;
          Top:=15;
          Width:=114;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Location';
          Left:=20;
          Top:=47;
          Width:=41;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel3\\
     TLabel3:=TLabel.Create(DsgnForm);
      with TLabel3 do
        begin
          Parent:=DsgnForm;
          Caption:='Purpose';
          Left:=20;
          Top:=85;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TButton5\\
     TButton5:=TButton.Create(DsgnForm);
      with TButton5 do
        begin
          Parent:=DsgnForm;
          Caption:='start!';
          Left:=62;
          Top:=198;
          Width:=174;
          Height:=29;
          ONCLICK := @SaveFormInfo;
         // ONCLICK := @TryStuff;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox2\\
     CityCombo:=TComboBox.Create(DsgnForm);
      with CityCombo do
        begin
          Parent:=DsgnForm;
          Left:=76;
          Top:=45;
          Width:=118;
          Height:=21;
          //add your items here
          Items.Add('Varrock');
          Items.Add('Fally');
          Items.Add('Edgeville');
          Items.Add('Wilderness');
          Items.Add('Draynor');
          Items.Add('Lumberidge');
          //End items

          Text := 'City';
          //Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox4\\
     PurposeCombo:=TComboBox.Create(DsgnForm);
      with PurposeCombo do
        begin
          Parent:=DsgnForm;
          Left:=75;
          Top:=83;
          Width:=120;
          Height:=21;
          //add your items here
          Items.Add('1');
          Items.Add('2');
          Items.Add('3');
          Items.Add('4');
          //End items

          Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      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;
       i;
      DsgnForm.Free;

    end.

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

    Default

    Quote Originally Posted by CRU1Z1N View Post
    to make it easy as im tired and cant explain properly atm so here it is compare this to yours see where you went wrong line by line

    Simba Code:
    program new;
    var
      DsgnForm:TForm;
      TLabel0,TLabel1,TLabel3: TLabel;
      TButton5: TButton;
      CityCombo,PurposeCombo: TComboBox;

      City,Purpose:TEdit;

    const
      default = 'Times New Roman';

    procedure i;
    begin
      case CityCombo.ITEMINDEX of
        0:
          Begin
            case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Varrock.1');
              1:
              Writeln('Varrock.2');
              2:
              Writeln('3');
              3:
              Writeln('4');
            End;
          End;
        1:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Fally.1');
              1:
              Writeln('Fally.2');
              2:
              Writeln('Fally.3');
              3:
              Writeln('Fally.4');
            End;
        End;
        2:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:Writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
            End;
        End;
        3:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
            End;
        End;
        4:
        Begin
          case PurposeCombo.ITEMINDEX of
              0:
              Writeln('Edgeville.1');
              1:
              Writeln('Edgeville.2');
              2:
              Writeln('Edgeville.3');
              3:
              Writeln('Edgeville.4');
          End;
        End;
      End;
    End;


    procedure SaveFormInfo(Sender: TObject);
    begin
      DsgnForm.ModalResult := mrOk;
    end;


    procedure InitForm;
    begin
    //DsgnForm\\
     DsgnForm:=TForm.Create(nil);
      with DsgnForm do
        begin
          Caption:='form';
          Left:=351;
          Top:=393;
          Width:=320;
          Height:=240;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel0\\
     TLabel0:=TLabel.Create(DsgnForm);
      with TLabel0 do
        begin
          Parent:=DsgnForm;
          Caption:='hi';
          Left:=83;
          Top:=15;
          Width:=114;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel1\\
     TLabel1:=TLabel.Create(DsgnForm);
      with TLabel1 do
        begin
          Parent:=DsgnForm;
          Caption:='Location';
          Left:=20;
          Top:=47;
          Width:=41;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TLabel3\\
     TLabel3:=TLabel.Create(DsgnForm);
      with TLabel3 do
        begin
          Parent:=DsgnForm;
          Caption:='Purpose';
          Left:=20;
          Top:=85;
          Width:=40;
          Height:=14;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TButton5\\
     TButton5:=TButton.Create(DsgnForm);
      with TButton5 do
        begin
          Parent:=DsgnForm;
          Caption:='start!';
          Left:=62;
          Top:=198;
          Width:=174;
          Height:=29;
          ONCLICK := @SaveFormInfo;
         // ONCLICK := @TryStuff;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox2\\
     CityCombo:=TComboBox.Create(DsgnForm);
      with CityCombo do
        begin
          Parent:=DsgnForm;
          Left:=76;
          Top:=45;
          Width:=118;
          Height:=21;
          //add your items here
          Items.Add('Varrock');
          Items.Add('Fally');
          Items.Add('Edgeville');
          Items.Add('Wilderness');
          Items.Add('Draynor');
          Items.Add('Lumberidge');
          //End items

          Text := 'City';
          //Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    //TComboBox4\\
     PurposeCombo:=TComboBox.Create(DsgnForm);
      with PurposeCombo do
        begin
          Parent:=DsgnForm;
          Left:=75;
          Top:=83;
          Width:=120;
          Height:=21;
          //add your items here
          Items.Add('1');
          Items.Add('2');
          Items.Add('3');
          Items.Add('4');
          //End items

          Text := Items[0];
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      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;
       i;
      DsgnForm.Free;

    end.
    Worked fine but... I couldn't copy yours over to my original one.. couldn't figure out the problem

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

    Default

    you never actually used the combos boxes liek i told you you where using those useless TEdit's you created which actually had no values and you where assigning them to a string with no value

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

    Default

    Who the hell just De-repped for 'bumping under 24 hours'

    Backseat modding pl0x.

Page 1 of 2 12 LastLast

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
  •