tPack Enhancements
Visual Components (TControls)
- TtpToolButton
The TtpToolbutton when placed on a TtpToolBar autosizes itself the the
width of it's caption and is automatically positioned with consistent
spacing (optional leading space and minimum width). This release sees it
enhanced in that it will now automatically replace it's caption with a glyph
from your exe. This allows you to conserve memory as glpyhs can be
bound into your program through resource file, consuming memory just
once, then become part of the button when the form containing that
button loads. To use this new feature, prefix the button's hint with the
name of the resource. This is case-insensitive and looks like this:
HINT=EDIT~Edit the file
the '~`' character delimits the hint. In
case the resouce 'EDIT' is not part of the EXE, the button will retain it's
design-time caption. If the resource is found, the buttons adjusts to
contain it, and the caption is cleared (this will change when we switch to
cool-buttons.) In either case, the part before the '~' is stripped from the
hint so as to not interfere. To maintain compatibility with existing hints,
nothing will happen if the part before the '~' is blank or contains spaces.
Added CaptionUpDown property which accepts a string in the format
of "upcaption;upglyph|downcaption;downglyph" and through an
overridden on-click handler updates either the caption or the glyph when
the button's up/down state changes. This property is in addition to the
Hint enhancements and only affects what happens when you change the
state of the button. It is not used when the button is loaded (although
perhaps it should be.. i defered that decision to later)
- TTpMemo -- THTMLmemo, TIniMemo
Now has a font-selection verb that ripples into the right-click popup
menu. Programmatically use procedure PickFont;
. Popupmenus
applied to a TtpMemo will no longer replace the built-in popup. The
code internally prepends your menu to the built-in menu to keep it's
choices available. This is done through ucpopup.pas which like
TtpMemo is part of tPack. Full source code is of available of course.
All Ttpmemo's (which feature loading and saving of files through filename
property and a Save method) now produce .BAK files by default.
- TTextGrid
Like TtpMemo, the ever more powerful Ttxtgrid class now gives you
access to a 'persistent' popup menu that allows you to set fonts and
review properties. The font property will adjust the DefaultRowHeight
and rescan the Columnwidth.
- Added property AbsorbSlackCol to let one specify the column to
absorb any slack space that would otherwise make the table less
than full width wide. The column will be adjusted when running
ScanColumnWidths or ScanColumnWidth(Value:longint); The
Value must be from 0 (no action), 1..ColCount;
- Added property DataColumns: Integer to control how many
columns of data to save/load through the RowAsValue property.
This property must be set if you are using RowAsValue, or any
of the eight load/save functions. Initialize DataColumns to a large
number if you are unsure about how many columns of data you'll
be loading, then check and set it to a proper maximum value. It's
not important that it's value corresponds to the true maximum
number of columns, but if it is less than that, you'll be saving fewer
columns than you actually have. The intent behind the property is
to let you save grids as values that contain more columns of data
than are actually show throught the ColCount property.
- TtpStatusBar -- Speed Improvements
The Statusbar was subtly improved in a number of important ways:
Component Updates can now be suppressed from appearing on the
statusbar through a global var in tpAction.pas:
var QuietStatusPanel:Boolean=false;
this var is managed for
you when dynamic pages are produced and this alone should shave
~10ms of the per page times.
Application wide hints and the statusbar can coexist peacefully now with
the Hints no longer clearing the last status from view. To take advantage
of that use code like this:
Non-Visual components (TComponents)
- TtpFileChange: new component
TtpFileChange encapsulates the windows api for file change
notifications. It provides an OnFileChange event that's triggered for
specifyable changes in a directory/tree and is 'bulk-delete-friendly' as it
provides for a configurable, optionaly delay period during which it will let
additionaly change notifications go by without needlessly triggering the
change event. This helps avoid redundant directory scans.
- TFormRestorer and Property Editors
Small changes were made in the Editor Dialogs that prevent the
redundant storage of setup information. Setting will now be remembered
consistently and be stored in tpack.ini
- TIniFileLinkData, TIniFileLink
Added TrueBooleanValue and TrueBooleanEntry properties to make it
easier to code restoring boolean values from ini files where you want the
default value to be true instead of false. A TrueBooleanEntry['x'] will be
true if there is no entry in the ini file.
- TtpSystemPopup
Enhanced the TtpSystemPopup component to allow adding addtional
menu items from other forms. This allows you to keep the app's
mainform as we ship it while adding items to the system menus from
details forms as they are initialized. To use call the Systempopup's
AppenmenuItems proc passing in a 'local' popup menu, then call
synchronizemenus.
procedure AppendMenuItems(Sender:TPopUpMenu);
procedure SynchronizeMenus;
Forms
- TutMainFm
The Main Form's panel creation mechanism now parents pagecontrols
inside a tPanel in order to leave space around the borders.
- Specifying Panel position
recap: any app using a TutMainForm derivative as the application's main
form will automatically create tabbed user interfaces using all forms
derived from TutParentForm. The UI is assembled by calling
<fMainForm>.Init from the DPR and Tab Names are based on Form
Captions. You can override any form caption from the .DPR and the
system will automatically nest things to two levels
This build introduced the capability to position a swapped in form
anywhere in it's target page control. set the Caption to 'caption[x]' where
x is an integer from 0..pages-1. After the Init has run, your swapped in
form will appear in the proper position.
- TutPanFrm
added code to enable the panels to pop-out into their original forms
while managing the caption and automatic saving and loading of position
and 'popped-out' status. You can take advantage of this too by simply
setting the 'pa' panel's DragMode to dmAutomatic and it's cursor
property to crDrag. That's all there is to it and you'll have the same smart
alec panels as the hub's now featuring.
- TutSplitFM
Panels used to split forms can now have an OnEndDrag event. this is
used inside webhub to trigger a Grid.ScanColumnWidhts which has the
effect of having the grid adjust itself to the new width, removing
scrollbars that might otherwise appear
Forms, Components and built-in
Command-Line options
I'm breaking out to command-line options supported by the tPack base forms
and components into this section because they inter-relate and should be
discussed together.
The Application base form respects all windows startup options including the
SW_HIDE option. Through the commandline you can control if you want the
form to start minimized (/Min or /Minimized) or if you want the form to be
hidden on startup (/Hide).
The Tray level which introduces the support for a tray icon respects the /Tray
and /NoTray switches. To make a tray enabled form that starts in the tray,
make sure the TrayIcon.Enabled property is set to true. If it's true, your exe
will start in the tray without the form visible (Start the app with /NoTray to
make it act normally). Conversely, if the default is False, the form will act
normally and only go into the tray when you provide the /Tray switch.
Regardless of how the app went into the tray, you might still want your app to
start with the main window visible. For that case you will need to set the
TrayIcon.RestoreOnLoad property to true or supply the /Restore switch
on the command-line. An application compiled with the RestoreOnLoad
property set to true will respect the /Min and /Minimized switches. While this
sounds and is confusing, the idea is to provide you with the full matrix of
tray/non-tray, restored/park, minimized/normal/hidden possibilities through a
few properties and commandline settings.
The /Hide switch overrides the /Tray switch and the TrayIcon.Enabled
property. e.g. if /Hide is supplied to the exe it will simply be invisible for as
long as it is not explicitly restored. Use UcWinApi's ActivateWindow function
like this ActivateWindow('TApplication','<ExeNameNoExtension>'); to
make an application that has been started invisible visible again. A Mainform
started with /Hide will also hide itself again when you minimize it after restoring.
To stop this behaviour simply change Delphi's CmdShow global variable to
something other than 0, or set Application.OnMinimize to nil.
As if this was not enough, the ucOnce unit has been extended to offer /Quit
functionality. from the commandline, call your app a second time with /Quit,
and the first instance will shut down.
See the WebHub Class Library notes for information about webhub specific
switches.
Utility code
- ucPopUp
- procedure InsertPopupMenu(Source,Target:tPopupMenu)
now performs a 'deep copy' of menu items that includes all nested
menus.
- procedure CopyMenuItems(Source,Target:TMenuItem)
added. recursively copy between menu items.
- ucString
- function MergeStrings(const
List1,List2:String;Delim:Char):String;
works in conjunction with AddToString and IsIn. Merges Delim
seperated items contained in the strings into the result string.
- function SubtractStrings(const
List,Minus:String;Delim:Char):String;
use to remove items listed in 'minus' from items listed in 'list'.
- function RelativeFileName(const
Path,FileName:String):String;
returns a filename relative to the path (capable, but not 100%
finished)
- function ConCatPath(const Path,FileName:String):String;
concatenates a base path and relative filename into something
smart looking. used by the Edit Files Editor, for example.
- function SplitAtAnyChar(Input:String;const
Delimiters:String; var Left,Right:String):Boolean;
splits a string at any of the supplied delimiters and keeps the
delimiter as the first char of the rightmost string.
- uCode
- moved function HaveParam(const Value:String):Boolean;
from tpTrayIc
(it checks for the presence of an arbitrary string on the
commandline)
- added function ParamValue(const Key:String; var
Value:String):Boolean;
which also checks for the presence of a commandline parameter
but can also return a Value supplied by the user. It correctly
parses parameters in the form of {/,-}<key>[{:,=}[Value]] e.g. it
undestands " /ID:AppID -ID=max /ok " etc.
- procedure Pause;
process messages WITHOUT getting your app involved. useful
when you're waiting for an external program to finish without
wanting the user to be able to trigger things inside your app. use
instead of application.processmessages.
- ucWinApi
added procedures to activate and terminate running and non-running
applications. Example.
- function
ActivateWindow(ClassName,Caption:PChar):Boolean;
Brings an app to the front, restores a tray or iconized window,
returns true if it was running.
- function
TerminateWindow(ClassName,Caption:PChar):Boolean;
Terminates an application, returns true if it was running.
- function InvokeModule(Command:PChar): Boolean;
Wrapper for the CreateProcess API, returns true if app was
started.
- function
ActivateModule(ClassName,Caption,Command:PChar):Boolean;
Calls ActivateWindow, then InvokeModule.
- function WinPath:String;
returns the path to the windows directory
- function WinSystemPath:String;
returns the path to the windows system directory
- ucPrint
new unit containing
- SelectPrinterByName(const Name:String); routine to select the
active printer by name
- utRegis
new unit containing TtpRegistry, a TRegistry derivative that has
- procedure GetSectionValues(List: TStrings); adds the
name=value pairs from the current key to the list.
- ucOnce
Added support for /Quit parameter to shut down prior instances of your
app. (add this unit at/toward the top of your dpr's uses list for the
quickest response)
Name Changes
- tpIpcObj -> utIpcObj
- tpThread -> utThread
tPack Naming Conventions
- tp... tPack Components
- ut... tPack utility types (class definitions)
- uc... tPack utility code (procedures and functions)
- anything else is either a component or form where the name is a leftover
from the 1.0 release