I am trying to use CodeList and ADVMemo together, following the example in Demo3 of the ADVMemo samples. The only difference is that I am creating the ADVMemo in code rather than at design time.
As I create the ADVMemo named "ActivePage" and I assign the events to the appropriate procedures,
OnDragDrop := OnActPageDragDrop;
OnDragOver := OnActPageDragOver;
and these are the procedures
procedure tfmIDEMain.OnActPageDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if (source is tadvcodelist) then
begin
ActivePage.DropText(x,y, Codelist.CodeBlocks.Items[Codelist.itemindex].Code.Text);
end;
end;
procedure tfmIDEMain.OnActPageDragOver(Sender: TObject; Source: TObject; X: Integer; Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := true;
end;
I can drag code from the ADVMemo to the code list but OnActPageDragDrop never triggers when I try and drop an item from CodeList to the ADVmemo.
This is the code for the CodeList events, copied direct from your samples.
procedure TfmIDEMain.CodeListDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
Codelist.CodeBlocks.Add(ActivePage.Selection);
CodeList.CodeBlocks[CodeList.CodeBlocks.Count - 1].ImageIndex := 0;
end;
procedure TfmIDEMain.CodeListDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := (source is TAdvMemo);
end;
What am I missing?
John Barrat