Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

FullCollection / Семинары / NNN / all / nnn / Motor / WT / MANUAL

.RTF
Скачиваний:
11
Добавлен:
17.04.2013
Размер:
17.07 Кб
Скачать

A short Reference to WPTOOLS (V0.9)

1. TWPToolBar

property OnIconSelection : TWPIconSelectEvent read FOnIconSelection write FOnIconSelection;

function SelectIcon(index,group,num:Integer):Boolean;

function DeselectIcon(index,group,num:Integer):Boolean;

This is the handler wich will be used by TDBWPRichText. It showas you how to trap the messages.

procedure TDBWPRichText.OnToolBarIconSelection(Sender: TObject;

var Typ: TWpSelNr; var str: OpenString; var group, num, index: Integer);

begin

inherited OnToolBarIconSelection(Sender,Typ,str,group,num,index);

if FDataLink<>nil then

if FDataLink.DataSource<>nil then

if (typ=wptIconSel)

and (group=WPI_GR_DATA)

then begin

if (FDataLink.DataSource.DataSet<>nil)

and (FDataLink.DataSource.State<>dsInactive)

then

case num of

WPI_CO_Next : FDataLink.DataSource.DataSet.Next;

WPI_CO_Prev : FDataLink.DataSource.DataSet.Prior;

WPI_CO_Add : FDataLink.DataSource.DataSet.Insert;

WPI_CO_Del : FDataLink.DataSource.DataSet.Delete;

WPI_CO_Edit : if FDataLink.editing=FALSE then

FDataLink.DataSource.DataSet.Edit;

WPI_CO_Cancel : FDataLink.DataSource.DataSet.Cancel;

WPI_CO_ToStart: FDataLink.DataSource.DataSet.First;

WPI_CO_ToEnd : FDataLink.DataSource.DataSet.Last;

end;

WPToolBar.DeselectIcon(0,WPI_GR_DATA,num);

typ:=wptNone;

end;

end;

These Functions return Listboxes or Itemes to let you disable entries.

function GetStyleBox : TComboBox;

function GetStyleItems: TStrings;

function GetFontBox : TComboBox;

function GetFontItems : TStrings;

function GetSizeBox : TComboBox;

function GetSizeItems : TStrings;

These Functions are used to show the actual writing mode...

procedure UpdateSelection(Typ:TWpSelNr;const str:string;num:Integer);

procedure UpdateFromFont(Fon:TFont;const Bru:PTBrush);

If you select a component like TEdit you can alter its writiting mode.

property UpdateObject : TComponent read fsUpdateObjp write fsUpdateObjp;

property UpdateObjectName : String read fsUpdateName write fsUpdateName;

you may use additional glyphs

property IconPath : String read bmppath write bmppath;

property LoadIcons : String read fsIcons write fsIcons; 'Bold,Italic,...'

(not well tested... :-)

Select what toolbar items you need:

property sel_ListBoxes : TWpTbListboxen read fsSelection write SetListboxes;

property sel_StatusIcons : TWpTbIcons read fsIntIcons write SetIntIcons;

property sel_ActionIcons : TWpTbIcons2 read fsIntIcons2 write SetIntIcons2;

property sel_DatabaseIcons: TWpTbIcons3 read fsIntIcons3 write SetIntIcons3;

Please let me know if you have suggestions for WPToolbar!

2. TWPRuler

set the actual indenting:

procedure SetIndent(IFirst,ILeft,IRight:Longint);

get access to the ruler variables wich include the pagesize parameters as well.

property PConfig : PTWPRulerVar read pval write SetPVal;

scrolls the Ruler:

property XOffset : Integer read x_offset write SetXOffset default 0;

this events are called after or during changing

property OnSelection : TWPRulerSelectEvent read FOnSelection write FOnSelection;

property WhileSelection : TWPRulerSelectEvent read FWhileSelection write FWhileSelection;

3. TWPRichText and TDBWPRichText

Call this before anything else!

procedure Init; virtual;

