|
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)
Category |