Source Editor Readme.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Source Editor Component
  2. =========================
  3. for Borland Delphi 4 or later
  4. Copyright (c) 2000 Sebastian Reichelt
  5. SebastianR@gmx.de
  6. TSourceEdit is a source editor control with several features that are
  7. useful for IDE programmers with Delphi knowledge. It is based on
  8. TMemoComponent, which is completely home-made from scratch. However,
  9. many useful properties and methods of TMemo have been implemented.
  10. All properties and methods should be self-explaining. If you have any
  11. questions concerning their usage, feel free to ask me.
  12. Note that you should use the property Text instead of Lines to access
  13. the whole text. To modify a piece of text at runtime, use the
  14. following code, or something similar:
  15. with TMCRange.Create (nil) do
  16. try
  17. Editor := MyComponent; // or whatever the name is
  18. RStart := S; // the first character
  19. REnd := E; // the last character; can be < S
  20. Text := NewText; // the new text;
  21. finally
  22. Free;
  23. end;
  24. Instead of RStart and REnd, you can also use StartRowCol, EndRowCol,
  25. and RLength.
  26. Line breaks are signaled by #13#10.
  27. You also can track positions in your code using ranges. If you do the
  28. following:
  29. MyRange := TMCRange.Create (MyComponent.TrackedRanges);
  30. with MyRange do begin
  31. RStart := S;
  32. REnd := E;
  33. OnOverwrite := MyOverwriteHandle; // optional
  34. end;
  35. then MyRange will always be updated when the text changes, so that you
  36. can easily jump to the correct position of an error, the definition of
  37. an identifier, or wherever you want. Just use:
  38. MyComponent.Selection.Assign (MyRange);
  39. and the range will be selected.
  40. For automatic saving and loading of TSyntaxColoring, a
  41. TSyntaxColoringCopy class has been created, whose instances can be
  42. passed to TStream.ReadComponent and TStream.WriteComponent. Note that
  43. TStream is an abstract class; use TMemoryStream instead. Then you can,
  44. for example, save your whole highlighting options in the registry.
  45. That's all I want to write for now. Happy programming!
  46. Sebastian Reichelt