Update Statusbar

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

a) To update the status bar we add an event handler for OnUpdateGUI.

 

This event receives useful information about the location inside the text + a number of state flags.

 

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":"");

}

 

You can also use Memo.Statistic to retrieve information about the count of words, lines and pages.

 

b) We want to use the last panel to display the "hint" of the tool button under the mouse cursor.

 

The OnShowHint event makes it easy:

 

private void wpdllInt1_OnShowHint(object Sender, int X, int Y, string Hint, ref bool Ignore)

{

 stHint.Text = Hint;

 Ignore = true;

}

 

Now the status bar shows useful information

clip0093

 

 


[updatestatusbar.htm]    Copyright © 2007 by WPCubed GmbH