Below - a simple VCL form with a panel and buttons.
Build and test by adding blocks and double-click. Notice the rotate option is correctly gone. Double click displays the additional CustomElements.
The rotation indicators are back and a doublclick cause an exception due to the CustomElements no longer being valid.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCCustomControl,
VCL.TMSFNCCustomScrollControl, VCL.TMSFNCBloxControl, VCL.TMSFNCBloxCoreTypes,
VCL.TMSFNCBloxCoreBlock, VCL.TMSFNCBloxCoreElement, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
TMSFNCBloxControl1: TTMSFNCBloxControl;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure TMSFNCBloxControl1ElementDblClick(Sender: TObject;
Element: TTMSFNCBloxElement);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TCustomElements = class(TObject)
NumElements: integer;
ElementXML: string;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
newblox: TTMSFNCBloxBlock;
CustomElements: TCustomElements;
begin
// For every block we need additional info via Custom Elements;
CustomElements:= TCustomElements.Create;
CustomElements.NumElements:= 1;
CustomElements.ElementXML:= 'Some XML Here';
newblox:= TTMSFNCBloxBlock.Create;
newblox.Height:= 50;
newblox.WIdth:= 75;
newblox.LinkPoints.Clear;
//only 2 link points per rectangle on the left and right
newblox.Restrictions:= [crNoRotation];
newblox.Obj:= CustomElements; // Lets attach each CustomElements to its Blox
TMSFNCBloxControl1.Blox.Add(newblox);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
TMSFNCBloxControl1.SaveToFile('c:\temp\blox.data');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
TMSFNCBloxControl1.Blox.Clear;
TMSFNCBloxControl1.LoadFromFile('c:\temp\blox.data');
end;
procedure TForm1.TMSFNCBloxControl1ElementDblClick(Sender: TObject;
Element: TTMSFNCBloxElement);
begin
ShowMessage((Element.Obj as TCustomElements).ElementXML);
end;
end.