SSI Solution Pack Tips,Tricks and FAQ
NOTE: Please be sure to download the latest SSI Solution Pack patches
(if available) before you read on.
---------------------------------------------------------------
Q. With what compilers can I use SSP?
A. SSP can be used with Delphi versions 3,4,5,6, and 7. There are some
limitations in Delphi 3 due to the fact that Delphi 3 is a rather
old compiler and does not provide some of the neat features for
SSP to use.
-----------------------------------------------------------------------
Q. Is it possible to hide the individual cells at runtime in TSpLayout?
That is a show stopper for me.
A. You can do it if you use some imagination. Try this simple trick:
Drop a panel in the cell before any other components. Set its Align
property to alClient. The panel will fill up the cell. During design
time remove the caption of the panel, and bevels. Drop your controls,
for example, a couple of text labels or buttons on top of the panel.
At run time you can use the following code:
To Hide the cell and your controls:
Panel1.BringToFront;
To Show the cell and controls:
Panel1.SendToBack;
-----------------------------------------------------------------------
Q. I have an application with a TSpTrayIcon component. I would like the
main application icon disappear, leaving only the tray icon visible,
when I click on my main form's Minimize button. And why this is not
done automatically?
A. The reason why it is not done automatically is that the TrayIcon is
not linked to the main form in any way. One application can have many
tray icons, for example, and the programmer may or may not want the
main application icon to go away. All depends on the application and
probably it would be wrong to limit the user of the component to a
default behaviour.
If you want to make the main icon disappear on minimize you can do the
following:
1. Add the following declaration to your main form. You can put it
into "private" section of the form:
private
{ Private declarations }
procedure MyMinimize(Sender: TObject); // <=== ADD THIS LINE
2. Add the following code to your implementation section:
procedure TForm1.MyMinimize(Sender: TObject);
begin
Visible := FALSE;
end;
//(we assume that you use the default "TForm1")
3. Add the following code into your form's FormCreate event handler:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMinimize := MyMinimize;
end;
You are done! When you minimize your app the main icon will disappear.
Of course, you need to set Visible to true when you double click on the
tray icon, or click on the tray icon. This part depends on the
implementation.
If you want to leave the app running when the user clicks on the close
button of the main form, then you similarly have to modify the events
on close query. The whole thing gets even simpler:
procedure TForm1.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
Visible := FALSE;
CanClose := FALSE;
end;
-----------------------------------------------------------------------
Q. I've heard that cardiovascular exercise can prolong life. Is this true?
A. Your heart is only good for so many beats, and that's it. Everything
wears out eventually. Speeding up your heart will not make you live
longer; that's like saying you can extend the life of your car
by driving it faster. Want to live longer? Take a nap.
-----------------------------------------------------------------------