CleanUp

procedure Done; virtual; procedure FontSelect; { rufen selbst die Dialoge auf ! }

This will change plain text into RTF text. Yet you alwayes have RTF text!

procedure Make_RichText;

Ask for Name and saves

procedure SaveAs;

Save, if no name known, ask for it

procedure Save;

Ask for name and load the file (as RTF!)

procedure Load;

display TPronterSetup

procedure PrinterSetup;

Print, yet only WYSIWYG is supported

procedure Print;

Let you change the parameters for the page. (not implemeted yet!)

procedure GetConfigVar(var v : TWPConfigVar);

procedure SetConfigVar(var v : TWPConfigVar);

The handler for Ruler events. call it to change indenting by program.

procedure OnConfigChange(Sender: TObject;

var val:TWPConfigVar;

var str:string;

var typ:Integer);

Clipboard Support

procedure CopyFromClipboard;

procedure PasteFromClipboard;

procedure DeleteSelection;

File and Stream Input and Output

procedure SaveToStream(s : TStream);

procedure SaveSelectionToStream(s : TStream);

procedure LoadFromStream(s : TStream);

procedure SaveToFile(const name : string);

procedure LoadFromFile(const name : string);

Clears everything

procedure Clear;

Loads the Template

procedure LoadTemplate;

Writes a Message to StatusLabel

procedure WriteStatus(s:string);

Get Cursor Position

procedure GetPosition(var pos,lin,par,pos_in_par:Longi

pos = absolute char popsition

lin = line Number (0...)

par= paragraph number (0...) , pos_in_par = position is this paragraph

Set Cursor Position

procedure SetPosition(pos,lin,par,pos_in_par:Longint);

pos = absolute char popsition

lin = line Number (0...) is only used if pos=0

par= paragraph number (0...) , pos_in_par = position is this paragraph

are only used if pos and lin = 0

Get/Set Position

property CPPosition : Longint read GetCpPosition write SetCPPosition;

property CPLineNr : Longint read GetCPLineNr write SetCpLineNr;

Not implemented yet:

property CPLine : string read GetCpLine write SetCpLine;

property SelStart : Longint

property SelLength : Longint

property SelText : String

{ Find and Replace }

property FindIn : string

property ReplaceIn : string

property FoundPos : Longint; { erst DoFind aufrufen }

property FoundLen : Longint; { dann evtl. DoReplace aufrufen }

property FoundText : string; {String, welcher zu ersetzen ist}

procedure GetTextBuf(Buffer: PChar; BufSize: LongInt; start,len :Longint): Integer;

{ Statistic, read only }

property CountWord;

property CountChar;

property CountLine;

property CountAverageLineLenght;

property CountAverageLineWidth;

Important Properties

property WPToolBar : TWPToolBar read fsToolBar write fsToolBar;

property WPRuler : TWPRuler read fsRuler write fsRuler;

property StatusLabel : TLabel read fsStatus write fsStatus;

Use (additional) extern Scrollbars

property ExternVerScrollBar : TScrollBar read fsVScroll write fsVScroll;

property ExternHorScrollBar : TScrollBar read fsHScroll write fsHScroll;

Show/Hide ScrollBars

property HorScrollBar : Boolean read fsShowHS write fsShowHS;

property VerScrollBar : Boolean read fsShowVS write fsShowVS;

Always format to window width

property FitToWindowHorz : Boolean read fsFitToWindowHorz write fsFitToWindowHorz default FALSE;

for spelling an hyphenation support.

property Language : TWPToolLanguage read FLanguage write FLanguage default twpEnglish;

disable changing

property ReadOnly : Boolean read FReadOnly write SetReadOnly;

evanthandler wich is called when text with blue underline is doubleclicked

property HyperLinkEvent :THyperLinkEvent read FHyperLinkEvent write FHyperLinkEvent;

if TRUE then use TAB to change focus, yet always lake this

property TabStop; yet always true.

end.

Соседние файлы в папке WT