Copyright: Visual Help Copyright® 1993 Firas Bushnaq


TResourceMeter Component

Properties

Events

The resource meter component makes resource monitoring a snap.  Set the resource type to monitor and the rest is automatic.  You can even trigger an event handler when a resource falls below a specified level.


Properties

Enabled

Interval

LowLimit

Note:

This component descends from TGauge.  Other inherited properties not specific to resource monitoring are not discussed here.  Consult on line help for TGauge properties.


Enabled Property

Description

This is the standard enabled property available to almost every Delphi component.  Setting this property to false at runtime disables the monitoring of free resources.


Interval Property

Description

The interval property specifies how often the resources are monitored.  The default value is 1000, which corresponds to 1 second intervals.

Example:

ResourceMeter.interval := 2000; {monitor every 2 seconds}


LowLimit Property

Description

If the LowLimit property is set to a value greater than zero, the LimitNotify event handler is fired when resources of the specified type for the component fall below the Lowlimit amount.  You can attach code to this event handler to notify the user of the condition, exit the program or whatever is appropriate in low resource situations.

See Also:

LimitNotify Event

Example:

ResourceMeter1.LowLimit := 30;


LimitNotify Event

Description

The LimitNotify event can be used to notify the user that resources have fallen below a specified amount.  The event attaches two parameters, Percnt which indicates the current free resource percentage, and disable.
When the event is fired, disable is true.  If you want to discontinue monitoring the resource after your event handler code executes, set disable to true.

Example:

procedure TDemoResources.ResourceMeter1LimitNotify(const Percnt: Integer;
  var disable: Boolean);
begin
     disable := true;
     showmessage('out of resources');
end;


ResourceType Property

Description

There are three types of system resources which can be monitored:

1	System Resources

2	GDI Resources

3	User Resources

The ResourceType property corresponds to one of these three types of resources.  The valid property settings are:

•	rtGDI   (the default)

•	rtSystem

•	rtUser


rtGDI

GDI resources will be monitored by the component.


rtSystem

System Resources will be monitored by the component.


rtUser

User Resources will be monitored by the component.