📄 dfsstatusbar.txt
字号:
in the Delphi Help, FormatDateTime function. You can leave this property
blank, and the user's short date format setting will be used.
property TimeFormat: string;
For use with sptTime, sptTimeDate and sptDateTime PanelTypes. This property
has no meaning for any other panel types. Use the same format as described
in the Delphi Help, FormatDateTime function. You can leave this property
blank, and the user's long time format setting will be used.
property Enabled: boolean;
Whether the panel should be enabled or not. Disabled panels are blank. The
one exception to this is sptOwnerDraw. The OnDrawPanel event fires
regardless of the Enabled state, that way you can draw it however you like
based on the Enabled property.
property Hint: string;
Hint text to be displayed for the panel. If blank, the hint text displayed
will be the bar's hint (if any). For sptEllipsisText and sptEllipsisPath
panels, the hint will be the full value of Text if this value is set to
'...'. You can override the value of this property by using the OnHintText
event (see below).
property BorderWidth: TBorderWidth;
Use BorderWidth to specify how wide the border around the panel should be.
A value of 0 means no border should appear. The border of a panel is the
area between the outer shading rectangle and the data that apears within.
property Text: string;
The text to display in the panel. For some panel types, this is controlled
automatically (sptCapsLock, sptDateTime, etc.). For sptGlyph, text is
displayed to the right of the glyph (if there is any text), except for
right justified panels which display text to the left of the glyph.
property OnDrawPanel: TDFSDrawPanelEvent;
This event fires when the panel needs to be redrawn, and PanelType is
sptOwnerDraw. Note that TDFSStatusBar also has this event and it fires for
any panel that needs to be drawn. This event is intended for seperating out
owner drawing code into events tied to a single panel, rather than having
one big event that has to know how to draw every panel.
property OnHintText: TDFSPanelHintTextEvent;
This event fires when hint text is being retrieved for the panel. When the
event handler is entered, the current hint text, if any, will be in the
HintText parameter.
Implementation Notes:
---------------------
* For owner draw panels (sptOwnerDraw PanelType), the status bar's OnDrawPanel
event fires first, and then the individual panels' OnDrawPanel events are
fired. You can paint the panels in whichever handler you prefer.
* The lock indicators (caps, scroll, num) operate by using a windows hook
(SetWindowsHookEx). Every effort has been made to reduce the impact this
will have on the user's system. The hook is only active if it is needed
(there are indicator panels), and only if the panels are enabled. If
multiple indicators exist (even across multiple status bars), there is still
only one hook installed, not one hook for each. The hook is active for the
thread that contains the status bar, not system wide, if UseMonitorDLL is
false; otherwise, the hook is system wide. Setting UseMonitorDLL to false
will lessen the impact on the user's system, but it has the side effect of
causing the indicators to function only within the thread. That is, if you
switch to another app and change the Num Lock, it will not be reflected
until you switch back. Also, if UseMonitorDLL is set to true, the
DFSKbMon.DLL is required to be present on the system.
* If you will be using the UseMonitorDLL property, you must include the
monitoring DLL with your application. It is strongly suggested that you
rename the DLL to something specific to your app so as not to conflict with
any others that may be on the users' system. If you do rename the DLL, you
need to add a line of code to your main form's or project source (DPR) file
like this:
DFSKbDLLName := 'MyMonitorDLL.DLL';
You will also need the DFSKb unit in the uses clause for this to compile.
You can include path information, but it is not necessary if the DLL will
be in the system path or in the app's directory (suggested). If
UseMonitorDLL will never be set to true, you can ignore this DLL and it will
NOT be needed by applications using TDFSStatusBar.
* The sptDate, sptTime, sptTimeDate, sptDateTime, and sptGauge
(GaugeAttrs.Style = gsIndeterminate only) panels require the use of a timer.
Every effort has been made to be conservative with the resources, however.
The timer is only created when there is a panel that needs it, and then only
if the panel is enabled. The timer is shared across all panels on a status
bar that need it, so if you have a sptDate, sptTime and
sptIndeterminateGauge on a status bar, there is still only one timer active.
Also, the interval of the timer event firing is adjusted according to what
kind of panels need it. That is, if you have a sptTime and a sptDate panel,
the timer will fire once per second. But, if you have only a sptDate (or
you disable sptTime), the timer interval is adjusted to fire less often.
* Collection properties (i.e. TDFSStatusPanels) don't have a built-in Object
Inspector interface in Delphi 2 or C++Builder 1. I'm really screwed here
because I DON'T want to write a big monster property editor for all of the
TDFSStatusPanel class just for D2/C1. During beta testing, no one
complained about this, so I have decided not to do it. If enough people
ask for a D2/C1 version, I will reconsider.
Known Issues:
-------------
* Key lock indicators don't get updated correctly when they are changed from
outside the app. That is, if you change the state of the caps lock from
Notepad and then switch to the app with the statusbar, it does not update to
show the new state. As best I can tell, this is a problem at the Windows
API level; more a design flaw than a bug. GetKeyState (which is used to
find the toggled state of the indicator keys) is only updated as a thread
reads key messages from its queue, it does not actually go out and find out
what the real state is. GetAsyncKeyState will go find the real state of
the key at the time of the call, but it will not return any information
about they toggled state; only up/down state and whether it has changed
since the last time it was called. I experimented with using
GetAsyncKeyState when the app was deactivated and activated and checking to
see if the key state had changed, but there are problems with that as well.
GetAsyncKeyState seems to be system-wide, so it's only going to tell you if
the key state has changed since the last time ANYTHING called it, not just
your app. The best I can do is force the indicator panels to update when
a key is pressed after the app is deactivaed and then activated again. The
really strange part of all this is that it only happens if you use Alt-Tab
to task switch. If you switch apps using the mouse, it works fine. In my
defense, I offer this: MS WordPad has this same bug. :) This only applies
if UseMonitorDLL is false. If using the system wide hook (the DLL), the
indicators are monitored in every process, so the problem does not occur.
Revision History:
-----------------
1.24: + Updated for Delphi 6 compatibility. See updated install directions
above.
1.23: + Updated for C++Builder 5 compatibility.
1.22: + Fixed problem with taLeftJustify panel Alignment when used with the
last panel on a status bar.
+ The resize grip will now draw in the same color as the status bar.
Before, it would only draw in clBtnFace (system) color regardless of
what color the rest of the status bar was. Thanks to Eric Bole-Feysot
for sending me this code from a Usenet post.
1.21: + sptDate, sptTime, sptDateTime, and sptTimeDate PanelTypes no longer
store the value of the Text property in the form file. There was no
reason to store them, and one user reported it actually causing a
problem although I couldn't duplicate it.
1.20: + Added new panel type, sptTimeDate, and changed behavior of sptDateTime.
Now, sptDateTime shows the date and time in that order. sptTimeDate
shows it in time/date order. If you had panels of sptDateTime type,
you might want to change them to sptTimeDate. sptDateTime was added by
Lars Black because it is often displayed that way where he's from.
+ Added BorderWidth property to panels. See docs above.
+ sptGlyph panels now support text. See docs above.
1.12: + It's *really* D5 compatible now. Small change between the D5 eval
version and the real, shipping D5 version broke it.
1.11: + D5 compatibility.
1.10: + Added a new panel style gsIndeterminate2, and added three new GaugeAttrs
properties: Color, TextColor, and Speed. See documentation above.
This is based on code sent to me by David Wright. Many thanks to him
for sharing.
+ Font.Color property was not honored.
1.01: + Right aligned text would draw right up to a panel's shadow. It now
keeps a 1 pixel border between the text and the shadow.
1.00: + Initial public release
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -