Solved

Drag and drop onto the 'TAB' of a non visible tabsheet

Posted on 2004-09-21
17
427 Views
Last Modified: 2010-08-05
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
Comment
Question by:Diono
  • 5
  • 4
  • 4
  • +1
17 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 250 total points
ID: 12110768
- 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
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12111045
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
 

Author Comment

by:Diono
ID: 12111062
Tried that. The event does not fire.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12111073
Wich event? There're not events in the accepted code....
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12111098
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12111111
>Tried that. The event does not fire.
maybe you should explain from where you do what drag
0
 

Author Comment

by:Diono
ID: 12111182
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12111289
hmm, should work

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

meikl ;-)
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12111315
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
 

Author Comment

by:Diono
ID: 12112419
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
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 12120756
0
 

Author Comment

by:Diono
ID: 12121354
Thanks all.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12121411
??
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
 

Author Comment

by:Diono
ID: 12130280
Sorry. None at all.  I pressed the accept button before realising it was the right person, but wrong answer.

Dion.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run video youtube webbrowse 10 65
oracle global variables 4 76
Performance of SQL statement 37 128
JAudiorecorder record freezing the app 29 76
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question