wpaGetFlags method

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

This method retrieves the state of all WPA actions.

Applies to



Overloaded Variants

Procedure wpaGetFlags(EditoNumber: Integer);

Function wpaGetFlags(Editor: Integer): WideString;


procedure wpaGetFlags(Editor: Integer): WideString;


This method is used within the event OnUpdateGUI to retrieve the current flags in form of an array. The OCX and the .NET assembly behave a bit differently:


a) OCX

The wpaGetFlags implementation returns a string with each character contains the state bits for one action.


Dim s As String ' the returned array is a string

Dim i As Integer ' we need the index of a certain action

Dim Bytes() As Byte ' we need a bytes array to test the flags

s = WPDLLInt1.wpaGetFlags(0) ' this are the flags for the current editor

i = WPDLLInt1.wpaGetID("bold") ' this is the id for the command to toggle 'bold'

Bytes = StrConv(s, vbFromUnicode) ' convert string to bytes

If Bytes(i) And 2 Then BoldMenu.Checked = True Else  BoldMenu.Checked = False


b) .NET

The function wpaGetFlags(EditorNr : Integer) fills a byte array. This array can be used easily and no format conversion is required.


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


 int wpa_bold = wpdllInt1.wpaGetID("Bold");

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

 BoldMenu.Pushed = (stateflags[wpa_bold] & 2)!=0;



Link: List of action names to be used with wpaGetID...


Note: You can use wpaSetFlags to modify certain internal states. This makes it possible to disable internal buttons under program control.




The number of the editor to examine, 1 or 2

Use 0 to check the active editor.


An array with a bitfield for each element (Byte or Char):

bit 1: action is enabled

bit 2: action is selected (menu shows check, button is pressed)

bit 3: action is hidden, it is not available

bit 7: This bit is always set to avoid #0 entries.

Category: Action Names


[idh_wpdllint_wpagetflags.htm]    Copyright © 2007 by WPCubed GmbH