Tag Archives: System Monitor

Tracking the SAVEWARN property

As veteran OpenInsight programmers know, the system uses a simple boolean flag (exposed as the SAVEWARN property) to determine if the contents of a data-bound form have changed.  This flag can be updated in several ways, the most common being:

  • From the LOSTFOCUS event of a control.
  • From the POSCHANGED, INSERTROW and DELETEROW events of an EDITTABLE control.
  • From setting a control’s DEFPROP property.
  • From the CLOSE event of a form when the control with focus is inspected to see if it has changed.

It is checked during the CLEAR and CLOSE events to see if it has been set and an “Unsaved Changes” warning issued to the user if so.  Most of the time this system works quite well, but (as anyone who has spent several years working with OI systems knows) sometimes it gets triggered when you least expect it, and you’re left with no clue as to why.

To help with this situation the next version of OpenInsight introduces SAVEWARN tracking, so you can see which parts of the system update the SAVEWARN property and when they actually do it. In previous versions the system updated the SAVEWARN flag directly (it’s a simple variable in the “window common area”) but this has been changed to use the Set_Property function so it can be monitored effectively from a single point.

To track SAVEWARN you have two choices:

  • Use the SYSMSG event
  • Use the System Monitor


Using the SYSMSG event to track SAVEWARN

Every time SAVEWARN is set a standard SYSMSG event is raised with a SAVEWARNINFO code; the system itself does nothing with this message, but it’s there for you to use if you wish.  This option is probably more suited for run-time tracing as it’s something you could add to your applications easily if you needed to.

The PS_EQUATES insert record defines the SAVEWARNINFO message number that you can intercept:

equ SYSMSG_SAVEWARNINFO$ to 21  ; // Save warn has been changed - null msg

The Auxiliary parameter passed to the  SYSMSG event contains information that describes why the SAVEWARN property was changed.


Using the System Monitor to track SAVEWARN

The SetDebugger() function has been updated to support a new method called “SAVEWARN” that enables SAVEWARN tracking so that changes are displayed in the System Monitor.  This option is probably more suited to development use rather than run-time.

From the System Monitor execute:

setdebugger savewarn 1

to turn on tracing, and:

setdebugger savewarn 0

to turn it off.


SAVEWARN tracing in the System Monitor

SAVEWARN tracing in the System Monitor

Setting the SAVEWARN property

If you wish to set SAVEWARN yourself you may use the “index” parameter to pass a description for the change, so this can be picked up in any tracing scenario like so:

Call Set_Property_Only( @Window, "SAVEWARN", TRUE$, "From My Stuff" )

This description is then passed in the Auxiliary parameter of the  SYSMSG event as noted above.


Hopefully you will find this facility useful if you ever suffer from problems with SAVEWARN in the future.

The System Monitor – Part II

In a previous post we looked at some the enhancements to the version 10 System Monitor to make it a more user-friendly tool.  However, one of the features we didn’t mention was the addition of a Basic+ property API so you can interact with it from your own programs and tools if you wish.  This API is exposed via the new SYSTEMMONITOR object, which supports the following properties:

  • SIZE
  • TEXT

And the following method:

  • RUN

HANDLE property

This property returns the window handle (HWND) of the System Monitor window.

RESULTS property

This property returns the contents of the results edit box in the System Monitor.

SIZE property

This property gets and sets the size and position of the System Monitor window.  It has the same format as the normal OpenInsight WINDOW SIZE property.

TEXT property

This property gets and sets the caption text of the System Monitor window.

VISIBLE property

This property gets and sets the visibility of the System Monitor window.  It has the same format as the normal OpenInsight WINDOW VISIBLE property

RUN method

This method executes a system monitor command.

(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).

The System Monitor

One of the most critical components of the Presentation Server is the System Monitor – as well as providing a simple command line interface to your forms and Basic+ Stored procedures, it is also responsible for a lot of hidden message processing and routing, such as providing the underlying framework that implements the IDLEPROC property and the POST_EVENT function.  It’s always there, even when you think you’ve closed it.

Needless to say it’s also the first part of the Presentation Server that gets written, and while the existing System Monitor is quite basic (it hasn’t been changed for many years) we’ve taken the opportunity with OI v10 to make it a bit more powerful and user-friendly.

Here’s a brief overview of the changes we’ve made:

  • It remembers it’s position and size between sessions.
  • It remembers a list of the last 100 executed commands between sessions.
  • Commands are no longer executed when scrolling through the dropdown – they are executed when the Enter key is pressed.
  • The font is set to “Consolas” with a fall-back to “Courier New”, which is hopefully easier on the eyes than the ugly “System Font” and allows more information to be seen.
  • The results editbox is read-only and results are only appended to existing text.
  • The command line supports the TCL-style “.number” syntax to execute a previously executed command (e.g. “.1”, “.2” etc).
  • Entering “RUN” before the name of a stored procedure is optional.
  • Any command entered that is not recognized is assumed to be the name of a stored procedure and is executed as such.
  • The command line parser has been improved – quotes and commas used to define arguments are now optional (like TCL).
  • The command line supports “AutoComplete” functionality.

We’ve also added the following commands:

  • ABOUT – Displays version information.
  • CFG – Displays the information parsed from the RXI file loaded at startup.
  • CLL – Clears the drop down list of previous commands.
  • CLS – Clears the results editbox.
  • EM – Shorthand for the “Exec_Method” stored procedure.
  • CMD – Opens the Windows command prompt window.
  • GC – Executes a Basic+ GarbageCollect operation.
  • GP – Shorthand for the “Get_Property” stored procedure.
  • LIST – Executes the command as an RLIST “LIST” statement.
  • LOGTO – Closes the current OpenInsight application and opens another one.
  • QUIT – Shuts down the Presentation Server
  • OFF – Same as QUIT (for TCL fans)
  • SHL – Executes an OS file/document via the Windows ShellExecute() function.
  • SP – Shorthand for the “Set_Property” stored procedure.

Be sure to let us know if there’s any features you’d like to see added to the System Monitor, but be advised that requests for full TCL compatibility will be ignored!

OI10 System Monitor

[Edit: 14 Jan 13 – Added CLL command and AutoComplete note]

[Edit: 24 Apr 13 – Call_Method renamed to Exec_Method]

(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).