Jump to content

JohnLM

Members
  • Content Count

    218
  • Joined

  • Last visited

Posts posted by JohnLM


  1. Right now, I am focusing on getting the highlighting to work properly.   

     

    I am able to do the following: 

     

    1. obtain the column number.

    2. highlight the column in question (all cells including the header) (but that only works if I click the stringgrid cells, not the header--I want the header to be the initiator)

     

    But the above {2} is buggy.  At program startup, the stringgrid highlights for column 0 (the fixed header section). 

     

    The other issue-1 I am having is that I can only get the highlighting to work if I use the left mouse button.  The stringgrid seems to ignore the Right-button click.  No action is taken. 

    And, issue-2 is that I cannot initiate the highlight when I click on the top fixed row header area.  I need to be able to click that part only, not the cells. 

     

      if button = TMouseButton.mbLeft then // success, but:  if button = TMouseButton.mbRight then  // fails 

    I guess will have to first use .mbLeft, and then do .mbRight for the popup part.  I will have to work that out if that is the route I will take. 

     

    Here is the complete code that I managed to get working, though a bit buggy.  I have to work out the pre-highlight it does on the fixed row header part at startup.  There should be no highlighting at startup, not unless I click on the top fixed row header column. 

    implementation 
    
    var
      r,c: integer;
      MRect: TRect;
    
    ... 
    
    procedure TForm1.sg1SelectCell(Sender: TObject; ACol, ARow: Integer;   // sg1=stringgrid
      var CanSelect: Boolean);
    begin
      r:=arow;
      c:=acol;
    end;
    
    procedure TForm1.sg1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    var
      Button: TMouseButton;
    begin
      if button = TMouseButton.mbLeft then  // but .mbRight fails
      if (acol=c) then begin
        sg1.Canvas.Brush.Color:=clblue;
        sg1.Canvas.FillRect(rect);
      end;
    end;
    
    procedure TForm1.sg1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin 
      if button = tmousebutton.mbLeft then begin
        sg1.Invalidate;
        mrect := sg1.CellRect(c,r);
        sg1drawcell(self,c,r,mrect,[]);   // TGridDrawState = set of (gdSelected, gdFocused, gdFixed, gdRowSelected, gdHotTrack, gdPressed);
        sg1.Canvas.Brush.Color:=clblue;
        sg1.Canvas.FillRect(mrect);
      end;
      sg1.Invalidate;
    end;

     

     


  2. @Achim - your technique works for the stringgrid as well, thanks. 

     

    However, before I found your code above, I also found this method to obtain the col/row values with this code: 

     

    var i: integer; 
    ...
    procedure TForm1.sg1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      i:=acol;
      edit1.Text:=inttostr(i);
    end;

     

    But my problem is trying to simulate the same as visually depicted in my original photo posted earlier.. if I right-click column 2, it would show like in the photo) and then I would call the popup menu, also shown in the photo. 


  3. Using a string grid, (but I may also use a dbgrid later) how do I get the *column* number when I right-click on a column ?

    I've searched around but could not find the answers. 

     

    Below, shows column 2 was right-click-selected. 

     

    The purpose of this is to allow me to right-click on a column and a pop-up menu with options for (copy_column, create_table) will show. 

    1. I want to copy the text of the column to the clipboard.  

    2. or, create a table out of the selected column's text. (I know how to do these parts.) 

     

    TIA

     

    108492797_im-stringgridcolumnnumberselectionindicator.png.4a37e51d28c45f4a0b6332c4a743b744.png


  4. @ jonnyg - you are correct. I got side-tracked. The days of doing a fresh install on that win7 laptop are long gone now. I have too many large apps installed and other complicated issues that prevent me from doing that and is also the reason I have another laptop or two. They are all win10. I will eventually replace this laptop with one of those. I'm just not ready nor in any rush to make that happen as yet. 


  5. @ jonnyg - I have a Windows 10 laptop 64GB (eMMC) and 4GB of ram, and with Delphi 11.2 installed and running fine. I had stopped using it because it ran down my remaining hdd (eMMC) space down to about 400mb, but recently I learned that I regained some of it back and now have 2.5GB space left, more than enough to continue my small casual Delphi hobbies.  I use my win7 laptop as my main workstation.  It has XE7 and D11.2 on it. I sometimes run both side-by-side when necessary.  I have no problems with D11.2, except for that recent rare occasion I just mentioned in my previous post. 


  6. Specs: Delphi 11.2, Win7

     

    My experience thus far with D11.2 under Win7. . . 

     

    I have worked in Delphi for many years.  I can't remember ever having the IDE crash (or freeze) on me, ever until I started working with Classes and Generics.  Granted, I am new to that area.  But we all have to start somewhere, and crashes/freezes will happen when using advanced areas of coding.  Now that I am in the classes and generics area of programming I am finding that the IDE will crash or freeze often, though mostly in access violation territory while closing the app as I learn, etc.  For example, yesterday while testing some code, the IDE froze and was unresponsive.  And I could not close down the faulty app in Task Manager.  After 10 minutes of frustration, I learned that the DSP had crashed (it was showing 25% usage on my win7 laptop in Task Manager--the 25% CPU value is the default value for when an app or something for that matter has crashed or become unresponsive)  I could not do anything in Delphi and/or the App in question until I killed the process for the DSP.  Then, I had to shut down Delphi and reload that project.  in my unique case, I discovered that Delphi 11.2 no longer works properly with the Class/Generic app I was working with. It constantly crashes with access violations.  In order to resolve this, I have to shut down my laptop completely.  It would not be such a problem if my laptop did not take 40 minutes to boot up--a situation that I have not been able to figure out how to resolve.--it used to boot up in under a minute when brand new. I don't know where nor when exactly this long boot-up started.  Anyway.  So crashes like this I can't afford to have with a 40-minute bootup every time I encounter this sort of major Delphi crash.  But this type of crash is difficult to document exactly how it happens in Delphi. 


  7. Specs:  Win7,  Delphi 11.2,  VCL 

     

    I wrote some functions to convert string to byte and byte to string.  These functions work. For testing, I added several tbuttons and a memo on the form and began testing my ideas shown below.

     

    function str2byte(str: string): TBytes;
    begin
      setlength(str,length(str));
      result := TEncoding.utf8.getbytes(str);
    end;
    
    function byte2str(byt: TBytes): string;
    begin
      result := TEncoding.ascii.getstring(byt);
    end;

    usage: 

    procedure TForm1.Button1Click(Sender: TObject);
    var strs: string; bytes: TBytes;
    begin
      bytes := str2byte('ABC');         // string
      strs  := byte2str(bytes);         // bytes
      memo1.Lines.Add(byte2str(bytes)); // show it
    
      strs  := byte2str([68,69,70]);    // bytes
      bytes := str2byte(strs);          // string
      memo1.Lines.Add(byte2str(bytes)); // show it
    end;

     

    Now, I'd like to extend that to include an additional parameter to the encoding format (ansi, ascii, utf-16-big-endian unicode, utf-16 unicode, utf-7 and utf-8) as found here: 

    https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.SysUtils.TEncoding

     

    (And then later, possibly extend upon it by building a class component of it (and other library functions/procedures that I build)). 
     

    The issue I am having now is how to give the parameters their name.  I do not know if there are already built-in types for these and don't want to cause issues later on.  But so far, I thought about using these: (_ansi, _ascii, _utf7, _utf8, _utf16be and _utf16u).  Or, maybe create an enumerated list, i.e., 

    type TMyEncoding = (_ansi, _ascii, _utf7, _utf8, _utf16be, _utf16u);

     

    And rewriting the above output snippet: 

    type TMyEncoding = (_ansi, _ascii, _utf7, _utf8, _utf16be, _utf16u);
    
    function _byte2str(byt: TBytes; enc: TMyEncoding): string;
    begin
      case integer(enc) of
        0: result := TEncoding.ascii.getstring(byt);
        1: result := TEncoding.ansi.getstring(byt);
        2: result := TEncoding.utf7.getstring(byt);
        3: result := TEncoding.utf8.getstring(byt);
        // ...
      end;
    end;
    
    procedure TForm1.Button4Click(Sender: TObject);
    var
      strs: string; bytes: TBytes;
    begin
      bytes := str2byte('_ansi');              // string
      strs  := _byte2str(bytes,_ansi);         // bytes
      memo1.Lines.Add(_byte2str(bytes,_ansi)); // show it
    
    //  strs  := byte2str([68,69,70]);    // bytes
    //  bytes := str2byte(strs);          // string
    //  memo1.Lines.Add(byte2str(bytes)); // show it
    end;

    So I am looking for some advice/suggestions on how to implement the names for each of the encodings that will not interfer with Delphi's built-in names.  TIA. 
     


  8. 22 hours ago, Uwe Raabe said:

    First of all, keeping the default names for the buttons has never been best practice.

     

    While suggesting to have descriptive names for the buttons, this nevertheless is another way to iterate over any group of buttons:

    
      for var btn in [Button1, Button2, Button3, Button4, Button5] do
        btn.Enabled := True;

    And, no, you can't write [Button1..Button5] here.

     

    I learned something new.  This works as described..,, minimal code and easy to follow.  I added an addition in case I were to want a toggle type set of on/off controls for certain situations, but slightly more code: 

     

    for var btn in [Button1, Button2, Button3, Button4, button5] do
        if btn.Enabled = true then btn.Enabled:=false else btn.Enabled:=true;

     


  9. I don't know if the OP (or anyone else) are aware of this website for checking files/URL's for nasties, but I use it a lot.  It uses many vendors.  It might be useful for others here. 

     

    http://www.virustotal.com/

     

    So, I just uploaded a test file I compiled in Delphi 11.2 to this site to see the results I would get. 

    It reported 2/62 or 2 out of 62 scans and reported the results, below. 

     

    image.thumb.png.cdb45c6c2231718b8b63797dd5faffb2.png


  10. In Delphi 11.2, you can change the ComboBox dropdown width using:  .DropDownWidth := width, but it is also in the Object Inspector window. 

     

    And, .AutoDropDownWidth is a boolean, and also in the Object Inspector window.  If true, then the width of the cbx will be whatever is the largest text inside the dropdown. 

    When set to false (which is its default), the standard default width is used. 

    • Thanks 1

  11. I prefer my nested if/then/else code in this block format as this gives me the least ripples=visual noise, and I have done the same with for/loops, since the days of old (Delphi 6 and earlier).

     

    procedure
    begin
      if condition then begin
        ...
        ... 
      end else begin
        ...
        ... 
      end;
    end;
    
    procedure
    begin
      if condition then begin
        ...
        ... 
      end else if condition then begin
        ...
        ... 
      end;
    end;
    
    procedure
    var r,c: integer; 
    begin
      for r:=1 to 10 do begin
        ... 
        ... 
        for c:=1 to 100 do begin
        ... 
        ... 
        end;
        ...
        ...
      end;
    end;

     


  12. Hi.  I had found something that works (but does not account for the cursor at this time) but had not the time to post back how I did it.  But I will read/consider your method as a possible option, thank you. 

     

    The method that I have been testing is below. 

     

    I have a [Load] button that loads streams that I save using the sfBinary format of TStream/TMemoryStream. 

    var
      form1: TForm1;
      topline: integer=0; 
    
    ... 
    
    procedure TForm1.btnLoadClick(Sender: TObject);
    begin
      if mem1.Active then begin
        mem1.LoadFromFile(txtFilename.text,sfjson);
        // store the top line of memo into global var on load
        TopLine := memo1.Perform(EM_GETFIRSTVISIBLELINE, 0, 0); 
      end;
    
      btnbufArray.Click; // process array into hex and ascii code and show in memo1
    
      // now, if at any time I was in the memo and scrolling up/down and TopLine > 0 then I update the memo's viewing position. 
      if TopLine > 0 then begin
        SendMessage(memo1.Handle, EM_LINESCROLL, 0, TopLine);
      end;

     

     

     


  13. I have been searching via google but not turned up any answer to this. 

     

    1. Say I have multiple files of similar text and I save them.

    2. Then, when I load (or open) any of those text files in TMemo, I want to maintain the last screen layout (line) within the dimensions.

     

    I am comparing structures of column (hex/ascii) data in these text files and if I am in the middle of the file in the tmemo and I decide to load another file to quickly compare back/forth with, I want the layout the remain the same but not start from the top of the text file. 

     

    I know I have to save the last topmost line in a variable but I don't know how to go further in this. TIA. 

     

    im_tmemo_layout_a.thumb.png.0e9cf69f1d389d945389bbbd5861f47e.png

    Fig A - this is the layout that opens by default for every load. But I want Fib B if I am scrolling down and stop and decide to load another file. 

     

     

    im_tmemo_layout_b.thumb.png.0492e3372191399b758595efe4fe40e9.png

    Fig B - if I open at the last layout position this is what I want to see.., not Fig A. 

     


  14. A few minutes after my post above, I made the discovery of the cause of slowness.  Next, I will look into figuring out how to time the output speed in seconds or ms when I figure that out.  I want to show that as part of a process time somewhere in the output window.  Then, I can test the efficiency of various ideas. 

     

    Anyway, to explain the slowness..

     

    In this line below, in the inner for/loop, I was testing some values and forgot to remove those part(s) of code after inc(index);  I REM them out as seen below, and the output is now instant.  Those code fragments were two TStaticText controls that I was using to debug the index counts I was having trouble with.  TStaticText displays values without interruption while TMemo updates in real-time during for/loops.  If I use plain TEdit controls, then the updates display at the end of the TMemo updates. So, I don't use tedit's for this purpose during debugging real-time outputs. 

     

    for row do. .

      for col do. .

        inc(index); //st1.Caption := inttostr(index); st2.Caption := inttostr(x);

      // col

    // row

     

    (I am going to branch this hex dump feature into another separate project--will call it HexdumpViewer or something--and will add some other interesting ideas to it.  I have a few already and want to try them out soon.)

     

    I will look at your other ideas/suggestions, thanks. 

     


  15. Thank you for your positive feedback. 

     

    I failed to mention and add another bullet, to describe the field values showing in the above-posted hex dump output, the values (AAAAA, BBBBB, CCCCC), this was the data I stored inside the dbgrid that I .SaveToStream and then copied all its content into the bufArray variable for processing.

     

    The one CON I see in this hex dump feature is that it is slow. The method I used to process and then update the memo control is quite slow, about 1.25 secs to go through a 1.3k to 1.5k byte array to show the hex dump data. This includes using the .beginupdate and .endupdate settings. 

     

    In order to show a clean output, I am using several functions: 

     

    PadZero(N: longint; Len: integer): string; -- show 0000, 0001, 0999, ... etc
    ByteToIntChar(b: byte): char; -- shows ascii 32..126 chars
    PadSpaceRt(s: string; Len: integer): string; -- aligns the ascii char pain

     

    The above gets processed in the inner for-loop: (for row do.., for col do..)

     

    But at least it works, and that is what matters. 


  16. Update on this project endeavor. . .

     

    RE: creating a Hex Dump feature - Reading stream data and converting to a hex-dump output.

     

    I finally managed to get this bare-bones of a hex-dump feature added to this test app as part of this project, where I am trying to figure out if it's possible to obtain the data behind or inside the memtable's stream and then be able to read/write back and forth data to the stream. 

     

    I struggled with this output shown below. I had trouble understanding ASCII and printable chars based on raw data as seen below.  I searched for several days on the ASCII code and Code Page and Unicode, and so on.  To be honest, I still do not fully understand it all but I only wanted to get a display like the one shown below. 

     

    1 - 0015 through 1217 is the Byte position in row number format, in steps of 16 bytes into the stream and is representative of the size of the stream (from TMemTable), or strm.size;
    2 - first line, and so on down the list, -- 41..00 is the conversion from Byte to Hex
    3 - first line, and so on down the list, -- "ADBS...." is the char representation.

    4 - the dots "." that you see are supposedly non-printable chars

    5 - the TMemTable's is connected to a dbgrid.  The grid has 4 fields: (IMS, ItemNo, Category, Vendor) - those fieldnames are showing in the hex dump below.  This data is pulled from the memtabl's stream and processed.

     

    note:  I did the best I could in the time frame I have currently in creating this feature.  And, please don't expect it to follow any standard hex dump editor perfectly.  I have not compared it to any of those as yet.  But for something like this, its a first-time for me without blueprints or someone else's code. 

    0015: 41 44 42 53 10 00 00 00 06 02 00 00 FF 00 01 00  - ADBS............
    0031: 01 FF 02 FF 03 04 00 08 00 00 00 6D 00 65 00 6D  - ...........m.e.m
    0047: 00 31 00 05 00 08 00 00 00 6D 00 65 00 6D 00 31  - .1.......m.e.m.1
    0063: 00 06 00 00 00 00 00 07 00 00 08 00 32 00 00 00  - ............2...
    0079: 09 00 00 FF 0A FF 0B 04 00 06 00 00 00 49 00 4D  - .............I.M
    0095: 00 53 00 05 00 06 00 00 00 49 00 4D 00 53 00 0C  - .S.......I.M.S..
    0111: 00 01 00 00 00 0E 00 0D 00 0F 00 01 10 00 01 11  - ................
    0127: 00 01 12 00 01 13 00 01 14 00 01 15 00 06 00 00  - ................
    0143: 00 49 00 4D 00 53 00 FE FF 0B 04 00 0C 00 00 00  - .I.M.S..........
    0159: 49 00 74 00 65 00 6D 00 4E 00 6F 00 05 00 0C 00  - I.t.e.m.N.o.....
    0175: 00 00 49 00 74 00 65 00 6D 00 4E 00 6F 00 0C 00  - ..I.t.e.m.N.o...
    0191: 02 00 00 00 0E 00 16 00 17 00 14 00 00 00 0F 00  - ................
    0207: 01 10 00 01 11 00 01 12 00 01 13 00 01 14 00 01  - ................
    0223: 15 00 0C 00 00 00 49 00 74 00 65 00 6D 00 4E 00  - ......I.t.e.m.N.
    0239: 6F 00 18 00 14 00 00 00 FE FF 0B 04 00 10 00 00  - o...............
    0255: 00 43 00 61 00 74 00 65 00 67 00 6F 00 72 00 79  - .C.a.t.e.g.o.r.y
    0271: 00 05 00 10 00 00 00 43 00 61 00 74 00 65 00 67  - .......C.a.t.e.g
    0287: 00 6F 00 72 00 79 00 0C 00 03 00 00 00 0E 00 16  - .o.r.y..........
    0303: 00 17 00 14 00 00 00 0F 00 01 10 00 01 11 00 01  - ................
    0319: 12 00 01 13 00 01 14 00 01 15 00 10 00 00 00 43  - ...............C
    0335: 00 61 00 74 00 65 00 67 00 6F 00 72 00 79 00 18  - .a.t.e.g.o.r.y..
    0351: 00 14 00 00 00 FE FF 0B 04 00 0C 00 00 00 56 00  - ..............V.
    0367: 65 00 6E 00 64 00 6F 00 72 00 05 00 0C 00 00 00  - e.n.d.o.r.......
    0383: 56 00 65 00 6E 00 64 00 6F 00 72 00 0C 00 04 00  - V.e.n.d.o.r.....
    0399: 00 00 0E 00 16 00 17 00 14 00 00 00 0F 00 01 10  - ................
    0415: 00 01 11 00 01 12 00 01 13 00 01 14 00 01 15 00  - ................
    0431: 0C 00 00 00 56 00 65 00 6E 00 64 00 6F 00 72 00  - ....V.e.n.d.o.r.
    0447: 18 00 14 00 00 00 FE FE FF 19 FE FF 1A FE FF 1B  - ................
    0463: FF 1C 1D 00 00 00 00 00 FF 1E 00 00 01 00 00 00  - ................
    0479: 01 00 05 00 00 00 41 41 41 41 41 02 00 05 00 00  - ......AAAAA.....
    0495: 00 42 42 42 42 42 03 00 05 00 00 00 43 43 43 43  - .BBBBB......CCCC
    0511: 43 FE FE FE FE FE FF 1F FE FF 20 21 00 02 00 00  - C........ !....
    0527: 00 FF 22 FE FE FE 0E 00 4D 00 61 00 6E 00 61 00  - ..".....M.a.n.a.
    0543: 67 00 65 00 72 00 1E 00 55 00 70 00 64 00 61 00  - g.e.r...U.p.d.a.
    0559: 74 00 65 00 73 00 52 00 65 00 67 00 69 00 73 00  - t.e.s.R.e.g.i.s.
    0575: 74 00 72 00 79 00 12 00 54 00 61 00 62 00 6C 00  - t.r.y...T.a.b.l.
    0591: 65 00 4C 00 69 00 73 00 74 00 0A 00 54 00 61 00  - e.L.i.s.t...T.a.
    0607: 62 00 6C 00 65 00 08 00 4E 00 61 00 6D 00 65 00  - b.l.e...N.a.m.e.
    0623: 14 00 53 00 6F 00 75 00 72 00 63 00 65 00 4E 00  - ..S.o.u.r.c.e.N.
    0639: 61 00 6D 00 65 00 0A 00 54 00 61 00 62 00 49 00  - a.m.e...T.a.b.I.
    0655: 44 00 24 00 45 00 6E 00 66 00 6F 00 72 00 63 00  - D.$.E.n.f.o.r.c.
    0671: 65 00 43 00 6F 00 6E 00 73 00 74 00 72 00 61 00  - e.C.o.n.s.t.r.a.
    0687: 69 00 6E 00 74 00 73 00 1E 00 4D 00 69 00 6E 00  - i.n.t.s...M.i.n.
    0703: 69 00 6D 00 75 00 6D 00 43 00 61 00 70 00 61 00  - i.m.u.m.C.a.p.a.
    0719: 63 00 69 00 74 00 79 00 18 00 43 00 68 00 65 00  - c.i.t.y...C.h.e.
    0735: 63 00 6B 00 4E 00 6F 00 74 00 4E 00 75 00 6C 00  - c.k.N.o.t.N.u.l.
    0751: 6C 00 14 00 43 00 6F 00 6C 00 75 00 6D 00 6E 00  - l...C.o.l.u.m.n.
    0767: 4C 00 69 00 73 00 74 00 0C 00 43 00 6F 00 6C 00  - L.i.s.t...C.o.l.
    0783: 75 00 6D 00 6E 00 10 00 53 00 6F 00 75 00 72 00  - u.m.n...S.o.u.r.
    0799: 63 00 65 00 49 00 44 00 0E 00 64 00 74 00 49 00  - c.e.I.D...d.t.I.
    0815: 6E 00 74 00 33 00 32 00 10 00 44 00 61 00 74 00  - n.t.3.2...D.a.t.
    0831: 61 00 54 00 79 00 70 00 65 00 14 00 53 00 65 00  - a.T.y.p.e...S.e.
    0847: 61 00 72 00 63 00 68 00 61 00 62 00 6C 00 65 00  - a.r.c.h.a.b.l.e.
    0863: 12 00 41 00 6C 00 6C 00 6F 00 77 00 4E 00 75 00  - ..A.l.l.o.w.N.u.
    0879: 6C 00 6C 00 08 00 42 00 61 00 73 00 65 00 14 00  - l.l...B.a.s.e...
    0895: 4F 00 41 00 6C 00 6C 00 6F 00 77 00 4E 00 75 00  - O.A.l.l.o.w.N.u.
    0911: 6C 00 6C 00 12 00 4F 00 49 00 6E 00 55 00 70 00  - l.l...O.I.n.U.p.
    0927: 64 00 61 00 74 00 65 00 10 00 4F 00 49 00 6E 00  - d.a.t.e...O.I.n.
    0943: 57 00 68 00 65 00 72 00 65 00 1A 00 4F 00 72 00  - W.h.e.r.e...O.r.
    0959: 69 00 67 00 69 00 6E 00 43 00 6F 00 6C 00 4E 00  - i.g.i.n.C.o.l.N.
    0975: 61 00 6D 00 65 00 18 00 64 00 74 00 41 00 6E 00  - a.m.e...d.t.A.n.
    0991: 73 00 69 00 53 00 74 00 72 00 69 00 6E 00 67 00  - s.i.S.t.r.i.n.g.
    1007: 08 00 53 00 69 00 7A 00 65 00 14 00 53 00 6F 00  - ..S.i.z.e...S.o.
    1023: 75 00 72 00 63 00 65 00 53 00 69 00 7A 00 65 00  - u.r.c.e.S.i.z.e.
    1039: 1C 00 43 00 6F 00 6E 00 73 00 74 00 72 00 61 00  - ..C.o.n.s.t.r.a.
    1055: 69 00 6E 00 74 00 4C 00 69 00 73 00 74 00 10 00  - i.n.t.L.i.s.t...
    1071: 56 00 69 00 65 00 77 00 4C 00 69 00 73 00 74 00  - V.i.e.w.L.i.s.t.
    1087: 0E 00 52 00 6F 00 77 00 4C 00 69 00 73 00 74 00  - ..R.o.w.L.i.s.t.
    1103: 06 00 52 00 6F 00 77 00 0A 00 52 00 6F 00 77 00  - ..R.o.w...R.o.w.
    1119: 49 00 44 00 10 00 4F 00 72 00 69 00 67 00 69 00  - I.D...O.r.i.g.i.
    1135: 6E 00 61 00 6C 00 18 00 52 00 65 00 6C 00 61 00  - n.a.l...R.e.l.a.
    1151: 74 00 69 00 6F 00 6E 00 4C 00 69 00 73 00 74 00  - t.i.o.n.L.i.s.t.
    1167: 1C 00 55 00 70 00 64 00 61 00 74 00 65 00 73 00  - ..U.p.d.a.t.e.s.
    1183: 4A 00 6F 00 75 00 72 00 6E 00 61 00 6C 00 12 00  - J.o.u.r.n.a.l...
    1199: 53 00 61 00 76 00 65 00 50 00 6F 00 69 00 6E 00  - S.a.v.e.P.o.i.n.
    1215: 74 00 0E 00 43 00 68 00 61 00 6E 00 67 00 65 00  - t...C.h.a.n.g.e.
    1217: 73 00                                            - s.

     


  17. I had other questions but am pressed for time for work.   But real quick.  I see TMemoryStream has .Clear and TStream do not.  Is there a similar way to clear streams when using TStream ?

     

    In this learning portion of streams and in the test app I am using in this topic, I have been using the following setup: 

     

    var
      strm: TStream;  // <-- 
      memstrm: TMemoryStream;
    
    ... 
    ... 
    
    procedure tform1.FormCreate...
    begin
      strm: TMemoryStream.Create; // <--
      memstrm: TMemoryStream.Create;
    end;
    
    ... 
    procedure clearmem;
    begin
      MemStrm.clear; // reset to nothing and start over
      strm. ?        // 
    end;
    ... 
    
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
      strm.Free;
      memstrm.Free;
    end;

    TIA

     


  18. Thanks Peter.  You helped to clear up a few things.  I remember you and a few others from TeamB from the days of old, back in the 90's/2000's, seeing your many replies.  I always wondered about the origin of TeamB, you know, how it came to be and all.  You guys were everywhere, at least in my Yahoo and Google searches in those days.  I learned a lot and also forgot a lot, LOL.  I had many personal life matters that took over my Turbo Pascal and Delphi hobbies and left me on many programming hiatuss over the years. 

     


  19. I am a beginner just learning a few things about Stream, how to Write and Read from it. 

     

    For instance, given the code snippet below, I can write and read a text string into a TEdit. This is bare basic without Try/Finally. 

     

    * code snippet extracted from one of my projects. 

    var s: string;
    
    procedure TForm1.btnStrToStreamClick(Sender: TObject); // save/write to a stream
    begin
      s := 'this is a test.';
      strmSize := length(s);  // 15 chars
      strm.Write(s, strmSize);
    end;
    
    procedure TForm1.btnStrmToStringClick(Sender: TObject); // load/read into a tedit control
    begin
      strm.Read(s, strmSize); // read back the 15 chars
      eb2.Text := s;          // show in tedit control
    end;

     

    I was wondering how FireDAC's tmemtable stores the data when the user uses the memtable.SaveToStream method.

     

    I am asking because I would like to Paste some data into a dbgrid.  I don't mean to past it directly into the dbgrid.  I mean to pass the data in the clipboard into a stream that a TMemTable can deal with via Streams.  A lot of times when I have various sources that I copy/select from (web page selections, notepad, excel, ms access, etc.) and I would like to just Paste it into a dbgrid via the database memtable

     

    The process flow would go something like this: (selected data -> clipboard -> [custom format/structure for dest] -> a stream -> database -> viewing control ie dbgrid) 

     

    So, I would like to know if anyone knows what the structure used in the .SaveToStream is, so that I can build the same and send the clipboard contents over to it.

     


  20. I was wondering if anyone knows how to completely turn off auto updates in windows 10.  I have the HP Stream 14" 64bit, 4GB Ram, Intel Celeron N4020 laptop from Oct/2021.

    (Hint: I have removed the "S" part from Windows 10)

    (link https://www.walmart.com/ip/HP-14-PC-Laptop-Intel-Celeron-N4000-4GB-RAM-64GB-HD-Windows-10S-with-1-year-Office-365-Blue-14-cb171wm/803600781?from=/search

     

    Currently, there is an update(s) in cache waiting for me to update-and-shut down, but I keep refusing it and choose sleep.  Eventually, I will have to shut down for other reasons but I would like to turn off updates if possible, including the update in cache.

     

    I would like to use this for part-time coding in Delphi 11.2 since I have that already installed since 11/2023.  TIA. 

     


  21. Sorry, I lost this topic and just found it.  

     

    I meant, for Android, when you click on the Message [...] icon at the bottom, to type a text message to someone who's phone number you have.  You enter their phone number to create a new contact if not already there, and you begin texting back and forth to that person in Messages. 

     

    I want to copy all the messages in each contact that I have had text conversations with, but there is no Select-All, just Copy Text, where you have to long-press on a single message and a pop-up menu shows 'copy text' or 'copy to SIM card'. but it only copies that one text message, not all the messages. 

     

    If I could select-all the text and copy it to the clipboard and then send that to my laptop via app-tethering, now that I have that working. 

     

×