Robert W.B. Linn´s Software, Beispielprojekte und Tipps zu TurboDB, TurboDB Studio, Visual Data Publisher und die tdbengine.  |  TurboDB Studio  |  >TurboDB VCL < |  VDP  |  roTDBtools  |  roPTools  |  KALHelp  |  Downloads  |  Links  | Suche  | Kontakt  | Impressum  | 
   
TAdvMemo
Komponenten TurboDB und TMS Component Pack  »  TMS Component Pack Tips  »  TAdvMemo  | 

***TAdvMemo
TAdvMemo - Howto use CloseDialog method in AdvMemoFindDialog, AdvMemoReplaceDialog
Simply call AdvMemoFindDialog.CloseDialog to programmatically close the dialog.

TAdvMemo - Alternate Selection Deletion
Use advmemo.Selection := '';

or advmemo.DeleteSelection

TAdvMemo - Get Memotext Length
Length(advmemo.Lines.Text);

TAdvMemo - Create a Backup from Memotext
advmemo.Lines.SaveToFile(backupfile);

TAdvMemo - Set the position of advmemofinddialog
Use AdvMemo.CurX and AdvMemo.CurY

TAdvMemo - Define an own syntax highlighter?
Descend from TAdvCustomMemoStyler.
The included syntax styler source code serves as examples for this.

TAdvMemo - AdvMemo.Modified := True not working
Modified is a read-only property.

TAdvMemo - Get the first and lastline number of the selected text
Do this by

PosFromText(memo.SelStart, x_start,y_start);

and

PosFromText(memo.SelStart + memo.SelLength, x_end,y_end);

The y_start and y_end are the start and end line of the selection.

TAdvMemo - HowTo Change bookmark icon/s
Do this by changing the resource TMS_FLAG in AdvMemo.res

TAdvMemo - Selecting a line
Select a line use:
var
tp: integer;
advmemo.TextFromPos(0,LineNr-1,tp);
advmemo.SelStart := tp;
advmemo.SelLength := Length(Advmemo1.Lines[LineNr-1]);
advmemo.SetFocus;

TAdvMemo - Selected lines start & end
Selected lines start & end can be retrieved with:
AdvMemo.SelStartY
AdvMemo.SelEndY

TAdvMemo - Synchronization between the caret and the memo
This requires a fixed font like most syntax highlighting editors.

TAdvMemo - FindText Options usage

The options are the standard VCL FindOptions declared in Dialogs.pas

TFindOption = (frDown, frFindNext, frHideMatchCase, frHideWholeWord,
frHideUpDown, frMatchCase, frDisableMatchCase, frDisableUpDown,
frDisableWholeWord, frReplace, frReplaceAll, frWholeWord, frShowHelp);

TFindOptions = set of TFindOption;

Usage: AdvMemo1.FindText('test',[frDown]);

TAdvMemo - Find using WordAtCursor
var
TextToFind: string;
..
AdvMemoFindDialog1.AdvMemo := AdvMemo1;
TextToFind := AdvMemo1.WordAtCursor;
AdvMemoFindDialog1.FindText := TextToFind;
AdvMemoFindDialog1.Execute;
...

TAdvMemo - Set Cursor at Postion

Use Memo.SetCursor(CurX, CurY);

Examples
To set the cursor at end of text use
Memo.PosFromText(MemoLen - 1, CurX, CurY);
Memo.SetCursor(CurX, CurY);

TAdvMemo - Select Printer

Use the standard PrinterSetupDialog
if PrinterSetupDialog.Execute then AdvMemo.Print;


Letzte Änderung 20.01.2009 14:26 Erstellt mittels KALHelp 6.4.1 (17.11.2008) (alle Rechte vorbehalten) (c) Robert W.B. Linn @53° 38' 60''N 9° 48' 0''E