OnUpdateGUI Event

[Top]  [Chapter] 

This is the main event to update any custom toolbar and menu.

Member of WPDLLInt

Declaration C#

OnUpdateGUIEvent(Object Sender, int Editor, int UpdateFlags, int StateFlags, int PageNr, int PageCount, int LineNr)

 

Declaration OCX

OnUpdateGUI(ByVal Editor As Long, ByVal UpdateFlags As Long, ByVal StateFlags As Long, ByVal PageNr As Long, ByVal PageCount As Long, ByVal LineNr As Long)

 

The event can be used to show the current position in a statusbar:

 

Private void wpdllInt1_OnUpdateGUI(Object Sender, 

   int Editor, 

   int UpdateFlags, 

   int StateFlags, 

   int PageNr, 

   int PageCount, 

   int LineNr)

{

      stPage.Text = Convert.ToString(PageNr)+'/'+ Convert.ToString(PageCount);

      stLine.Text = "Line " + Convert.ToString(LineNr); 

      stIns.Text = (((StateFlags&2)!=0)?"INS":"");

}

 

This is also the recommended event to update any custom toolbar and menu. Inside this event You can use the wpaGetFlags to retrieve the states of all implemented wpa actions in one array.

C# example:

private void wpdllInt1_OnUpdateGUI(object Sender, int Editor, int UpdateFlags, int StateFlags, int PageNr, int PageCount, int LineNr)

{

       int wpa_italic = wpdllInt1.wpaGetID("Italic");

       byte[] stateflags = wpdllInt1.wpaGetFlags(0); // Current editor

       btItalic.Pushed =(stateflags[wpa_italic] & 2)!=0;

}

In this example we use wpaGetID to get the ID for a certain action to make the process better to understand. In a real world application you would use wpaGetID() only once and then save the result id in an integer property added to the button or menu class. (see example "First C# Application" in the manual)

Parameters

Editor

The number of the current editor, 1 or 2

UpdateFlags

The bitfield UpdateFlags selects the elements of the GUI which need update:

bit 1 (1): Selection has been changed/

bit 2 (2): Undo/Redo state has been changed

bit 3 (4): Paragraph properties have been changed

bit 4 (8): Character attributes have been changed

bit 5 (16): The Layout mode was changed

bit 6 (32): Cursor position has been changed

bit 7 (64): The Readonly property was changed

bit 8 (128): The editor features/license has been changed

Usually you do not have to use this parameter. It is internally used to update the flag array in a more effective way.

StateFlags

The bitfield StateFlags contains the flags:

bit 1 (1): The text was modified

bit 2 (2): The editor is insertion mode, otherwise overwrite mode

bit 3 (4): Can Undo

bit 4 (8): Can Redo

bit 5 (16): Currently text or an object is selected

bit 6 (32): Currently an object is selected

bit 7 (64): The selected object is an image

bit 8 (128): The cursor is undefined - the current position has not been set

bit 9 (256): The cursor is within a table

bit 10 (512): The current paragraph uses a style

bit 12 (1024): The current position is not inside the text body but in header/footer, text box or footnote. uses a style

PageNr

The current page number

PageCount

The currenbt page count

LineNr

The current line number on the current page

Category

Display Status Information


[idh_wpdllint_onupdategui.htm]    Copyright © 2007 by WPCubed GmbH