Jump to content

Search the Community

Showing results for tags 'tmemo'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. Specs: delphi xe7, vcl, win7 - TMemo components I've been searching to no avail on this topic. I can't find any example source code showing how to synchronize two memo's scrolling, via keyboard, mouse, and scrollbars. I see there are a few for TListBox examples but not for TMemo. I also tried one example (it was for tlistbox) and everything compiles except that TMemo does not have a .TopIndex so that source code does not compile up to that point. (link below). link to that resource -> https://stackoverflow.com/questions/24195857/synchronize-scrollbars-of-two-listboxes. source from stackexchange: To set the top line of a list box you use TopIndex. You can create a TListbox descendent that handles the WM_VSCROLL (and WM_HSCROLL if you want). You can then hook into this and update the second list box. Here is an example of this. I am only doing the hook one way so scrolling listbox2 won't scroll listbox1. You will need to add this TListBox override to your unit before the form declaration: TListBox = class(Vcl.StdCtrls.TListBox) private FOnScroll: TNotifyEvent; protected procedure ListBoxScroll(var Message: TMessage); message WM_VSCROLL; public property OnScroll: TNotifyEvent read FOnScroll write FOnScroll; end; This adds a OnScroll event to the listbox. The implementation for this class: procedure TListBox.ListBoxScroll(var Message: TMessage); begin inherited; if Assigned(FOnScroll) then FOnScroll(Self); end; You can then hook up the event in code: procedure TMyForm.FormCreate(Sender: TObject); begin listbox1.OnScroll := DoScrollListBox1; end; The code for DoScrollListBox1 is very simple: procedure TMyForm.DoScrollListBox1(Sender: TObject); begin listbox2.TopIndex := listbox1.TopIndex; end; This handles the scrolling by using the scroll bar. You will also need to add the following line to your OnClick of the listbox so keyboard actions will also trigger the scrolling. procedure TMyForm.ListBox1Click(Sender: TObject); begin ... listbox2.TopIndex := listbox1.TopIndex; ... end; My modified version of the above code: unit Unit1; interface TForm1 = class(TForm) memo1: TMemo; memo2: TMemo; procedure memo1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation {$R *.dfm} procedure TMemo.MemoScroll(var Message: TMessage); begin inherited; if Assigned(FOnScroll) then FOnScroll(Self); end; procedure TForm1.FormCreate(Sender: TObject); begin memo1.OnScroll := DoScrollMemo; end; procedure tform1.DoScrollMemo(Sender: TObject); begin memo2.TopIndex := memo1.TopIndex; end; // This handles the scrolling by using the scroll bar. You will also need to // add the following line to your OnClick of the listbox so keyboard actions // will also trigger the scrolling. procedure tform1.memo1Click(Sender: TObject); begin //... //memo2.TopIndex := memo1.TopIndex; // <--- Does not compile at this point because there is no .TopIndex in TMemo. I learned this all to late. //... end; Does anyone have source code for synchronizing two TMemo's?
  2. 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. 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. Fig B - if I open at the last layout position this is what I want to see.., not Fig A.
×