APPENDIX 7 – X-Pert Graphics Program Script Examples
Below you can find simple examples, presenting the basic X-Pert Graphics Program Script classes and functions, as well as some basic programming rules and organization to be used when programming with this new X-Pert Graphics feature. Each example is shown in all the four language syntaxes, supported by the X-Pert Graphics Script Engine and has a short explanation.
Example 1
|
Pascal |
C++ |
|
var Obj: TTBObject;
begin Project.Start;
Obj := TTBObject.Create('Text 1'); if Assigned(Obj) then try Obj.Play; finally Obj.Free; end;
Obj := TTBObject.CreateNew('PICTURE', 'Pic1'); if Assigned(Obj) then try Obj.Left := 10; Obj.Top := 10; Obj.Width := 200; Obj.Height := 200; Obj.Play; finally Obj.Free; end; end. |
{ Project.Start;
TTBObject Obj = new TTBObject("Text 1"); if(Obj) try { Obj.Play; } finally { Obj.Free; }
Obj = TTBObject.CreateNew("PICTURE", "Pic1"); if(Obj) try { Obj.Left = 10; Obj.Top = 10; Obj.Width = 200; Obj.Height = 200; Obj.Play; } finally { delete Obj; } } |
|
Basic |
Java |
|
Project.Start
Obj = new TTBObject("Text 1") if Assigned(Obj) then try Obj.Play finally Obj.Free end try end if
Obj = TTBObject.CreateNew("PICTURE", "Pic1") if Assigned(Obj) then try Obj.Left = 10 Obj.Top = 10 Obj.Width = 200 Obj.Height = 200 Obj.Play finally delete Obj end try end if
end |
Project.Start;
var Obj = new TTBObject("Text 1") if(Obj) try Obj.Play finally Obj.Free;
Obj = TTBObject.CreateNew("PICTURE", "Pic1") if(Obj) try { Obj.Left = 10 Obj.Top = 10 Obj.Width = 200 Obj.Height = 200 Obj.Play } finally delete Obj; |
Example 1 Explained:
1.Declaration of an object variable, named Obj of type TTBObject (in Pascal and C++ only)
2.Starting the Project
3.Linking the Obj variable to an existing object, named “Text 1”
4.Checking if the Obj variable is actually linked to a “Text 1” object with an if statement
5.Obj variable is played and freed within a try-finally block
6.A new picture object is created in the work area and linked to the Obj variable
7.Check if the picture object is actually assigned for the Obj variable
8.The new picture object is given X and Y coordinates, as well as a width and height values in pixels and it is played and freed in a try-finally block
Example 2
|
Pascal |
C++ |
|
var Obj: TTBObject; St: TObjectState;
begin Obj := TTBObject.Create('Text 1'); if Assigned(Obj) then try St := Obj.State;
if St = osPlay then Obj.Stop else Obj.Play;
finally Obj.Free; end; end. |
{ TTBObject Obj = TTBObject.Create("Text 1"); if (Assigned(Obj)) try { TObjectState St = Obj.State;
if (St == osPlay) Obj.Stop; else Obj.Play; } finally { Obj.Free; } } |
|
Basic |
Java |
|
Obj = TTBObject.Create("Text 1") if Assigned(Obj) then try St = Obj.State if St = osPlay then Obj.Stop if St = osStop then Obj.Play finally Obj.Free end try end if
end |
var Obj = TTBObject.Create("Text 1"); if (Assigned(Obj)) try { var St = Obj.State
if (St == osPlay) Obj.Stop else Obj.Play; } finally Obj.Free; |
Example 2 Explained:
1.Declaration of a variable of type TTBObject, named Obj and a variable of type TOBjectState, named St (in Pascal and C++ only)
2.Linking the Obj variable to an existing object, named “Text 1”
3.Check if the Obj variable is actually linked to a “Text 1” object with an if statement
4.Setting a value to the St variable, equal to the state of the Obj variable in a try-finally block
5.Introducing an if statement, which checks if the “Text 1” is in state play. If yes, the Obj variable is stopped. If no, the Obj variable is played.
6.The Obj variable is freed.
|
Pascal |
C++ |
|
var List: TStringList; I: Integer; Obj: TTBObject; S1, S2: String;
begin List := TStringList.Create; try Project.ObjectsList(List);
for I := 0 to List.Count - 1 do begin Obj := TTBObject.Create(List[I]); if Assigned(Obj) then try S1 := Obj.Name; if Obj.State = osPlay then S2 := 'Play' else S2 := 'Stop'; finally Obj.Free; end;
ShowMessage(Format('%s: State = %s', [S1, S2])); end; finally List.Free; end; end. |
{ TStringList List = new TStringList; try { Project.ObjectsList(List);
for(int i = 0; i < List.Count; i++) { TTBObject Obj = TTBObject.Create(List[I]); if (Assigned(Obj)) try { char S1 = Obj.Name; char S2; if (Obj.State == osPlay) S2 = "Play"; else S2 = "Stop"; } finally { Obj.Free; }
ShowMessage(Format("%s: State = %s", [S1, S2])); } } finally { List.Free; } } |
|
Basic |
Java |
|
List = new TStringList try Project.ObjectsList(List)
for i = 0 to List.Count - 1 Obj = TTBObject.Create(List[I]) if Assigned(Obj) then try S1 = Obj.Name if Obj.State = osPlay then S2 = "Play" else S2 = "Stop" end if finally Obj.Free end try ShowMessage(Format("%s: State = %s", [S1, S2])) end if next ' for i finally List.Free end try
end |
var List = new TStringList try { Project.ObjectsList(List);
for(var i = 0; i < List.Count; i++) { var Obj = TTBObject.Create(List[I]); if (Assigned(Obj)) try { var S1 = Obj.Name; var S2; if (Obj.State == osPlay) S2 = "Play" else S2 = "Stop"; } finally Obj.Free;
ShowMessage(Format("%s: State = %s", [S1, S2])); } } finally List.Free; |
Example 3 Explained:
1.Declaration of a variable named List of type TStringList, an integer variable named I, a variable named Obj of type TTBObject, and two string variables, named S1 and S2 (in Pascal and C++ only).
2.Creating the List variable
3.Assigning the names of all the objects from the project in the List variable
4.Initialization of a try-finally block
5.Initialization of a for loop, walking through the whole list of names.
6.Linking the Obj variable to the corresponding object from the List variable (with number I).
7.Checking if an object is actually assigned to the Obj variable with an if statement
8.Assigning a value to the S1 variable, equal to the current name of the Obj variable, i.e., the name of the object with number I in the List.
9.Checking the state of the Obj variable (play or stop) with an if block
10.Assigning the state of the Obj variable to the S2 variable (play or stop)
11.The Obj variable is freed.
12.Showing the current values of S1 and S2 within the loop in a Message Dialog
13.Finishing the loop and setting the List variable free
|
Pascal |
C++ |
|
var Slide: TTBSlide; List: TStringList; I: Integer; S: String;
begin List := TStringList.Create; try Slide := TTBSlide.Create('Slide 1'); if Assigned(Slide) then try Slide.Play; Slide.ObjectsList(List); S := 'Objects in Slide "' + Slide.Name + '": '; for I := 0 to List.Count - 1 do S := S + List[I] + ', '; ShowMessage(S); finally Slide.Free; end; finally List.Free; end; end. |
{ TStringList List = new TStringList; try { TTBSlide Slide = TTBSlide.Create("Slide 1"); if (Assigned(Slide)) try { Slide.Play; Slide.ObjectsList(List); char S = "Objects in Slide " + Slide.Name + ": "; for(int i = 0; i < List.Count; i++) S = S + List[I] + ", "; ShowMessage(S); } finally { Slide.Free; } } finally { List.Free; } } |
|
Basic |
Java |
|
List = new TStringList try Slide = TTBSlide.Create("Slide 1") if Assigned(Slide) then try Slide.Play Slide.ObjectsList(List) S = "Objects in Slide " + Slide.Name + ": " for i = 0 to List.Count - 1 S = S + List[I] + ", " next ' for i ShowMessage(S) finally Slide.Free end try end if finally List.Free end try
end |
var List = new TStringList try { var Slide = TTBSlide.Create("Slide 1") if (Assigned(Slide)) try { Slide.Play Slide.ObjectsList(List) var S = "Objects in Slide " + Slide.Name + ": " for(var i = 0; i < List.Count; i++) S = S + List[I] + ", " ShowMessage(S) } finally Slide.Free; } finally List.Free; |
Example 4 Explained:
1.Declaration of a variable, named Slide with a type TTBSlide, a variable named List of type TStringList, an integer variable, named I, and a string variable, named S (in Pascal and C++ only)
2.Creating the List variable
3.Creating the Slide variable by linking it to “Slide 1” in a try-finally block
4.Checking if a slide is actually assigned to the Slide variable
5.Playing the Slide
6.Assigning the objects’ names from Slide to the List variable
7.Assigning text to the S variable, including “Objects in Slide” and the name of the Slide, assigned to the Slide variable
8.Adding the name of each object from the List variable to the S variable in a for loop
9.Showing the current value of the S variable in a Message Dialog
10.The Slide variable is freed
11.The List variable is freed
|
Pascal |
C++ |
|
var Obj: TTBObject;
begin Obj := TTBObject.Create('Text 1'); if Assigned(Obj) then try Obj.TextSelect(1, 3); Obj.FontSize := 50; Obj.FontStyle := [fsBold, fsItalic]; Obj.FontName := 'Arial'; Obj.UpdateParams; finally Obj.Free; end; end. |
{ TTBObject Obj = TTBObject.Create("Text 1"); if (Assigned(Obj)) try { Obj.TextSelect(1, 3); Obj.FontSize = 50; Obj.FontStyle = [fsBold, fsItalic]; Obj.FontName = "Arial"; Obj.UpdateParams; } finally { Obj.Free; } } |
|
Basic |
Java |
|
Obj = TTBObject.Create("Text 1") if Assigned(Obj) then try Obj.TextSelect(1, 3) Obj.FontSize = 50 Obj.FontStyle = [fsBold, fsItalic] Obj.FontName = "Arial" Obj.UpdateParams finally Obj.Free end try end if
end |
var Obj = TTBObject.Create("Text 1") if (Assigned(Obj)) try { Obj.TextSelect(1, 3) Obj.FontSize = 50 Obj.FontStyle = [fsBold, fsItalic] Obj.FontName = "Arial" Obj.UpdateParams } finally Obj.Free |
Example 5 Explained:
1.Declaring a variable named Obj of type TTBObject
2.Linking the Obj variable to an already created text object, named “Text 1”
3.Checking if an object is actually assigned to the Obj variable
4.Initialising a try-finally block
5.Selecting the first three symbols from the text object and setting their size, font and font style
6.Updating the parameters of the Obj variable so that the new text formatting is applied
7.The Obj variable is freed
Example 6
|
Pascal |
C++ |
|
var DP: TTBDataProvider; List: TStringList;
begin DP := TTBDataProvider.Create('FileLink Data Provider Text04'); if Assigned(DP) then try DP.CursorStop; DP.Top;
List := TStringList.Create; try DP.ObjectsList(List); PlayList(List);
DP.Next; DP.Scroll(2);
StopList(List); finally List.Free; end; finally DP.Free; end; end. |
{ TTBDataProvider DP = TTBDataProvider.Create("FileLink Data Provider Text04"); if (Assigned(DP)) try { DP.CursorStop; DP.Top;
TStringList List = new TStringList; try { DP.ObjectsList(List); PlayList(List);
DP.Next; DP.Scroll(2);
StopList(List); } finally { List.Free; } } finally { DP.Free; } } |
|
Basic |
Java |
|
DP = TTBDataProvider.Create("FileLink Data Provider Text04") if Assigned(DP) then try DP.CursorStop DP.Top
List = new TStringList try DP.ObjectsList(List) PlayList(List)
DP.Next DP.Scroll(2)
StopList(List)
finally List.Free end try finally DP.Free end try end if end |
var DP = TTBDataProvider.Create("FileLink Data Provider Text04") if (Assigned(DP)) try { DP.CursorStop DP.Top
var List = new TStringList try { DP.ObjectsList(List) PlayList(List)
DP.Next DP.Scroll(2)
StopList(List) } finally List.Free; } finally DP.Free; |
Example 6 Explained:
1.Declaration of a variable, named DP of type TTBDataProvider and a variable, named List of type TStringList (in Pascal and C++ only). The Data Provider input is already linked to file “Text 4.txt”shown below.
2.Checking if the DP variable is actually linked to the existing data provider
3.Initialising a try-finally block
4.Stopping the cursor scrolling within the linked text file
5.Moving the cursor to the top line of the linked text file
6.Creating the List variable
7.Initialising another try-finally block
8.Returning a list of all objects, linked to the Data Provider in the List variable
9.Playing all the objects in the List variable
10.Scrolling the cursor to the next line in the Data Provider
11.Scrolling the cursor with two lines in the Data Provider
12.Stopping all the objects in the List variable
13.The List and DP variables are freed
Example 7
|
Pascal |
C++ |
|
var L: TStringList; O: TTBObject; DP: TTBDataProvider;
begin DP := TTBDataProvider.Create('FileLink Data Provider Text04'); if Assigned(DP) then try L := TStringList.Create; try DP.ColumnsList(L);
O := TTBObject.Create('Text 1'); try DP.LinkObject(O, L[1]); finally O.Free; end; finally L.Free; end; DP.Distributor.Scroll := 2; // sec DP.Distributor.ScrollBy := 1; // row DP.CursorStart; DP.Play; finally DP.Free; end; Project.Start; end. |
{ TTBDataProvider DP = TTBDataProvider.Create("FileLink Data Provider Text04"); if (Assigned(DP)) try { TStringList L = new TStringList; try { DP.ColumnsList(L);
TTBObject O = TTBObject.Create("Text 1"); try { DP.LinkObject(O, L[1]); } finally { O.Free; } } finally { L.Free; }
DP.Distributor.Scroll = 2; // sec DP.Distributor.ScrollBy = 1; // row DP.CursorStart; DP.Play; } finally { DP.Free; }
Project.Start; } |
|
Basic |
Java |
|
DP = TTBDataProvider.Create("FileLink Data Provider Text04") if Assigned(DP) then try List = new TStringList try DP.ColumnsList(List)
O = TTBObject.Create("Text 1") try DP.LinkObject(O, List[1]) finally O.Free end try finally List.Free end try
DP.Distributor.Scroll = 2 'sec DP.Distributor.ScrollBy = 1 'row DP.CursorStart DP.Play finally DP.Free end try
Project.Start end if
end |
var DP = TTBDataProvider.Create("FileLink Data Provider Text04") if (Assigned(DP)) try { var L = new TStringList try { DP.ColumnsList(L);
var O = TTBObject.Create("Text 1") try DP.LinkObject(O, L[1]) finally O.Free; } finally L.Free;
DP.Distributor.Scroll = 2 // sec DP.Distributor.ScrollBy = 1 // row DP.CursorStart DP.Play } finally DP.Free;
Project.Start |
1.Declaration of a variable, named L of type TStringList, a variable, named O of type TTBObject, and a variable, named DP of type TTBDataProvider (in Pascal and C++ only). The Data Provider input is already linked to file “Text 4.txt” shown below.
2.Checking if DP variable is actually linked to the existing data provider
3.Initialising a try-finally block
4.Creating the L variable
5.Adding the names of the columns in the Data Provider to the L variable
6.Linking the O variable to an existing text object, named “Text 1”
7.Initialising another try-finally block
8.Setting the link between the data provider and the text object to show data from column with index ‘1’ from the Data Provider, i.e., the second column
9.Setting the O variable and the L variable free
10.Setting the Data Distributor for the Data Provider to scroll every 2 seconds
11.Setting the Data Distributor for the Data Provider to scroll by 1 line
12.Starting the cursor movement in the source file
13.Playing all the objects, linked to the Data Provider
14.The DP variable is freed
15.Starting the project
Example 8
|
Pascal |
C++ |
|
var DP: TTBDataProvider; I, Rows, Cols: Integer; ColumnValues: Variant; DT: TDPDataType; S: String;
begin DP := TTBDataProvider.Create('FileLink Data Provider Text04'); if Assigned(DP) then try Rows := DP.RowCount; Cols := DP.ColCount;
S := '';
ColumnValues := DP.GetColumn(0, DT); if DT = dtText then for I := 0 to Rows - 1 do S := S + VarArrayElement(ColumnValues, I) + #13#10;
ShowMessage(S);
ColumnValues := null; finally DP.Free; end; end. |
{ TTBDataProvider DP = TTBDataProvider.Create("FileLink Data Provider Text04"); if (Assigned(DP)) try { int Rows = DP.RowCount; int Cols = DP.ColCount; char S = ""; TDPDataType DT;
variant ColumnValues = DP.GetColumn(0, DT); if (DT == dtText) { for(int I = 0; I < Rows; I++) S = S + VarArrayElement(ColumnValues, I) + #13#10; } ShowMessage(S);
ColumnValues = null; } finally { DP.Free; } } |
|
Basic |
Java |
|
DP = TTBDataProvider.Create("FileLink Data Provider Text04") if Assigned(DP) then try Rows = DP.RowCount Cols = DP.ColCount S = "" ColumnValues = DP.GetColumn(0, DT) if DT = dtText then for I = 0 to Rows - 1 S = S + VarArrayElement(ColumnValues, I) + #13#10 next end if ShowMessage(S)
ColumnValues = null finally DP.Free end try end if
end |
var DP = TTBDataProvider.Create("FileLink Data Provider Text04"); if (Assigned(DP)) try { var Rows = DP.RowCount var Cols = DP.ColCount var S = "" var ColumnValues = DP.GetColumn(0, DT) if (DT == dtText) { for(I = 0; I < Rows; I++) S = S + VarArrayElement(ColumnValues, I) + #13#10; } ShowMessage(S)
ColumnValues = null; } finally DP.Free; |
Example 8 Explained:
1.Declaration of a variable, named DP of type TTBDataProvider, three integer variables, named I, Rows, and Cols, a variant variable, named ColumnValues, a variable, named DT of type TDPDataType, and a String variable, named S (in Pascal and C++ only). The Data Provider input is already linked to file “Text 4.txt”shown below.
2.Checking if DP variable is actually linked to the existing data provider
3.Initialising a try-finally block
4.Returning the number of rows in the Data Provider in the Rows variable
5.Returning the number of columns in the Data Provider in the Cols variable
6.Setting a value of ‘ ‘ to the string variable
7.Setting the values from column 1, i.e., the column with index 0 to the ColumnValues variable
8.Checking if the data type in the abovementioned column is of type dtText, i.e., text data
9.Initialising a for loop, covering all the rows in the column and adding their values to the S variable one by one
10.Showing the value of S in a message dialog
11.Setting a null value to the ColumnValues variable to free memory
12.The DP variable is freed
|
Pascal |
C++ |
|
var Slide: TTBSlide; List: TStringList;
begin List := TStringList.Create; try Slides.SlidesList(List);
Slide := TTBSlide.Create(List[0]); if Assigned(Slide) then try Slide.Play; Slides.Move(Slide.Index, List.Count); finally Slide.Free; end; finally List.Free; end; end. |
{ TStringList List = new TStringList; try { Slides.SlidesList(List);
TTBSlide Slide = TTBSlide.Create(List[0]); if (Assigned(Slide)) try { Slide.Play; Slides.Move(Slide.Index, List.Count); } finally { Slide.Free; } } finally { List.Free; } } |
|
Basic |
Java |
|
List = new TStringList try Slides.SlidesList(List)
Slide = TTBSlide.Create(List[0]) if Assigned(Slide) then try Slide.Play Slides.Move(Slide.Index, List.Count) finally Slide.Free end try end if finally List.Free end try
end |
var List = new TStringList try { Slides.SlidesList(List)
var Slide = TTBSlide.Create(List[0]); if (Assigned(Slide)) try { Slide.Play; Slides.Move(Slide.Index, List.Count); } finally Slide.Free; } finally List.Free; |
Example 9 Explained:
1.Declaration of a variable, named Slide of type TTBSlide and a variable, named List of type TStringList (in Pascal and C++ only)
2.Creating the List variable.
3.Initialising a try-finally block
4.Adding the names of the current slides in the project to the Slides variable
5.Linking the Slide variable to the first slide, i.e. the slide with an index of ‘0’
6.Checking if a slide is actually linked to the Slide variable
7.Initialising another try-finally block
8.Playing the Slide
9.Changing the index of the slide to the index of the last slide in the SlidesList, i.e., moving it at the end of the slide list
10.The Slide and the List variables are freed
Example 10
|
Pascal |
C++ |
|
var Obj: TTBObject;
begin Project.New;
Obj := TTBObject.CreateNew('TEXT', 'Text 1'); if Assigned(Obj) then try Obj.Left := 20; Obj.Top := 30; Obj.Width := 300; Obj.Height := 100; Obj.Text := 'Test Object'; Obj.Play; finally Obj.Free; end;
Project.Start; end. |
{ Project.New;
TTBObject Obj = TTBObject.CreateNew("TEXT", "Text 1"); if (Assigned(Obj)) try { Obj.Left = 20; Obj.Top = 30; Obj.Width = 300; Obj.Height = 100; Obj.Text = "Test Object"; Obj.Play; } finally { Obj.Free; }
Project.Start; } |
|
Basic |
Java |
|
Project.New
Obj = TTBObject.CreateNew("TEXT", "Text 1") if Assigned(Obj) then try Obj.Left = 20 Obj.Top = 30 Obj.Width = 300 Obj.Height = 100 Obj.Text = "Test Object" Obj.Play finally Obj.Free end try end if
Project.Start
end |
Project.New;
var Obj = TTBObject.CreateNew("TEXT", "Text 1") if (Assigned(Obj)) try { Obj.Left = 20 Obj.Top = 30 Obj.Width = 300 Obj.Height = 100 Obj.Text = "Test Object" Obj.Play } finally Obj.Free;
Project.Start; |
1.Declaration of a variable, named Obj of type TTBObject (in Pascal and C++ only)
2.Opening a new project.
3.Creating a new text object within the project, named “Text 1” and linking it to the Obj variable
4.Checking if an object is actually linked to the Obj variable
5.Initialising a try-finally block
6.Assigning X and Y coordinates to the text object, as well as width and height
7.Entering the text “Test Object” in the object
8.Playing the object
9.Setting the Obj variable free
10.Starting the project
|
Pascal |
C++ |
|
var I: Integer;
begin I := 0; try I := 5 div I; except I := -1; ShowMessage(ExceptionMessage); end; ShowMessage(I); end. |
{ int I = 0; try { I = 5 % I; } catch { I = -1; ShowMessage(ExceptionMessage); }
ShowMessage(I); } |
|
Basic |
Java |
|
dim I = 0 try I = 5 / I catch I = -1 ShowMessage(ExceptionMessage) end try
ShowMessage(I) |
var I = 0 try I = 5 / I Catch { I = -1 ShowMessage(ExceptionMessage) }
ShowMessage(I) |
Example 11 Explained:
1.Declaration of an integer variable, named I(in Pascal and C++ only)
2.Setting a value of ‘0’ to the I variable
3.Initialising a try-except / try-catch block
4.Attempting to divide ‘5’ by the I variable
5.Setting a value of ‘-1’ to the I variable in case there is an error between the “try” and “except” statements and shows a message with a description of the type of error that has occurred. In this case the step will not be executed, since I is equal to ‘0’ and you cannot divide by ‘0’.
6.Showing the value of I in a message dialog
|
Pascal |
C++ |
|
function Transform(Obj: TTBObject; Text: String): Boolean; var DP: TTBDataProvider; begin if Text <> '' then Result := False else begin DP := TTBDataProvider.Create('FileLink Data Provider Text04'); DP.Next; DP.Free; Result := True; end; end;
begin end. |
bool Transform(TTBObject Obj, char Text) { if (Text != "") return(False); else { TTBDataProvider DP = TTBDataProvider.Create("FileLink Data Provider Text04"); DP.Next; DP.Free; return(True); } }
{ } |
|
Basic |
Java |
|
function Transform(Obj, Text) if Text <> "" then return False else DP = TTBDataProvider.Create("FileLink Data Provider Text04") DP.Next DP.Free return True end if end function
end |
function Transform(Obj, Text); { if (Text != "") return(False) else { var DP = TTBDataProvider.Create("FileLink Data Provider Text04") DP.Next DP.Free return(True); } } { } |
Example 12 Explained:
1.Declaration of a Transform Function
2.Declaration of a variable, named DP of type TTBDataProvider(in Pascal and C++ only)
3.Checking if the Text in the object, to which the transform function is linked is different from ‘ ’, i.e., if there is an empty line.
4.If an empty line is not found, returning a False result to the Transform Function, i.e., the object will display information as it is fed by the Data Provider
5.If text is not different from ‘ ‘, i.e., an empty line is found, the DP variable is linked to the *.txt file Text4, shown below.
The cursor is moved to the next line in the Text 4 file
1.The DP variable is set free
2.A True result is returned to the Transform Function, i.e., the object has already shown the proper data
|
Pascal |
C++ |
|
begin if DEBUG then ShowMessage('Debug!') else ShowMessage('Executing!'); end. |
{ if(DEBUG) ShowMessage("Debug!"); else ShowMessage("Executing!"); } |
|
Basic |
Java |
|
if DEBUG then ShowMessage("Debug!") else ShowMessage("Executing!") end if
end |
if(DEBUG) ShowMessage("Debug!") else ShowMessage("Executing!"); |
Example 13 Explained:
1.Checking if X-Pert Graphics is in debug mode
2.If yes, showing a message with text “Debug!”
3.If no, showing a message with text “Executing!”
|
Pascal |
C++ |
|
var S: String;
begin S := 'Stored Value'; if Storage[0] <> 500 then begin Storage[0] := 500; Storage[1] := S; end; ShowMessage(Storage.Count); if Storage.Count > 10 then Storage.Clear; end. |
{ char S = "Stored Value"; if(Storage[0] != 500) { Storage[0] = 500; Storage[1] = S; } ShowMessage(Storage.Count); if(Storage.Count > 10) Storage.Clear; } |
|
Basic |
Java |
|
dim S = "Stored Value" if Storage[0] <> 500 then Storage[0] = 500 Storage[1] = S end if ShowMessage(Storage.Count) if Storage.Count > 10 then Storage.Clear end if end |
var S = "Stored Value" if(Storage[0] != 500) { Storage[0] = 500 Storage[1] = S } ShowMessage(Storage.Count) if(Storage.Count > 10) Storage.Clear |
Example 14 Explained:
1.Declaration of a string variable, named S (in Pascal and C++ only)
2.Setting a value, equal to “Stored Value” to S.
3.Initialization of an if statement for checking whether the first item in the Storage is different from 500. If it is different, assigning a value of 500 to the first item in the Storage and a value, equal to S to the second item in the Storage.
4.Ending the if statement.
5.Showing the number of items stored in a Message dialog.
6.Clearing the Storage if the number of items, stored is greater than 10.
|
Pascal |
C++ |
|
uses 'Unit.pas', 'Test.cpp', 'String.vb', 'Script.js';
begin ... end. |
#include "Unit.pas", "Test.cpp", "String.vb", "Script.js"
{ ... } |
|
Basic |
Java |
|
imports "Unit.pas", "Test.cpp", "String.vb", "Script.js"
... end |
import "Unit.pas", "Test.cpp", "String.vb", "Script.js"
{ ... } |
Example 15 Explained:
1.Assigning the following saved modules to be used in the script: “Unit.pas”, “Test.cpp”, “String.vb”, and “Script.js”. Notice that the four files are written in different script syntaxes.
2.Initialising and ending the main part of the script.
Test 4.txt
Header Col_1 Header Col_2 Header Col_3
Line 1 Col 1 Line 1 Col 2 Line 1 Col 3
Line 2 Col 1 Line 2 Col 2 Line 2 Col 3
Line 3 Col 1 Line 3 Col 2 Line 3 Col 3
Line 4 Col 1 Line 4 Col 2 Line 4 Col 3
Line 5 Col 1 Line 5 Col 2 Line 5 Col 3
Line 6 Col 1 Line 6 Col 2 Line 6 Col 3
Line 7 Col 1 Line 7 Col 2 Line 7 Col 3
Line 8 Col 1 Line 8 Col 2 Line 8 Col 3
Line 9 Col 1 Line 9 Col 2 Line 9 Col 3
Line 10 Col 1 Line 10 Col 2 Line 10 Col 3
Line 11 Col 1 Line 11 Col 2 Line 11 Col 3
Line 12 Col 1 Line 12 Col 2 Line 12 Col 3
Line 13 Col 1 Line 13 Col 2 Line 13 Col 3
Line 14 Col 1 Line 14 Col 2 Line 14 Col 3
Line 15 Col 1 Line 15 Col 2 Line 15 Col 3
Line 16 Col 1 Line 16 Col 2 Line 16 Col 3
Line 17 Col 1 Line 17 Col 2 Line 17 Col 3
Line 18 Col 1 Line 18 Col 2 Line 18 Col 3
Line 19 Col 1 Line 19 Col 2 Line 19 Col 3
Line 20 Col 1 Line 20 Col 2 Line 20 Col 3
Line 21 Col 1 Line 21 Col 2 Line 21 Col 3
Line 22 Col 1 Line 22 Col 2 Line 22 Col 3
Line 23 Col 1 Line 23 Col 2 Line 23 Col 3
Line 24 Col 1 Line 24 Col 2 Line 24 Col 3
Line 25 Col 1 Line 25 Col 2 Line 25 Col 3
Line 26 Col 1 Line 26 Col 2 Line 26 Col 3
Line 27 Col 1 Line 27 Col 2 Line 27 Col 3
Line 28 Col 1 Line 28 Col 2 Line 28 Col 3
Line 29 Col 1 Line 29 Col 2 Line 29 Col 3
Line 30 Col 1 Line 30 Col 2 Line 30 Col 3