Results 1 to 11 of 11

Thread: Ordinal Type required and Incompatable Types!

  1. #1
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default Ordinal Type required and Incompatable Types!

    Here's the procedure:
    SCAR Code:
    procedure TForm1.ComboBox3Change(Sender: TObject);
    begin
      case (Form1.ComboBox3.Text) of  //The ordinal error.
        'Black': Form1.RichEdit1.SelAttributes.Color:=clBlack;  //The Incompatable types error.
        'Grey': Form1.RichEdit1.SelAttributes.Color:=clGray;
        'White': Form1.RichEdit1.SelAttributes.Color:=clWhite;
        'Cyan': Form1.RichEdit1.SelAttributes.Color:=clSkyBlue;
        'Blue': Form1.RichEdit1.SelAttributes.Color:=clBlue;
        'Navy': Form1.RichEdit1.SelAttributes.Color:=clNavy;
        'Red':  Form1.RichEdit1.SelAttributes.Color:=clRed;
        'Maroon':  Form1.RichEdit1.SelAttributes.Color:=clMaroon;
        'Yellow':  Form1.RichEdit1.SelAttributes.Color:=clYellow;
        'Lime':  Form1.RichEdit1.SelAttributes.Color:=clLime;
        'Green':  Form1.RichEdit1.SelAttributes.Color:=clGreen;
        'Teal':  Form1.RichEdit1.SelAttributes.Color:=clTeal;
        'Dark Green':  Form1.RichEdit1.SelAttributes.Color:=clMoneyGreen;
        'Purple':  Form1.RichEdit1.SelAttributes.Color:=clPurple;
      end;
    end;

    And here are the errors i am receiving:
    Code:
    [Error] Unit1.pas(237): Ordinal type required
    [Error] Unit1.pas(238): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(239): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(240): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(241): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(242): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(243): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(244): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(245): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(246): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(247): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(248): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(249): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(250): Incompatible types: 'Integer' and 'String'
    [Error] Unit1.pas(251): Incompatible types: 'Integer' and 'String'
    Please help, as i have no idea how i could receive those errors. I have googled it, and failed. It works in SCAR so there must be a difference. Please help, thanks

    Rep++ if you do help
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  2. #2
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    I think the color may be a string, have you checked the Codehints?



    Also: The only two reasons this would occur: Form1.ComboBox3.Text is an integer (it may be in the if its infact a pointer), or Form1.RichEdit1.SelAttributes.Color is a string.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    In Delphi, cases don't accept strings (or, in this case, TCaptions).

  4. #4
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    If..then..else ... then.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  5. #5
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Nevermind, i got it figured out and i managed to fix a bug
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  6. #6
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    Nevermind, i got it figured out and i managed to fix a bug
    [offtopic]
    Well Dan, if I look to your sig, you seem to fail a lot
    [/offtopic]
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  7. #7
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)
    Quote Originally Posted by the scar noob View Post
    [offtopic]
    Well Dan, if I look to your sig, you seem to fail a lot
    [/offtopic]
    Lol, i changed that a while ago I just liked those pictures
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  8. #8
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    or you could use a TColorDialog and make it shorter as well as having more colors .
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  9. #9
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Dan Cardin View Post
    or you could use a TColorDialog and make it shorter as well as having more colors .
    I used a TColorGrid You can see my work in the Misc. Links and Programs forums, DanWord
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  10. #10
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Delphi's case statements do not accept strings, also this is a terribad way to go about this

  11. #11
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Freddy1990 View Post
    Delphi's case statements do not accept strings, also this is a terribad way to go about this
    I don't care anymore, i had changed my method anyway
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Required SMART and Option to Pay for Membership
    By iJake in forum SRL Site Discussion
    Replies: 2
    Last Post: 06-01-2008, 11:31 PM
  2. Help Required / Sugguestion
    By pomme in forum OSR Help
    Replies: 6
    Last Post: 10-24-2007, 03:52 PM
  3. Anti-ban help required.
    By yorkshireknight in forum OSR Help
    Replies: 8
    Last Post: 02-16-2007, 04:40 PM

Posting Permissions

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