Record definations and assigning values. Don't understand lazarus / 61-Beginners ---------------------------------------------------------------------- JLWest · 2019-01-07 12:36 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type   LoadState =(LoadStart, LoadIdle, LoadStop);   LoadRecord = record               AP        : string;                 Match    : string;               LDState : LoadState;                end;               procedure TForm1.btnCutAirportClick(Sender: TObject); Var  LDRCD    : LoadState;   Begin   LDRCD.AP := 'KLAX'; //LDRCD.AP := Copy2Space(AIRPORT);   LDRCD.LDState := LoadIdle;            Error: unit1.pas(224,10) Error: identifier idents no member "AP" AP is defined as a string in the LoadRecord = Record type. ---------------------------------------------------------------------- Bart · 2019-01-07 12:43 LDRCD  must be of type LoadRecord  Not related, but it is good practice to start type-names with a T so Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type   TLoadState =(LoadStart, LoadIdle, LoadStop);   TLoadRecord = record               AP        : string;                 Match    : string;               LDState : LoadState;                end; Then you can have: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  LoadSate: TLoadSate;  LoadRecord: TLoadRecord Bart ---------------------------------------------------------------------- JLWest · 2019-01-07 12:56 ok but why can't I assign values? I can call them anything but if I can't assign values there are worthless. ---------------------------------------------------------------------- ccrause · 2019-01-07 13:10 Quote from: JLWest on January 07, 2019, 01:56:43 pmok but why can't I assign values? I can call them anything but if I can't assign values there are worthless. Bart already mentioned the problem with your code snippet: Quote from: Bart on January 07, 2019, 01:43:38 pmLDRCD  must be of type LoadRecord ---------------------------------------------------------------------- Bart · 2019-01-07 13:11 Quote from: JLWest on January 07, 2019, 01:56:43 pmok but why can't I assign values? I can call them anything but if I can't assign values there are worthless. Because you declared LDRCD to be of LoadState, where you meant it to be LoadRecord. This piece of code compiles without errors (as one would expect): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type   TLoadState =(LoadStart, LoadIdle, LoadStop);   TLoadRecord = record               AP        : string;                 Match    : string;               LDState : TLoadState;                end; procedure foo; Var  LoadRecord      : TLoadRecord; Begin   LoadRecord.AP := 'KLAX';   LoadRecord.LDState := LoadIdle;end; Bart ---------------------------------------------------------------------- vangli · 2019-01-07 13:11 Hi Guess your var definition should be:Quote LDRCD  : LoadRecord; ---------------------------------------------------------------------- JLWest · 2019-01-07 13:21 Bart I'm sorry. I should have known something was wrong when I would type LRRCD. and the box comes up and never presented AP, Match, LDState as choices. I guess that's why I post in beginner. Unfortunately at my age I'll always be  a beginner. It's fun trying to do this but can be frustrating at times.  Thank you. ---------------------------------------------------------------------- Bart · 2019-01-07 13:24 Quote from: JLWest on January 07, 2019, 02:21:15 pmI guess that's why I post in beginner. Unfortunately at my age I'll always be  a beginner. It's fun trying to do this but can be frustrating at times. So either you are young and do not age at all, or you age backwards? Bart ---------------------------------------------------------------------- jamie · 2019-01-07 22:09 I see you are getting into records now..  If you have any plans  to store these records to file, you need to use a non-managed type of string.  use short string type and set the length only what you need.  AP :String[4];  Match:String[6]; etc.  That allocates space within the record to hold these strings. ---------------------------------------------------------------------- JLWest · 2019-01-07 22:58 That's probably a good idea. I should go six on each. Most Airports Names are for but a few go to 8. I didn't know you could do that. Allocate space on string within a record, But there is a lot I don't know. Thanks. ---------------------------------------------------------------------- lucamar · 2019-01-08 00:02 Quote from: JLWest on January 07, 2019, 11:58:43 pmI didn't know you could do that. Allocate space on string within a record, But there is a lot I don't know. As shown by jamie, that's done with ShortString type, the good ol' TP String. It's basically an array of char where the first byte "MyShortString[0]" stores the length of the string and the rest (up to the declared length or 255 if declared with just ShortString--or String in $H- state) contains the characters. Ahh ... just in case you didn't know ---------------------------------------------------------------------- creaothceann · 2019-01-08 16:09 Quote from: JLWest on January 07, 2019, 11:58:43 pmI should go six on each. Most Airports Names are for but a few go to 8. Then use 8.