wpaSetFlags method

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

This method can be used to update the flags provided by wpaGetFlags.

Applies to

WPDLLInt

Declaration

procedure wpaSetFlags(Editor: Integer; Start: Integer; Count: Integer; const AllFlags: String);

 

public void wpaSetFlags(int Editor, int Start, int Count, byte[] AllFlags)

Description

It can be only used within the OnUpdateGUI event. With it you can manipulate the states of the buttons in the editor i.e. hide or disable some. You can use wpaGetFlags to first get the states of all buttons and the use wpaSetFlags to change the flags, or you use a new bytes array (with OCX use a string) only for the action you need to update.

Note: If the "start" parameter is >0, the first element of the passed array will be mapped to the flag property of the action with the id "start".

 

While C# is used bits in the byte array, VB uses a string.

 

This bits are expected in the value element for each action.

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.

 

Also see: wpaGetFlags() and OnUpdateGUI.

 

Example: Hide the "new" button:

private int wpaNew = -1;

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

{

 byte[] states;

 states = wpdllInt1.wpaGetFlags(Editor);

 // Store

 if (wpaNew<0) wpaNew = wpdllInt1.wpaGetID("New");

 states[wpaNew] |= 4; // bit 3 - hide it

 wpdllInt1.wpaSetFlags(Editor,0,states.Length, states);

}

 

This example uses the start/count parameter to only change one button.

private int wpaNew = -1;

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

{

 byte[] states = new byte[1];

 if (wpaNew<0) wpaNew = wpdllInt1.wpaGetID("New");

 states[0] = 4; // bit 3 - hide it

 wpdllInt1.wpaSetFlags(Editor,wpaNew,1, states);

}

 

The same as VB6 code:

Option Explicit

Dim wapNew As Integer

Private Sub WPDLLInt1_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)

  If wapNew = 0 Then

     wapNew = WPDLLInt1.wpaGetID("New")

  End If

  WPDLLInt1.wpaSetFlags 1, wapNew, 1, "E"

End Sub

Category: Action Names


[idh_wpdllint_wpasetflags.htm]    Copyright © 2007 by WPCubed GmbH