BeginUpdate
Signals the beginning of a formula change operation.
Syntax:
Procedure:Â BeginUpdate;
Code Reference:
- Create a New Forms Application
- Add a PlanSwift to the References (Planswift_Tlb)
- Add a button to the form
- Copy code below to the onclick event of the button
- Compile and run
API Calls
Delphi
// PlanSwift code runs:
PlanSwift.BeginUpdate;
try
// execute code here...
finally
PlanSwift.EndUpdate;
end;
// _____________________________________________________________________
// FreshDesk code:
procedure TForm1.psBeginUpdateEndUpdate(Sender: TObject);
var
ps: IPlanswift;
page: IItem;
dimension: IItem;
section: IItem;
line: ILine;
point: IPoint;
begin
// Create the PlanSwift Interface
ps := coPlanswift.Create;
// Put Planswift Interface to Update Mode
ps.BeginUpdate;
// Get Selected Page
page := ps.SelectedPage;
// Call The GetLine Function (See GetLine)
line := ps.GetLine('Draw Dimension Line');
// Create a New Dimension Item
dimension :=page.NewItem('Dimension', 'Demo Dimension Item');
// PageGUID Must be set to the selected page
dimension.SetPropertyFormula('PageGUID', pg.GUID);
// Get The First Point from line
point := line.Point1;
// Add Start Point to the Dimension Section
dimension.NewPoint(point.X, point.Y);
// Get The Second Point from line
point := line.Point2;
// Add End Point to the Dimension Section
dimension.NewPoint(point.X, point.Y);
// Take Planswift out of Update Mode
ps.EndUpdate;
// Clear Planswift Interface
ps := nil;
end;
C#
public class PlanswiftApi
{
private PlanSwift Planswift { get; }
private IItem SelectedPage { get; set; }
private IItem Dimension { get; set; }
private ILine Line { get; set; }
private IPoint Point { get; set; }
public PlanswiftApi()
{
Planswift = new PlanSwift();
}
public void DrawLine()
{
// Notify PlanSwift of Item/Property Change
Planswift.BeginUpdate();
// Get Selected Page in PlanSwift
SelectedPage = Planswift.SelectedPage();
// Get Line "Draw Dimension Line"
Line = Planswift.GetLine("Draw Dimension Line");
// Create a new Item on the Selected Page
Dimension = SelectedPage.NewItem("Dimension", "Demo Dimension Item");
// Set the PageGUID Property Formula to the selected page GUID
Dimension.SetPropertyFormula("PageGUID", SelectedPage.GUID());
Point = Line.Point1;
Dimension.NewPoint(Point.X, Point.Y);
Point = Line.Point2;
Dimension.NewPoint(Point.X, Point.Y);
// Notify PlanSwift that Item/Property has been updated
Planswift.EndUpdate();
}
}
public partial class MyForm : Form
{
private PlanswiftApi PsApi { get; }
public MyForm()
{
InitializeComponent();
PsApi = new PlanswiftApi();
}
private void BtnDrawLine_Click(object sender, EventArgs e)
{
PsApi.DrawLine();
}
}
VB/VBA (OLE)