Configure the Editor / FAQ

[Top]  [Chapter]  [Previous]  [Next]

In this topic we list the important methods to configure the editor in TextDynamic. Also see .NET Trouble Shooting and OCX Trouble Shooting.

 

1) How to select the editor mode, switch between single editor, double editor and split screen?

 

You need to use the method SetEditorMode. Here you specify which mode you need. Since this procedure recreates the editor, please set the license keys before hand.

 

2) How to select the large or small toolbar?

 

This is also done by the method SetEditorMode, please use the parameter XMode

 

3) How can I change the rulers to Inches?

 

This is also done by the method SetEditorMode, parameter GUI1 and GUI2 (for first or secondary editor). Use the bit #10 (value 1024). Using the GUI flags you also activate the tool panels and the rulers.

 

4) How to switch the paragraph symbol  " ¶ " off and on?

 

This flag is part of the "ViewOptions".  You can use this method to set different modes:

 

Memo.SetBProp( 6, 29, -1)

 

Please also see the other possible flags for "viewOptions".

 

5) How to change the toolbar design and color?

 

Please read here: Change Toolbar Design

 

6) How to modify the toolbar?

 

a) How to add a new button?

 

The toolbar loads the layout from the "PCC" file - see SetLayout(). You can modify the layout using the provided "ImagePack" program.  (more...)

 

When you have started the tool WPImagePack.exe you can edit the XML data which describes the toolbar:

 

Example: We add a new button to show the "insert graphic" dialog.

 

modify_pcc

 

b) How to exchange a glyph (button image)?

 

It is also possible to replace the glyphs. You need a PNG editor for this. Unlike the demo edition, the registered version can extract the PNG data from the PCC file to be modified externally.  (more...)

 

c) How to add a button with custom functionality?

 

Add a line, such as

CreateNewWindow

 

then you need an event handler for OnButtonClick

 

Private Sub WPDLLInt1_OnButtonClick(ByVal Editor As LongByVal Def As WPTDynInt.IWPDllButton)

   If Def.Name = "CreateNewWindow" Then

     LoadNewDoc ' implemented as public routine in 'Main.BAS'

   End If

End Sub

 

7) How to activate/deactivate the premium features (text boxes, foot notes and columns) ?

 

Please use the method SetEditorMode.

 

8) Provide the User with information about cursor position (status bar)

 

Please use the event OnUpdateGUI. (Example)

 

9) Add a menu to the window and execute actions in the editor

 

Please use your IDE to create a menu. You can then execute the wpaProcess() to start a certain action. Of course you can also execute the methods in the Memo or TextCursor interface. To automatically enable/disable your menu items use the wpaGetFlags method within OnUpdateGUI.

 

10) Add spell check

 

The method Memo.TextCommand(7, ParamA, 0) can be used to control the spell check.

Please also see the spell check category and the VB6 example in the topic IWPSpell.

 

11) Add hot keys / shortcuts

 

You can add short cuts using the KeyPress and KeyDown event. Please see example there.

 

Please note that you need to cast e to the type wpKeyEventArgs to use the value of Control, Alt and Shift.

 

private void wpdllInt1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)

{

    if(((wpKeyEventArgs)e).Control

         MessageBox.Show("Control Key pressed!");

}

 

12) Disable editing

 

You can set the property Memo.Readonly to true. Also see the options available via Memo.SetBProp

 

13) How to resize the editor automatically according to the size of the window

 

This mode is called "WordWrap Mode". You can activate it using Memo.WordWrap.

 

14) How to set a default font

 

a) Using the Memo.TextommandStr ID 18 You can set the default font name and font size which will be applied when the editor is initialized.

 

b) You can set the attributes of CurrAttr in the event OnClear and after the call to SetEditorMode when the editor has been initialized.

 

15) Update the page size

 

Use the property Memo.PageSize.

 

wpdllInt1.Memo.PageSize.SetPageWH(-1, -1, 720, 720, 720, 720);

 

To make the current page size the default for new document use Memo.TextCommandStr(19,0,"");

 

wpdllInt1.Memo.TextCommandStr(19, 0, "");

 

16) C# - copy text from one editor to another using SaveToVar/LoadFromVar

 

object currtext = wpdllInt1.Memo.SaveToVar(false, "WPT");

wpdllInt2.Memo.LoadFromVar(currtext, false, "AUTO");

 

17) VS 2008: In case of problems during debugging please disable the "hosting process"

clip0195

 

18) How use TextDynamic in C++

 

Here You can either use the OCX in a container control, or You can use the new method wptextCreateDialog:

 

TextDynamic as Popup Editor (method wptextCreateDialog)

 

19) Optimize the text display

see: IWPMemo.SetWYSIWYGMode

 


[configure_the_editor.htm]    Copyright © 2007 by WPCubed GmbH