I have quite a tricky question. I have rated it as very difficult so go ahead. (I couldn't find the solution to it, spent 4 hours trying to solve it)
say i have created a number of labels on the form by:
Labels:array of TLabel;
for i:=0 to length(Labels)-1 do Labels:=Create.TLabel(form1);
...bla bla bla
I want to allow user to move them around by clicking on the object and dragging to a another possition. No problem with that. Using DragOver method and allowing the object to be dragable (sorry about the word).
When I process dragging in DragOver i know the source that i am dragging, however I can't obtain the control of that object. For exapmple idealy i would like to do something like following:
procedure TForm1.GroupBox1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
if Sender=GroupBox1 then
Accept := True;
I have tried to bind the Source with newly created component by GetInterface(), but it all looks ugly, as I don't want to care about the source type at all. I need to be able to change properties of the dragged component without knowing the name,type or any other refferences.
Please help, bosses kicking my a*se already for wasting time creating beauty instead of making it working.