Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

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.
0
Diono
Asked:
Diono
  • 5
  • 4
  • 4
  • +1
1 Solution
 
kretzschmarCommented:
- use the onDragOver-event of your TPageControl
- Determine the Tab with the indexOfTab-method within this event
- additional you can use the getHitTestInfo there (to lookup if you are over a tab or on a clientarea)

sorry no time for a sample

meikl ;-)
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
meikl, you've already answered a question like this! :))

Diono: Follow http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10200281.html#1952853

F68 ;-)
0
 
DionoAuthor Commented:
Tried that. The event does not fire.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Wich event? There're not events in the accepted code....
0
 
kretzschmarCommented:
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 ;-)
0
 
kretzschmarCommented:
>Tried that. The event does not fire.
maybe you should explain from where you do what drag
0
 
DionoAuthor Commented:
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(Sender, 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.

0
 
kretzschmarCommented:
hmm, should work

sorry, no delphi on hand, so cannot test myself,
will try this evening, if not solved then

meikl ;-)
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
I should try this way....

procedure TForm1.PageControl1DragDrop(Sender, Source: TObject; X,
  Y: Integer);
var
  Info : TTCHitTestInfo;
  Tab : Integer;
begin
  Info.pt := Point(x,y);
  Tab := PageControl1.Perform(TCM_HITTEST,0,LongInt(@Info));
  if Tab > -1 then
    Pagecontrol1.ActivePage := PageControl1.Pages[Tab];
    showmessage('Dragged');
end;

procedure TForm1.PageControl1DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Sender is TPageControl) then Accept := True;
end;
0
 
DionoAuthor Commented:
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.
0
 
DionoAuthor Commented:
Thanks all.
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
??
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 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21138815.html#12110768
0
 
DionoAuthor Commented:
Sorry. None at all.  I pressed the accept button before realising it was the right person, but wrong answer.

Dion.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now