Diono
asked on
Drag and drop onto the 'TAB' of a non visible tabsheet
Hi,
How do I drag and drop onto the tab of a tabsheet. The tabsheet I want to affect with the drop will not have focus. Would I have to track the mouse globally, check if the control under it is a tab and then take apprpriate action. I notice the tab seems to be a seperate control.
Thanks,
Dion.
How do I drag and drop onto the tab of a tabsheet. The tabsheet I want to affect with the drop will not have focus. Would I have to track the mouse globally, check if the control under it is a tab and then take apprpriate action. I notice the tab seems to be a seperate control.
Thanks,
Dion.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tried that. The event does not fire.
Wich event? There're not events in the accepted code....
phew, long time ago (5 years) . . . guess coded with d3
well, the api is not needed,
since the two methods mentioned above are introduced,
but should also work without any change
meikl ;-)
well, the api is not needed,
since the two methods mentioned above are introduced,
but should also work without any change
meikl ;-)
>Tried that. The event does not fire.
maybe you should explain from where you do what drag
maybe you should explain from where you do what drag
ASKER
Firstly, I am using a PageControl with 2 tabsheets
From a TreeView, which has its alignment set to alClient, I want to drag(anything) over the other tabsheets 'TAB' and be able to accept the drag. I declared the following to test:-
procedure TMainForm.pcSMSDragOver(Se nder, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept := true;
showmessage('dragged over');
end;
But the event does not seem to be fired.
From a TreeView, which has its alignment set to alClient, I want to drag(anything) over the other tabsheets 'TAB' and be able to accept the drag. I declared the following to test:-
procedure TMainForm.pcSMSDragOver(Se
State: TDragState; var Accept: Boolean);
begin
accept := true;
showmessage('dragged over');
end;
But the event does not seem to be fired.
hmm, should work
sorry, no delphi on hand, so cannot test myself,
will try this evening, if not solved then
meikl ;-)
sorry, no delphi on hand, so cannot test myself,
will try this evening, if not solved then
meikl ;-)
I should try this way....
procedure TForm1.PageControl1DragDro p(Sender, Source: TObject; X,
Y: Integer);
var
Info : TTCHitTestInfo;
Tab : Integer;
begin
Info.pt := Point(x,y);
Tab := PageControl1.Perform(TCM_H ITTEST,0,L ongInt(@In fo));
if Tab > -1 then
Pagecontrol1.ActivePage := PageControl1.Pages[Tab];
showmessage('Dragged');
end;
procedure TForm1.PageControl1DragOve r(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Sender is TPageControl) then Accept := True;
end;
procedure TForm1.PageControl1DragDro
Y: Integer);
var
Info : TTCHitTestInfo;
Tab : Integer;
begin
Info.pt := Point(x,y);
Tab := PageControl1.Perform(TCM_H
if Tab > -1 then
Pagecontrol1.ActivePage := PageControl1.Pages[Tab];
showmessage('Dragged');
end;
procedure TForm1.PageControl1DragOve
Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Sender is TPageControl) then Accept := True;
end;
ASKER
Thanks guys. Seeing as Kretzschmar was first with an answer, and it works, I will award him the points. In closing, the reason the pagecontrol would not accept the dragover was because I was doing an ole drag. Can this type of drag be accomodated in delphi? I m dragging from Mike's VirtualStringTree. I changed the drag type to VCLDrag.
Thanks.
Thanks.
Check out
[article] http://www.wideman-one.com/gw/tech/Delphi/dragdrop/
[article] http://users.iafrica.com/d/da/dart/zen/Articles/DropPaste/DropPaste.html
[component] http://www.unitoops.com/default.htm
[article] http://www.wideman-one.com/gw/tech/Delphi/dragdrop/
[article] http://users.iafrica.com/d/da/dart/zen/Articles/DropPaste/DropPaste.html
[component] http://www.unitoops.com/default.htm
ASKER
Thanks all.
??
Nothing to say about your choice Diono, but in my opinion, if you think that meikl has answered your question, you should had at least accepted this one https://www.experts-exchange.com/questions/21138815/Drag-and-drop-onto-the-'TAB'-of-a-non-visible-tabsheet.html#12110768
Nothing to say about your choice Diono, but in my opinion, if you think that meikl has answered your question, you should had at least accepted this one https://www.experts-exchange.com/questions/21138815/Drag-and-drop-onto-the-'TAB'-of-a-non-visible-tabsheet.html#12110768
ASKER
Sorry. None at all. I pressed the accept button before realising it was the right person, but wrong answer.
Dion.
Dion.
Diono: Follow https://www.experts-exchange.com/questions/10200281/Mouseover-a-Tab-in-a-TTabControl.html#1952853
F68 ;-)