Creating a plugin from scratch with tsxFactory is very easy. It may seem a little complicated from the steps below, but only because we've tried provide all the details.


MainForm := TMainForm.Create(Application);
I like to add this line to the initialization section of my main form. If you prefer, you could instead add this command to the application's .PAS file.
Now my Main.pas unit looks like this:
unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, tsxPlug; type TMainForm = class(TTsOwnedForm) Tsx1: TTsx;
private { Private declarations } public { Public declarations } end; var MainForm: TMainForm; implementation {$R *.dfm} initialization MainForm := TMainForm.Create(Application); end.
Select the Tsx component on your form, and use the Object Inspector to create an event for OnLeftClick. This event will fire when the user clicks your plugin icon with the left mouse button. Add the following code to the event:
procedure TMainForm.Tsx1LeftClick(var plugStyle: Integer); begin if WindowState = wsMinimized then WindowState := wsNormal; if Visible then Hide else Show; end;The above code is just a simple example that will show or hide the main window in response to clicks on the plugin icon. By changing the code in this event, you can create any behavior you like.
trueSpace gets the plugin name (aka, help string) and bitmap image from the resources stored in the TSX (tsxFactory includes a default bitmap and plugin help string). To replace the default resources, do the following steps.
STRINGTABLE DISCARDABLE BEGIN 0 "My TsxFactory Plugin" END 100 BITMAP Tsx.bmp
Copyright © 2001 Primitive Itch