Results 1 to 18 of 18

Thread: Why the hell am I getting an error here?

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

    Default Why the hell am I getting an error here?

    Simba Code:
    procedure SaveFormInfo(Sender: TObject);
    var
      City,Purpose:String;
    begin
      City := CityEnter.Text
      Purpose := PurposeEnter.TEXT;
      DsgnForm.CLOSE;
    end;

    Code:
    [Error] C:\Simba\Scripts\formforss.simba(23:21): Semicolon (';') expected at line 22
    Compiling failed.
    LINE 22:

    Simba Code:
    City := CityEnter.Text


    Before anyone says it... making it

    Simba Code:
    City := CityEnter.Text;

    Gives the same error

  2. #2
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Have u tried turning it off and on again?

    Creds to DannyRS for this wonderful sig!

  3. #3
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    CityEnter most likely isn't correct. What is CityEnter? It's expecting "City := CityEnter;" I believe.

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

    Default

    In Chris's example this works fine:

    Simba Code:
    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;

    I declared all of them as strings

  5. #5
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    purposeenter.Caption ?

  6. #6
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    In Chris's example this works fine:

    Simba Code:
    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;

    I declared all of them as strings
    That's not what I asked. What is CityEnter?

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

    Default

    Uhhh, looks like this:

    Simba Code:
    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;
      DsgnForm.SHOWMODAL;
      DsgnForm.Free;
    end;


    City enter is this:

    Simba Code:
    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;

  8. #8
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    So CityEnter is a TComboBox or how are you dealing with it? Can you just post the whole script?

  9. #9
    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:String;
    const
      default = 'Times New Roman';


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

    procedure SaveFormInfo(Sender: TObject);
    var
      City,Purpose:String;
    begin
      City := CityEnter.Text
      Purpose := PurposeEnter.TEXT;
      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;
          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;
      DsgnForm.SHOWMODAL;
      DsgnForm.Free;
    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.

  10. #10
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Like I said, CityEnter is the problem. CityEnter is a String, and Strings don't have a .Text field.

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

    Default

    Quote Originally Posted by i luffs yeww View Post
    Like I said, CityEnter is the problem. CityEnter is a String, and Strings don't have a .Text field.
    The awkward moment when I realize in Chris!'s example script he declared it as a TEdit. LOL

    Fixed, now I'm getting an error "something went wrong with simba" when I click start sec ill see if i can fix

  12. #12
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    The awkward moment when I realize in Chris!'s example script he declared it as a TEdit. LOL

    Fixed, now I'm getting an error "something went wrong with simba" when I click start sec ill see if i can fix
    If you take out the call to SafeShowFormModal it works fine.

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

    Default

    Ok I found the error:

    Code:
    Program exception! 
    Stacktrace:
    
    Exception class: EPSException
    Message: Could not call proc
      $00669BF5
      $0066931F
      $0054EE2F
      $0054F356
      $0054F8B1
      $0054ED3A
      $0040C37A
      $004EBC0D
      $00568BE7
      $0050E94E
      $005804CF
      $74C18817
      $74C1898E
      $74C1C306
      $74C1C367
      $744BB4BA
      $744BB51C
    Simba Version: 992
    Uhh.. I'm not sure what to do to fix it?

    If i close out of the form it sais:
    Code:
    Error: Exception: Access violation at line 166
    Line 166:
    ThreadSafeCall('ShowFormModal', v);


    I tried to remove it like above but I am not sure how without messing the whole thing up?

  14. #14
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    Ok I found the error:

    Code:
    Program exception! 
    Stacktrace:
    
    Exception class: EPSException
    Message: Could not call proc
      $00669BF5
      $0066931F
      $0054EE2F
      $0054F356
      $0054F8B1
      $0054ED3A
      $0040C37A
      $004EBC0D
      $00568BE7
      $0050E94E
      $005804CF
      $74C18817
      $74C1898E
      $74C1C306
      $74C1C367
      $744BB4BA
      $744BB51C
    Simba Version: 992
    Uhh.. I'm not sure what to do to fix it?
    Well I already posted one fix, but just so you know why it happened, you were calling DsgnForm.ShowModal in InitForm, and then freeing it after. And then in ShowFormModal you were trying to call it again after it was freed. I think that's why it caused an error.

    So you can either take out the call to ShowFormModal or you can move DsgnForm.ShowModal; DsgnForm.Free; to where it should be (in ShowFormModal). Either way will work, but the latter is more correct. Freeing the Form should actually be somewhere else even, I believe, but I don't know. I've never worked with forms.

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

    Default

    Quote Originally Posted by i luffs yeww View Post
    Well I already posted one fix, but just so you know why it happened, you were calling DsgnForm.ShowModal in InitForm, and then freeing it after. And then in ShowFormModal you were trying to call it again after it was freed. I think that's why it caused an error.

    So you can either take out the call to ShowFormModal or you can move DsgnForm.ShowModal; DsgnForm.Free; to where it should be (in ShowFormModal). Either way will work, but the latter is more correct. Freeing the Form should actually be somewhere else even, I believe, but I don't know. I've never worked with forms.
    I just took out

    Simba Code:
    // DsgnForm.SHOWMODAL;
      //DsgnForm.Free;

    Still got the same error

  16. #16
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    I just took out

    Simba Code:
    // DsgnForm.SHOWMODAL;
      //DsgnForm.Free;

    Still got the same error
    That's not what I said to do.. Here:

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


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

    procedure SaveFormInfo(Sender: TObject);
    var
      City,Purpose:String;
    begin
      City := CityEnter;
      Purpose := PurposeEnter;
      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;
          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.

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

    Default

    TY.

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

    Default

    One more thing: Can i do a case inside of a case like:

    Simba Code:
    Begin
      Case LowerCase(City) Of
        Case LowerCase(Number) Of
        'Varrock':
        Begin
          Begin
          '1':
          '2':
          '3':
          '4':
          End;
        End;
    End;

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
  •