Inserted Ole Container Can Only Be Dragged Once
Posted: Thu Sep 11, 2008 9:45 am
I am using the RVEditDemo program and have added the capability to add an Ole Container via the menu using the following code:-
However, once the control has been dragged and dropped once, it cannot be clicked on (resize points are not displayed) and dragged again. What am I doing wrong?
Frederick
Code: Select all
procedure TForm1.mnuOleClick(Sender: TObject);
var
ole: TOleContainer;
begin
ole := TOleContainer.Create(Self);
ole.Caption := 'Test Container';
ole.SizeMode:=smStretch;
ole.BorderStyle:=bsNone;
ole.OnMouseDown:=OleMouseDown;
ole.OnMouseMove:=OleMouseMove;
RichViewEdit1.InsertControl('',ole,rvvaBaseline);
if RichViewEdit1.CurItemStyle=rvsComponent then
RichViewEdit1.SetCurrentItemExtraIntProperty(rvepResizable, 1, True);
end;
procedure TForm1.OleMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then begin
RichViewEdit1.SelectControl(TControl(Sender));
ClickedControl := Sender;
ClickPoint := Point(X, Y);
end;
end;
procedure TForm1.OleMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if (ssLeft in Shift) and (ClickedControl=Sender) and
(Sqr(ClickPoint.X-X)+Sqr(ClickPoint.Y-Y)>10) then
RichViewEdit1.BeginOleDrag;
end;
Frederick