Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27

Thread: Buffer Edit Box

  1. #11
    Join Date
    Jul 2007
    Posts
    42
    Liz you are a genius

    I got it working using your method
    Code:
    astring := inttohex (buffer[$6E088],2) + inttohex (buffer[$6E089],2);
    That now correctly displays 0500 in edit1.text

    My knowledge of Delphi code syntax is not good and everything I've learned about Delphi is from this excellent forum. I'm a total noob so thanks for pointing me on the right path.

    The reason for reading in the entire thing is because there are more edit boxes to assign offsets to yet about 21 in total.

    Thanks again Liz your a star

  2. #12
    Join Date
    Jul 2007
    Posts
    42
    I'm struggling storing the data inside edit1.text back to the buffer offset addresses at $6E088 and $6E089.

    I tried
    Code:
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Buffer[$6E088] + Buffer[$6E089] := strtoint (aString); // error message
    end;
    But that won't compile (error message: [Pascal Error] giga.pas(87): E2064 Left side cannot be assigned to)
    Last edited by lda; 02-28-2008 at 11:49 AM.

  3. #13
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Well yes

    "AA" for example is not an integer...
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  4. #14
    Join Date
    Jul 2007
    Posts
    42
    It won't compile if I try...

    Buffer[$6E088] + Buffer[$6E089] := inttohex (aString); // error message

    [Pascal Error] giga.pas(163): E2250 There is no overloaded version of 'IntToHex' that can be called with these arguments

    Time to put me hat back on

  5. #15
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    You can only ever do

    one_variable:=newvalue;

    so you cant do
    buferr[cell1]+buffer[cell2]:=..

    "Astring" is unlikely to be an integer, so surely you need to change from hexto <something>
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  6. #16
    Join Date
    Jul 2007
    Posts
    42
    Do you mean use hextobin?

    I've attached the files I'm working on so you can see what it is I'm trying to achive. It's easier to see than explain sometimes

    In the Edit boxes you will see each edit box contains 2 hex numbers eg "05 00" in edit1.text Edit1box : string;

    This is read in with
    Edit1box := inttohex (buffer[$6E088],2) + inttohex (buffer[$6E089],2);
    Edit1.Text := (Edit1box);

    Now I need to store whats inside Edit1.text back into the Buffer and as there are two hex numbers in edit1.text I need to store them in Buffer[$6E088] and Buffer[$6E089] and I've no idea how to do this.

    I found an example on codepedia for doing the HexToInt conversion so this is added into the attached code but its not doing what I want as it's only updating the value in offset [$6e088]
    Attached Files Attached Files

  7. #17
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    ok the

    Buffer[$6E088] := hextoint (edit1.text);
    Buffer[$6E089] := hextoint (edit1.text);

    is why it screws up

    Id suggest you use 2 editboxes, 1 for 6e088, and 1 for 6e089

    that way you can work with the 2 different values easily.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  8. #18
    Join Date
    Jul 2007
    Posts
    42
    I'm trying to check a string matches whats stored in a certain part of the buffer. If it's equal it shows a message. How do I increment the buffer offset so it checks the values stored between $7fe0 and $7fef matche whats in the check string?

    This is what I've done but it's not working

    Code:
    check := '363A3534000000004665622032332032';
    for i := 0 to Length(check) do
    
    if (buffer[$7fe0]+i) = hextoint(check)+i then
    begin
    showmessage('It matches');
    end;
    begin;
    showmessage('It did not match');
    end;

  9. #19
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    (buffer[$7fe0]+i) takes the value in buffer and adds one, so does the inttohex line.. you need to add one to the value within the [] as thats the array location .
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  10. #20
    Join Date
    Jul 2007
    Posts
    42
    Thanks Liz

    I've tried the following but I get "[Pascal Error] giga.pas(553): E2016 Array type required" on the "If" statement below...

    Code:
    check := '363A3534000000004665622032332032';
    for i := 0 to Length(check) do
    
    if (buffer[$7fe0,[i]]) = inttohex(check[i]) then
    begin
    showmessage('Matched');
    end;
    end;

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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