Simba Code:
{==============================================================================)
[ SPL - Simba Presentation Library ]
[ version 1.0 ]
[------------------------------------------------------------------------------]
[ ]
(==============================================================================}
{ SSRLers! Currently what is not implemented are the following:
* SPL_EnableNonButtonEventHandlers (in fact, no events of any kind yet!)
* SPL_UseLapeOptionalParametres (no need, yet!)
* SPL_MultipleForms (this is already enabled by default. Atm, not defining this will make no difference)
Enjoysies! :D }
{$Define SPL} // Using SPL?
{$Define SPL_Prefix} // Prefix all user-editable identifiers with SPL_?
{$Define SPL_DisplayErrors} // Output errors.
{$Define SPL_CheckForUpdates} // Check for updates to the SPL library?
{$Define SPL_EnableNonButtonEventHandlers} // Enable OnClick/OnChange support for events for controls other than the TButton?
{$Define SPL_UseLapeOptionalParametres} // Enable Lape optional parametres?
{$Define SPL_MultipleForms} // Enable support for multiple form creation?
{$Define SPL_StringIdentifiers} // Use strings as identifiers for controls?
{$Define SPL_Unicode} // Enable Unicode support.
{$ifDef Windows}
{$ifDef Windows8}
const CRLF = #$D;
{$else}
const CRLF = #$D#$A;
{$endIf}
{$else}
const CRLF = #$D;
{$endIf}
const
// DNU prefix == DO NOT USE (i.e. not recommmended to call them inside your scripts)
DNUSPL_FullName = 'Simba Presentation Library';
DNUSPL_Acronym = 'SPL';
DNUSPL_Version = 0.01;
{$ifDef SPL_Prefix} SPL_ERR_RangeCheck = $1; {$else} ERR_RangeCheck = $1; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_Unassigned = $2; {$else} ERR_Unassigned = $2; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_InvalidIdentifier = $4; {$else} ERR_InvalidIdentifier = $4; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_InvalidTabControl = $8; {$else} ERR_InvalidTabControl = $8; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_InvalidTabPage = $10; {$else} ERR_InvalidTabPage = $10; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_InvalidParent = $20; {$else} ERR_InvalidParent = $20; {$endIf}
{$ifDef SPL_Prefix} SPL_ERR_InvalidLength = $40; {$else} ERR_InvalidLength = $40; {$endIf}
DNUSPL_Err_Str_PrependText = '[' + DNUSPL_Acronym + '][ERROR] %s, Form %u: ';
DNUSPL_Err_Str_ImplicitCast = '[' + DNUSPL_Acronym + '][WARNING] %s, Form %u: Implicit cast made with identifier "%s" down to "%s".';
DNUSPL_Err_Str_RangeCheck = DNUSPL_Err_Str_PrependText + 'Out of range.';
DNUSPL_Err_Str_Unassigned = DNUSPL_Err_Str_PrependText + 'Unable to validate controls existence';
DNUSPL_Err_Str_InvalidIdentifier = DNUSPL_Err_Str_PrependText + 'The control with identifier "%s" does not exist.';
DNUSPL_Err_Str_InvalidTabControl = DNUSPL_Err_Str_PrependText + 'The tab control with identifier "%s" does not exist.';
DNUSPL_Err_Str_InvalidTabPage = DNUSPL_Err_Str_PrependText + 'The tab with the caption "%s" does not exist.';
DNUSPL_Err_Str_InvalidParent = DNUSPL_Err_Str_PrependText + 'Invalid parent control "%s".';
DNUSPL_Err_Str_InvalidLength = DNUSPL_Err_Str_PrependText + '"%s" does not have the same length as "%s".';
DNUSPL_ComponentPrecede = 'frm' + #$5f;
{$ifDef SPL_Prefix} SPL_COMP_TabSheet = 0; {$else} COMP_TabSheet = 0; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_Tab = 1; {$else} COMP_Tab = 1; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_Button = 2; {$else} COMP_Button = 2; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_TextBox = 3; {$else} COMP_TextBox = 3; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_DropDown = 4; {$else} COMP_DropDown = 4; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_Text = 5; {$else} COMP_Text = 5; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_Picture = 6; {$else} COMP_Picture = 6; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_CheckBox = 7; {$else} COMP_CheckBox = 7; {$endIf}
{$ifDef SPL_Prefix} SPL_COMP_MemoBox = 8; {$else} COMP_MemoBox = 8; {$endIf}
type
Float = Extended;
TString = {$ifDef SPL_Unicode} UnicodeString; {$else} AnsiString; {$endIf}
TProcedure = procedure;
TFormRect = record
X, Y: Integer;
Width, Height: Word;
end;
TEventHandler = record
Name: TString;
ProcToCall: TProcedure;
end;
var
DNUSPLComponentCount: Word;
DNUSPLFormCount: SmallInt;
DNUSPLLastError: Cardinal;
DNUSPLForms: array of TForm;
DNUSPLProcArray: array of TEventHandler;
function Rect(const X, Y, Width, Height: Integer): TFormRect;
begin
Result.X := X;
Result.Y := Y;
Result.Width := Width;
Result.Height := Height;
end;
// Ensures Pascal identifier validity.
// identifier = letter | underscore { letter | digit | underscore }
function SPL_Trim(const Str: TString): TString;
var
I, strLen: Integer;
tmpOrd: Byte;
begin
strLen := Length(Str);
for I := 1 to strLen do
if(not(Str[I] = #32)) then
begin
tmpOrd := Ord(Str[I]);
if(InRange(tmpOrd, 65, 90)) then
Result := Result + Chr(tmpOrd + 32) else
if(InRange(tmpOrd, 97, 122) xor (tmpOrd = 95) xor ((InRange(tmpOrd, 48, 57){ and not(I = 1)}))) then
Result := Result + Str[I];
end;
end;
// Rather self-explanatory.
function {$ifDef SPL_Prefix} SPL_GetLastError {$else} GetLastSPLError {$endIf}: Cardinal;
begin
Result := DNUSPLLastError;
end;
// Find's all components and free's them when a form wants to close.
procedure DNUSPLOnFormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
I: Integer;
begin
CanClose := False;
for I := 0 to (TForm(Sender).ComponentCount - 1) do
TForm(Sender).Components[I].Free;
CanClose := True;
end;
// Unsafely creates a form.
function DNUSPL_CreateForm(const X, Y, Width, Height: Integer; const ACaption: TString; const ABorderStyle: TBorderStyle): Integer;
begin
Inc(DNUSPLFormCount);
SetLength(DNUSPLForms, DNUSPLFormCount);
SetLength(DNUSPLProcArray, DNUSPLFormCount);
Writeln(DNUSPLFormCount);
DNUSPLForms[DNUSPLFormCount - 1] := TForm.Create(nil);
DNUSPLForms[DNUSPLFormCount - 1].SetBounds(X, Y, Width, Height);
DNUSPLForms[DNUSPLFormCount - 1].ClientWidth := Width;
DNUSPLForms[DNUSPLFormCount - 1].ClientHeight := Height;
if((X = 0) and (Y = 0)) then
DNUSPLForms[DNUSPLFormCount - 1].Position := poMainFormCenter;
DNUSPLForms[DNUSPLFormCount - 1].BorderStyle := ABorderStyle;
DNUSPLForms[DNUSPLFormCount - 1].Caption := ACaption;
DNUSPLForms[DNUSPLFormCount - 1].OnCloseQuery := @DNUSPLOnFormCloseQuery;
if(Assigned(DNUSPLForms[DNUSPLFormCount - 1])) then
Result := DNUSPLFormCount - 1 else Result := -1;
end;
function DNUSPL_ShowForm(const AForm: Integer; const APauseScript: Boolean): Boolean;
begin
Result := False;
if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['DNUSPL_ShowForm', AForm])); {$endIf}
DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
Exit;
end;
if(APauseScript) then
Result := DNUSPLForms[AForm].ShowModal = mrOk
else begin
DNUSPLForms[AForm].Show;
Result := DNUSPLForms[AForm].Showing;
end;
end;
function DNUSPL_AddControl(const AControlType, AForm: Integer; const ABounds: TFormRect;
const AAdditionalParametres: TVariantArray; {$ifDef SPL_StringIdentifiers}
const AParent, AIdentifier: TString{$else}const AParent: Integer{$endIf}):
{$ifDef SPL_StringIdentifiers} Boolean{$else}) Integer{$endIf};
var
tmpControl: TControl;
parentControl: TWinControl;
tmpParentd{$ifDef SPL_StringIdentifiers}, tmpIdentd{$endIf} : TString;
paramsLength, I: Word;
begin
{$ifDef SPL_StringIdentifiers} Result := False; {$else} Result := -1; {$endIf}
if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['AddControl', AForm])); {$endIf}
DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
Exit;
end;
{$ifDef SPL_StringIdentifiers}
tmpIdentd := SPL_Trim(AIdentifier);
if(not(tmpIdentd = Lowercase(AIdentifier))) then
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['AddControl', AForm, AIdentifier, tmpIdentd])); {$else} Null; {$endIf}
if(not(AParent = '')) then
begin
tmpParentd := SPL_Trim(AParent);
if(not(tmpParentd = Lowercase(AParent))) then
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['AddControl', AForm, AParent, tmpParentd])); {$else} Null; {$endIf}
end;
{$else}
if(not(AParent = 0)) then
tmpParentd := IntToStr(AParent);
{$endIf}
paramsLength := Length(AAdditionalParametres);
if(tmpParentd = '') then
parentControl := DNUSPLForms[AForm]
else begin
parentControl := TWinControl(DNUSPLForms[AForm].FindComponent(DNUSPL_ComponentPrecede + tmpParentd));
if(not(Assigned(parentControl))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_InvalidParent, ['AddControl', AForm, tmpParentd])) {$endIf}
Exit;
end;
end;
case (AControlType) of
{$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}:
begin
tmpControl := TPageControl.Create(DNUSPLForms[AForm]);
tmpControl.Parent := DNUSPLForms[AForm];
if(Rect(0, 0, 0, 0) = ABounds) then
tmpControl.Align := alClient
else
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
end;
{$ifDef SPL_Prefix} SPL_COMP_Tab {$else} COMP_Tab {$endIf}:
begin
tmpControl := TTabSheet.Create(DNUSPLForms[AForm]);
if(parentControl is TPageControl) then
TTabSheet(tmpControl).PageControl := TPageControl(parentControl)
else begin
{$ifDef SPL_DisplayErrors}
Writeln(Format(DNUSPL_Err_Str_InvalidTabControl, ['AddControl', AForm, tmpIdentd]));
{$endIf}
DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_InvalidTabControl {$else} ERR_InvalidTabControl {$endIf};
Exit;
end;
if(paramsLength > 0) then
tmpControl.Caption := AAdditionalParametres[0];
end;
{$ifDef SPL_Prefix} SPL_COMP_Button {$else} COMP_Button {$endIf}:
begin
tmpControl := TButton.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
if(paramsLength > 0) then
tmpControl.Caption := AAdditionalParametres[0];
end;
{$ifDef SPL_Prefix} SPL_COMP_TextBox {$else} COMP_TextBox {$endIf}:
begin
tmpControl := TEdit.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
TEdit(tmpControl).Text := '';
end;
{$ifDef SPL_Prefix} SPL_COMP_DropDown {$else} COMP_DropDown {$endIf}:
begin
tmpControl := TComboBox.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
TComboBox(tmpControl).Style := csDropDownList;
if(paramsLength > 0) then
begin
for I := 0 to (paramsLength - 1) do
TComboBox(tmpControl).Items.Add(AAdditionalParametres[I]);
TComboBox(tmpControl).ItemIndex := 0;
end;
end;
{$ifDef SPL_Prefix} SPL_COMP_Text {$else} COMP_Text {$endIf}:
begin
tmpControl := TLabel.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
if(paramsLength > 0) then
tmpControl.Caption := AAdditionalParametres[0];
if(paramsLength > 1) then
TLabel(tmpControl).Font.Size := AAdditionalParametres[1];
if(paramsLength > 2) then
TLabel(tmpControl).Font.Color := AAdditionalParametres[2];
end;
{$ifDef SPL_Prefix} SPL_COMP_Picture {$else} COMP_Picture {$endIf}:
begin
tmpControl := TImage.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
if(paramsLength > 0) then
TImage(tmpControl).Picture.Bitmap.Assign(GetMufasaBitmap(AAdditionalParametres[0]).ToTBitmap);
if(paramsLength > 1) then
TImage(tmpControl).Stretch := AAdditionalParametres[1];
if(paramsLength > 2) then
begin
TImage(tmpControl).SetBounds(0, 0, DNUSPLForms[AForm].ClientWidth, DNUSPLForms[AForm].ClientHeight);
tmpControl.SendToBack;
end;
end;
{$ifDef SPL_Prefix} SPL_COMP_CheckBox {$else} COMP_CheckBox {$endIf}:
begin
tmpControl := TCheckBox.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
if(paramsLength > 0) then
tmpControl.Caption := AAdditionalParametres[0];
if(paramsLength > 1) then
TCheckBox(tmpControl).Checked := AAdditionalParametres[1];
end;
{$ifDef SPL_Prefix} SPL_COMP_MemoBox {$else} COMP_MemoBox {$endIf}:
begin
tmpControl := TMemo.Create(DNUSPLForms[AForm]);
tmpControl.Parent := parentControl;
if(ABounds = Rect(0, 0, 0, 0)) then
tmpControl.Align := alClient
else
tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
if(paramsLength > 0) then
for I := 0 to (paramsLength - 1) do
TMemo(tmpControl).Lines.Add(AAdditionalParametres[I]);
end;
end;
{$ifDef SPL_StringIdentifiers}
tmpControl.Name := DNUSPL_ComponentPrecede + tmpIdentd;
Result := Assigned(tmpControl);
{$else}
tmpControl.Name := DNUSPL_ComponentPrecede + IntToStr(DNUSPLComponentCount);
if(Assigned(tmpControl)) then
Result := DNUSPLComponentCount else Result := -1;
Inc(DNUSPLComponentCount);
{$endIf}
end;
{$ifDef SPL_Prefix}
function SPL_DeleteComponent(const AForm: Integer; const {$ifDef SPL_StringIdentifiers} AIdentifier: TString {$else} AIdentifier: Integer {$endIf}): Boolean;
{$else}
function DeleteComponent(const AForm: Integer; const {$ifDef SPL_StringIdentifiers} AIdentifier: TString {$else} AIdentifier: Integer {$endIf}): Boolean;
{$endIf}
var
tmpControl: TControl;
tmpIdentd: TString;
begin
Result := False;
if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['DeleteComponent', AForm])); {$endIf}
DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
Exit;
end;
{$ifDef SPL_StringIdentifiers}
tmpIdentd := SPL_Trim(AIdentifier);
if(not(tmpIdentd = Lowercase(AIdentifier))) then
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['DeleteComponent', AForm, AIdentifier, tmpIdentd])); {$else} Null; {$endIf}
{$else}
if(not(AIdentifier = 0)) then
tmpIdentd := IntToStr(AIdentifier);
{$endIf}
// tmpControl := TControl({$ifDef SPL_Prefix} SPL_FindComponent {$else} FindSPLComponent {$endIf}(
// TComponent(DNUSPLForms[AForm]), AIdentifier));
tmpControl := TControl(DNUSPLForms[AFOrm].FindComponent(DNUSPL_ComponentPrecede + tmpIdentd));
if(tmpControl is TTabSheet) then
TTabSheet(tmpControl).PageControl.SelectNextPage(False, True);
//tmpControl.Parent := nil;
tmpControl.Free;
Result := (not(Assigned(tmpControl)));
end;
function {$ifDef SPL_Prefix} SPL_CreateFormEx {$else} CreateFormEx {$endIf}(
const ABounds: TFormRect; const ACaption: TString; const ABorderStyle: TBorderStyle): Integer;
var
Params: TVariantArray;
begin
Params := [ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height, ACaption, ABorderStyle];
ThreadSafeCall('DNUSPL_CreateForm', Params);
end;
function {$ifDef SPL_Prefix} SPL_ShowForm {$else} ShowForm {$endIf}(
const AForm: Integer; const PauseScript: Boolean): Boolean;
var
Params: TVariantArray;
begin
Params := [AForm, PauseScript];
Result := Boolean(ThreadSafeCall('DNUSPL_ShowForm', Params));
end;
function {$ifDef SPL_Prefix} SPL_AddTabSheetEx {$else} AddTabSheetEx {$endIf}
(const AForm: Integer; const ABounds: TFormRect{$ifDef SPL_StringIdentifiers}; const ANewIdentifier: TString): Boolean {$else} ): Integer {$endIf};
begin
Result := DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}, AForm, ABounds, [], {$ifDef SPL_StringIdentifiers} '', ANewIdentifier {$else} 0 {$endIf});
end;
function {$ifDef SPL_Prefix} SPL_AddTabSheet {$else} AddTabSheet {$endIf}
(const AForm: Integer{$ifDef SPL_StringIdentifiers}; const ANewIdentifier: TString): Boolean {$else} ): Integer {$endIf};
begin
Result := DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}, AForm, Rect(0, 0, 0, 0), [], {$ifDef SPL_StringIdentifiers} '', ANewIdentifier {$else} 0 {$endIf});
end;
function {$ifDef SPL_Prefix} SPL_AddTabsEx {$else} AddTabsEx {$endIf}(
const AForm: Integer; {$ifDef SPL_StringIdentifiers} const AParent: TString;
const AIdentifiers: array of TString; {$else} const AParent: Integer; {$endIf}
const ACaptions: array of TString): {$ifDef SPL_StringIdentifiers} Boolean {$else} TIntegerArray {$endIf};
var
I, Count: Integer;
begin
Count := Length(ACaptions);
if(Count > 0) then
begin
{$ifDef SPL_StringIdentifiers}
if(not(Count = Length(AIdentifiers))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_InvalidLength, ['AddTabsEx', AForm, 'AIdentifiers', 'ACaption'])); {$endIf}
Exit;
end;
Result := False;
{$else}
SetLength(Result, Count);
{$endIf}
for I := 0 to (Count - 1) do
begin
{$ifNDef SPL_StringIdentifiers} Result[I] := {$endIf}
DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_Tab {$else} COMP_Tab {$endIf},
AForm, Rect(0, 0, 0, 0), [ACaptions[I]], AParent {$ifDef SPL_StringIdentifiers}, AIdentifiers[I] {$endIf});
end;
end;
end;
function {$ifDef SPL_Prefix} SPL_AddTabs {$else} AddTabs {$endIf}
(const AForm: Integer; {$ifDef SPL_StringIdentifiers} const AIdentifiers: array of TString;
{$endIf} const ACaptions: array of TString): {$ifDef SPL_StringIdentifiers} Boolean {$else} TIntegerArray {$endIf};
var
I: Integer;
tmpParentd: {$ifDef SPL_StringIdentifiers} TString {$else} Integer {$endIf};
begin
if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
begin
{$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['AddTabs', AForm])); {$endIf}
DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
Exit;
end;
for I := 0 to (DNUSPLForms[AForm].ComponentCount - 1) do
if(DNUSPLForms[AForm].Components[I] is TPageControl) then
begin
tmpParentd := {$ifDef SPL_StringIdentifiers} Copy(DNUSPLForms[AForm].Components[I].Name, Length(DNUSPL_ComponentPrecede), Length(DNUSPLForms[AForm].Name)) {$else} I {$endIf};
Exit;
end;
Writeln(tmpParentd);
Result := {$ifDef SPL_Prefix} SPL_AddTabsEx {$else} AddTabsEx {$endIf}(AForm, {$ifDef SPL_StringIdentifiers} tmpParentd, AIdentifiers, {$else} tmpParentd, {$endIf} ACaptions);
end;
procedure {$ifDef SPL_Prefix} SPL_Setup {$else} SetupSPL {$endIf};
{$ifDef SPL_CheckForUpdates}
var
pageVer: TString;
tmpVer: Float;
{$endIf}
begin
DNUSPLLastError:= -1;
DNUSPLFormCount := 0;
{$ifDef SPL_CheckForUpdates}
pageVer := GetPage('http://****/srl/spl/latest_version.txt');
writeln(pagever);
tmpVer := StrToFloatDef(pageVer, -1.0);
if(not(tmpVer = -1.0)) then
begin
if(tmpVer > DNUSPL_Version) then
begin
Writeln(' *** A new ' + DNUSPL_FullName + ' (' + FloatToStr(tmpVer) + ') has been released.');
Writeln(' [' + DNUSPL_Acronym + '] Current Version: ' + FloatToStr(DNUSPL_Version) + '.');
Writeln(' - It is highly recommended that you cease this script and download it immediately.');
if(MessageDlg('[' + DNUSPL_Acronym + '] Update', 'A newer version of ' + DNUSPL_FullName +
' (' + FloatToStr(tmpVer) + ') is available for download. It is highly recommended that you ' +
'stop this script and install this new update.' + CRLF + CRLF + 'Stop the script now?',
mtConfirmation, [mbOK, mbCancel]) = mrOk) then
begin
Writeln(' [' + DNUSPL_Acronym + '] Good choice! Terminating script...');
TerminateScript;
end else
Writeln(' [' + DNUSPL_Acronym + '] Continuing on then...');
end else
Writeln(' [' + DNUSPL_Acronym + '] You'#39're on the latest version.');
end else
Writeln(' [' + DNUSPL_Acronym + '] Unable to check for updates.');
{$endIf}
end;
begin
SPL_Setup;
SPL_CreateFormEx(Rect(0, 0, 800, 600), 'Test', bsSingle);
SPL_AddTabSheetEx(0, Rect(0, 0, 0, 0), 'test1 yeah');
// Of course, the generic DNUSPL_AddControl will be simplified to AddTab, AddButton, AddCheckBox, etc.
DNUSPL_AddControl(SPL_COMP_Tab, 0, Rect(0, 0, 50, 50), ['test page'], 'test1 yeah', 'w00t 231#');
DNUSPL_AddControl(SPL_COMP_Tab, 0, Rect(0, 0, 0, 0), ['2'], 'test1 yeah', 'w11t23');
DNUSPL_AddControl(SPL_COMP_Button, 0, Rect(50, 50, 75, 23), ['click me!'], 'w11t23', 'thisbutton');
SPL_ShowForm(0, True);
end.