CRectTracker::Track()

Hi,
Priyanka here.

I have an application, and its view is derived from CFormView.
iam using a pointer of CRectTracker class.

when i am using the Track() API of CRectTracker, it returns 0
everytime.
The rectTracker returns 0 if its rectangle didnt change at all.
otherwise, it returns 1.

is it b'coz i am passing a CFormView pointer to the Track() API. This
API requires CWnd*, and CFormView is a CDialog*. is here the defference
lie?
or is there any other reason?

please help me out...
Thanks,
Priyanka

0
10/21/2005 9:11:41 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
1150 Views

Similar Articles

[PageSpeed] 16

Hi,


"priya" wrote:

> Hi,
> Priyanka here.
> 
> I have an application, and its view is derived from CFormView.
> iam using a pointer of CRectTracker class.
> 
> when i am using the Track() API of CRectTracker, it returns 0
> everytime.
> The rectTracker returns 0 if its rectangle didnt change at all.
> otherwise, it returns 1.
> 
> is it b'coz i am passing a CFormView pointer to the Track() API. This
> API requires CWnd*, and CFormView is a CDialog*. is here the defference
> lie?
> or is there any other reason?

CFormView is derived (indirectly) from CWnd and its pointer
can easily be casted into CWnd pointer. Also CFormView is not
CDialog* as you think it is.
But still the "reason" is CFormView partly; it uses view scrolling which
means that you must perform coordinate conversion because
CRectTracker members stores device coordinates.
The strategy is:
Define a CRect member of CFormView derived class to store
logical coordinates. The drawing code must look like so:

m_tracker.m_rect = m_rect;
pDC->LPtoDP(m_tracker.m_rect);
m_tracker.Draw(pDC);

In the handler of WM_LBUTTONDOWN the code is:

if (m_tracker.Track(this, point, FALSE, NULL))
{
    CClientDC dc(this);
    OnPrepareDC(&dc); // omit if not overriden
    m_rect = m_tracker.m_rect;
    dc.DPtoLP(m_rect);
    Invalidate();
}



> please help me out...
> Thanks,
> Priyanka
> 
>


-- 
======
Arman

0
armancho_x1 (249)
10/21/2005 9:44:02 PM
Arman Sahakyan (donotspam) wrote:
> Hi,
>
>
> "priya" wrote:
>
> > Hi,
> > Priyanka here.
> >
> > I have an application, and its view is derived from CFormView.
> > iam using a pointer of CRectTracker class.
> >
> > when i am using the Track() API of CRectTracker, it returns 0
> > everytime.
> > The rectTracker returns 0 if its rectangle didnt change at all.
> > otherwise, it returns 1.
> >
> > is it b'coz i am passing a CFormView pointer to the Track() API. This
> > API requires CWnd*, and CFormView is a CDialog*. is here the defference
> > lie?
> > or is there any other reason?
>
> CFormView is derived (indirectly) from CWnd and its pointer
> can easily be casted into CWnd pointer. Also CFormView is not
> CDialog* as you think it is.
> But still the "reason" is CFormView partly; it uses view scrolling which
> means that you must perform coordinate conversion because
> CRectTracker members stores device coordinates.
> The strategy is:
> Define a CRect member of CFormView derived class to store
> logical coordinates. The drawing code must look like so:
>
> m_tracker.m_rect = m_rect;
> pDC->LPtoDP(m_tracker.m_rect);
> m_tracker.Draw(pDC);
>
> In the handler of WM_LBUTTONDOWN the code is:
>
> if (m_tracker.Track(this, point, FALSE, NULL))
> {
>     CClientDC dc(this);
>     OnPrepareDC(&dc); // omit if not overriden
>     m_rect = m_tracker.m_rect;
>     dc.DPtoLP(m_rect);
>     Invalidate();
> }
>
>
>
> > please help me out...
> > Thanks,
> > Priyanka
> >
> >
>
>
> --
> ======
> Arman





hi,
Thanks Arman,
But the real problem was this way : i was using SetCapture() in
LButtonDown() and ReleaseCapture() in LButtonUp(). and in between,
MouseMove event occurs. So here, when i debug the code of
CRectTracker::Track(), i found that it has its own GetCapture()
function, where it captures the click. if there is defference in the
previous click and the current click, it captures the rectangle and
returns 1. otherwise returns 0. as far as my knowledge is concerned,
the click is not able to captured by GetCapture(), and so it is
returning 0.


Anyways, please correct me if i am wrong anywhere, b'coz this is what
is my preception. what exACTLY IS HAPPENING, i am still confused.

Regards,
Priyanka

0
10/25/2005 4:43:11 AM
Hi,



"priya" wrote:

> 
> Arman Sahakyan (donotspam) wrote:
> > Hi,
> >
> >
> > "priya" wrote:
> >
> > > Hi,
> > > Priyanka here.
> > >
> > > I have an application, and its view is derived from CFormView.
> > > iam using a pointer of CRectTracker class.
> > >
> > > when i am using the Track() API of CRectTracker, it returns 0
> > > everytime.
> > > The rectTracker returns 0 if its rectangle didnt change at all.
> > > otherwise, it returns 1.
> > >
> > > is it b'coz i am passing a CFormView pointer to the Track() API. This
> > > API requires CWnd*, and CFormView is a CDialog*. is here the defference
> > > lie?
> > > or is there any other reason?
> >
> > CFormView is derived (indirectly) from CWnd and its pointer
> > can easily be casted into CWnd pointer. Also CFormView is not
> > CDialog* as you think it is.
> > But still the "reason" is CFormView partly; it uses view scrolling which
> > means that you must perform coordinate conversion because
> > CRectTracker members stores device coordinates.
> > The strategy is:
> > Define a CRect member of CFormView derived class to store
> > logical coordinates. The drawing code must look like so:
> >
> > m_tracker.m_rect = m_rect;
> > pDC->LPtoDP(m_tracker.m_rect);
> > m_tracker.Draw(pDC);
> >
> > In the handler of WM_LBUTTONDOWN the code is:
> >
> > if (m_tracker.Track(this, point, FALSE, NULL))
> > {
> >     CClientDC dc(this);
> >     OnPrepareDC(&dc); // omit if not overriden
> >     m_rect = m_tracker.m_rect;
> >     dc.DPtoLP(m_rect);
> >     Invalidate();
> > }
> >
> >
> >
> > > please help me out...
> > > Thanks,
> > > Priyanka
> > >
> > >
> >
> >
> > --
> > ======
> > Arman
> 
> 
> 
> 
> 
> hi,
> Thanks Arman,
> But the real problem was this way : i was using SetCapture() in
> LButtonDown() and ReleaseCapture() in LButtonUp(). and in between,
> MouseMove event occurs.

Why? If you do it for implementing the tracker you are really wrong.
Don't do it. CRactTracker has its own logic to capture a window and
handle WM_LBUTTONUP, WM_MOUSEMOVE messages. In other words,
never mind of capturing and of those messages.

>So here, when i debug the code of
> CRectTracker::Track(), i found that it has its own GetCapture()
> function, where it captures the click. if there is defference in the
> previous click and the current click, it captures the rectangle and
> returns 1. otherwise returns 0.

Its abvous that the mouse can be captured by one window
only at tha same time. If you look carefully at the call of 
::GetCapture in CRectTracker::TrackHandle you will see
that ::GetCapture is a global (Win32) function (because of ::)
and it checks whether the mouse has already been captured!!!
No care who has captured it; if yes the method returns FALSE;
"I cannot act if the mouse is captured not by me!", says it.
In other words, you are not supposed to capture the mouse while
processing the tracker.
If the mouse is free (not captured) CRectTracker::TrackHandle captures
it via SetCapture function and starts to do its job.

> as far as my knowledge is concerned,
> the click is not able to captured by GetCapture(), and so it is
> returning 0.
> 
.... and you are right. ::GetCapture returns a HWND that shows (if any)
the window that has captured the mouse. If it is NULL - not captured yet.

> Anyways, please correct me if i am wrong anywhere, b'coz this is what
> is my preception. what exACTLY IS HAPPENING, i am still confused.
> 

To summarize,
Track returns (failes one may say) in two cases;
if the cursor does not hit the tracker's rect,
and if the mouse has already been captured by a window.
Otherwise it starts to act. It will not return untill WM_LBUTTONUP
gets involed. And still you aren't supposed to concern
with that message (and WM_MOUSEMOVE too).

Hope I could explain the problem. If any Q, you are welcome.



-- 
======
Arman

0
armancho_x1 (249)
10/25/2005 8:52:04 AM
Arman Sahakyan (donotspam) wrote:
> Hi,
>
>
>
> "priya" wrote:
>
> >
> > Arman Sahakyan (donotspam) wrote:
> > > Hi,
> > >
> > >
> > > "priya" wrote:
> > >
> > > > Hi,
> > > > Priyanka here.
> > > >
> > > > I have an application, and its view is derived from CFormView.
> > > > iam using a pointer of CRectTracker class.
> > > >
> > > > when i am using the Track() API of CRectTracker, it returns 0
> > > > everytime.
> > > > The rectTracker returns 0 if its rectangle didnt change at all.
> > > > otherwise, it returns 1.
> > > >
> > > > is it b'coz i am passing a CFormView pointer to the Track() API. This
> > > > API requires CWnd*, and CFormView is a CDialog*. is here the defference
> > > > lie?
> > > > or is there any other reason?
> > >
> > > CFormView is derived (indirectly) from CWnd and its pointer
> > > can easily be casted into CWnd pointer. Also CFormView is not
> > > CDialog* as you think it is.
> > > But still the "reason" is CFormView partly; it uses view scrolling which
> > > means that you must perform coordinate conversion because
> > > CRectTracker members stores device coordinates.
> > > The strategy is:
> > > Define a CRect member of CFormView derived class to store
> > > logical coordinates. The drawing code must look like so:
> > >
> > > m_tracker.m_rect = m_rect;
> > > pDC->LPtoDP(m_tracker.m_rect);
> > > m_tracker.Draw(pDC);
> > >
> > > In the handler of WM_LBUTTONDOWN the code is:
> > >
> > > if (m_tracker.Track(this, point, FALSE, NULL))
> > > {
> > >     CClientDC dc(this);
> > >     OnPrepareDC(&dc); // omit if not overriden
> > >     m_rect = m_tracker.m_rect;
> > >     dc.DPtoLP(m_rect);
> > >     Invalidate();
> > > }
> > >
> > >
> > >
> > > > please help me out...
> > > > Thanks,
> > > > Priyanka
> > > >
> > > >
> > >
> > >
> > > --
> > > ======
> > > Arman
> >
> >
> >
> >
> >
> > hi,
> > Thanks Arman,
> > But the real problem was this way : i was using SetCapture() in
> > LButtonDown() and ReleaseCapture() in LButtonUp(). and in between,
> > MouseMove event occurs.
>
> Why? If you do it for implementing the tracker you are really wrong.
> Don't do it. CRactTracker has its own logic to capture a window and
> handle WM_LBUTTONUP, WM_MOUSEMOVE messages. In other words,
> never mind of capturing and of those messages.
>
> >So here, when i debug the code of
> > CRectTracker::Track(), i found that it has its own GetCapture()
> > function, where it captures the click. if there is defference in the
> > previous click and the current click, it captures the rectangle and
> > returns 1. otherwise returns 0.
>
> Its abvous that the mouse can be captured by one window
> only at tha same time. If you look carefully at the call of
> ::GetCapture in CRectTracker::TrackHandle you will see
> that ::GetCapture is a global (Win32) function (because of ::)
> and it checks whether the mouse has already been captured!!!
> No care who has captured it; if yes the method returns FALSE;
> "I cannot act if the mouse is captured not by me!", says it.
> In other words, you are not supposed to capture the mouse while
> processing the tracker.
> If the mouse is free (not captured) CRectTracker::TrackHandle captures
> it via SetCapture function and starts to do its job.
>
> > as far as my knowledge is concerned,
> > the click is not able to captured by GetCapture(), and so it is
> > returning 0.
> >
> ... and you are right. ::GetCapture returns a HWND that shows (if any)
> the window that has captured the mouse. If it is NULL - not captured yet.
>
> > Anyways, please correct me if i am wrong anywhere, b'coz this is what
> > is my preception. what exACTLY IS HAPPENING, i am still confused.
> >
>
> To summarize,
> Track returns (failes one may say) in two cases;
> if the cursor does not hit the tracker's rect,
> and if the mouse has already been captured by a window.
> Otherwise it starts to act. It will not return untill WM_LBUTTONUP
> gets involed. And still you aren't supposed to concern
> with that message (and WM_MOUSEMOVE too).
>
> Hope I could explain the problem. If any Q, you are welcome.
>
>
>
> --
> ======
> Arman



hi,
Thanks Arman,
got the concept clear now....
thanks a lot


Regards,
Priyanka

0
10/26/2005 4:42:19 AM
Reply:

Similar Artilces:

tracking of repairs
Hi I'm wondering if there is a way of tracking customer repairs using the rms software. i.e. when a customer brings in there computer for repair etc we can log the computer in and then add to the computer repair history so we know when and what has been done to that computer thank you in advance I would be interested in that as well - right now I am looking at using Workorder's as a work around. What are people using or doing to track this type of work/repair order. Dan "mikestaf" <mikestaf@discussions.microsoft.com> wrote in message news:F3A9F7AE-D1D6-43C2-A50...

Inventory Revision Tracking
Hi, Looking for a way to setup an inventory item (e.g., ABC123) and also track revision numbers (r1.1, r1.3, r2.0) and revision effective dates associated with that part. For instance, when an order comes in from a customer they order part number "ABC123" and the system should default to the most current revision (e.g., r2.0). However, at times a customer could specifically order part number "ABC123" and specifically request an older "r1.3" revision of the product. The kicker is that each of these parts is assigned to different inventory locations as ...

Exchange Reports
Anyone know of a report I can generate, or a log that I can view, regularly which shows me what types of attachments users are emailing off of the network to external email addresses? Thanks, Tom tomweho@hotmail.com Nothing native/built-in. Don't see a specific attachment report in the following 3rd party products, but these are otherwise known to be the go-to tools for reporting on Exchange traffic and usage: - Promodag: http://www.promodag.com/products/reports/reports.aspx Quest Message Stats: http://www.quest.com/messagestats/ -- Bharat Suneja MVP - Exchange www.zenprise.com...

Tracking sent mail
Is there a way in Outlook 2000 to be notified when an email that I sent to another user is then forwarded on to another user? Basically I would like to know if certain emails, that I send, are then forwarded and to whom they are forwarded to. Thanks On Thu, 16 Oct 2003 08:42:04 -0700, "Scott" <anonymous@discussions.microsoft.com> wrote: >Is there a way in Outlook 2000 to be notified when an >email that I sent to another user is then forwarded on to >another user? > >Basically I would like to know if certain emails, that I >send, are then forwarded ...

Tracking a Custom Outlook Form
One of our users has created a custom Outlook Contact form. It basically contains an additional text field and the form has no scripting in it whatsoever. He'd like to track these Outlook contacts in MSCRM. When the user attempts to track the contact by clicking the "Track in CRM" button on the CRM Outlook toolbar, he recieves the following error: This item type is not valud for promotion to Microsoft CRM. I attempted to reproduce the problem, yet the CRM isn't even available on the contact form on my computer. Is it possible to track Outlook contacts that are usin...

Inventory tracking ??
Is there anyone out there who tracks inventory with Money Small Business? I am interested in only a few inventory items and would like to find out more about how Money handles it as it does not seem intuitive or clear what all it is doing. -- Joseph Meehan Dia duit Anything you want to know in particular? I've played with it some, haven't used it extensively. I find that it can definitely seem a bit flaky until you know where to find things. "Joseph Meehan" wrote: > Is there anyone out there who tracks inventory with Money Small > Business?...

Document Tracking in Outlook
Does anyone have any experience or information related to using Outlook for Document Tracking? Thanks! ...

I owe someone money
Hello. I use Microsoft Money plus Deluxe. So I owe my girlfriend (let's say $1000.00). As bills come in that she would usually pay half of (internet, cable, utilities, etc) I just pay the entire bill and keep subtracting the amount I owe her (on an Excel spreadsheet). But the money I borrowed is distributed amongst different categories (let's say Rent, Household, Food, etc). Can someone suggest to me a way in which to track this? Basically, I want to show that when I pay a utility bill, that 1/2 of it (sort of) comes from my girlfriend. I can't think of a good way to d...

Tracking results of changes to database
Is there a good tool for testing results of changes to stored procedure, functions, views etc? Some way to compare results of activity to the results of the same activity after changes are made. Not just for a particular procedure but after you have made changes to multiple procedures that may be used by other procedures. Then run some type of robot function that does the same set of actions that was done on an identical database before the changes were made and then compare the database to see what is different. Thanks, Tom On Mon, 19 Apr 2010 12:31:45 -0700, &q...

Track changes #7
Where is the person who made changes to a shared workbook derived from? If I logon via one machine it gives my full name in the track changes history. If I logon from another machine, it gives my first initial and last name. I would like to know why it is different and where the identifier comes from. On the two systems, do you have different profile details? I believe TC is shown as the name from Tools, Options, User Name. R. Rainone Wrote: > Where is the person who made changes to a shared workbook derived from? > If I > logon via one machine it gives my full name in ...

Tracking Foreign Stocks in Portfolio Manager
Hi I am evaluating the trial version of Money 2007 and it can do everything that I want it to do with the exception of correctly tracking foreign stocks. The problem is that of the calculation of Cost Basis (Book cost). I have a number of stocks quoted on the London and European exchanges. When I record a "Buy", money asks me for the exchange rate and correctly calculates the Base Currency cost of the transaction. However, in the Portfolio review, if the exchange rate then changes, the Pounds Sterling and Euro stocks then show an incorrect Book Cost (both in local and base ...

Error when saving an email that you just selected to Track in CRM
System Details: CRM 3.0 Windows 2000 Exchange 2003 SQL 2000 Order of events; 1. Email to outlook client from an external email address. 2. User selects "Tracked in CRM". 3. User selects "Viewed in CRM". 4. If the email address is not recognized user 'Add contact record for unknown email address'. 5. User selects "Save and Close". 6. The text of the error is as follows: "This activity is closed. After the record is saved, you cannot change business required fields. Do you want to continue?" 7. User selects "OK" 8. The following err...

Outlook Plug in, set regarding to email or just track in CRM
Hello, Sorry for this newbie question, but is it better to just track the email from within in Outlook to CRM or do you alwasy set it REGARDING TO and then track. You only track it to the contact or to the opportunity? Thank you. Hi JS, As far as I know if you just track it, it will be tracked against the Account and will show up in the History section of Accounts. Whereas if you track and Set Regarding then it can be tracked against a Case, Lead etc. and show up in the History of that specific item. Hope that helps? Regards, Rick "JS" wrote: > Hello, > Sorry for thi...

CRectTracker color
Is there any way to change the drawing color for a CRectTracker object or must one derive a new class and override the drawing functions? TIA, Gerry Murphy After a quick look at the source code, I'd say you need to override the class and do it yourself. Mark -- Mark Salsbery Microsoft MVP - Visual C++ "Gerry Murphy" <gerry_murphy@comcast.net> wrote in message news:uji0R1jJIHA.3356@TK2MSFTNGP02.phx.gbl... > Is there any way to change the drawing color for a CRectTracker object or > must one derive a new class and override the drawing functions? > &g...

Message tracking #26
Hi We've had an issue with an excessive growth of the message tracking file. Once a month there is a newsletter send from a internal client to a lot of external mailaddresses. This causes the exceptional growth of the message tracking logfile. Does anybody know how to exclude this from the message tracking? Kind Regards BvdB you cannot exclude any email from message tracking...it's either enabled, or disabled... -- Susan Conkey [MVP] "BvdB" <BvdB@discussions.microsoft.com> wrote in message news:D98624B7-047A-433F-BF87-99EB9030593E@microsoft.com... > Hi ...

Track Layoff
Hello all, we want to be able to track layoffs is there a place without inactivated them due to payroll issues to track layoff information? TIA You could put them on leave on the HR Status window. -- Charles Allen, MVP "Brian" wrote: > Hello all, we want to be able to track layoffs is there a place without > inactivated them due to payroll issues to track layoff information? > > TIA > ...

Track in CRM button in fat outlook client
In CRM 3.0 when you track an Email in CRM the only way to then open it in CRM is to expand open the email first and then click the View in CRM button (Unless you already have a "regarding" link setup which allows you to go straight to that. It's a small annoyance but is there anyway to add the "View in CRM" button to the main fat outlook client toolbar? Then when you select track you can then select view without having to open the email first everytime. Again small annoyance but I'm suprised the developers didn't pick up on it. Cheers Gregg ...

Copying tracked changes into Outlook
Hey everyone: using Office 2007 Enterprise When I copy text from Word that includes tracked changes (lets say for one paragraph), and paste it into an email message, I don't see the tracking for changes that I made personally. In other words: if the changes were made by someone else, then the tracking is included. But if the changes were made by me, they're not included in the Outlook paste. The Word document, however, shows ALL the changes and the tracking for each (whether I made them or someone else). I'm baffled as to why my tracking don't show in Ou...

MS Word and Track in CRM button
Sometimes the buttons "Track in CRM" and "Regarding" appear in MS Word. Clicking the track-button causes a crash of MS Word. I like the possibility to track a word document in CRM from Word, but I'm sure this is not standard functionality. (-; What is the cause of this problem and how can it be solved? Any help appreciated. Delta-N B.V. This issue shows up when you are using Word as your email editor for Outlook. What is happening is that the CRM toolbar used for tracking email in CRM is also being displayed by Word. Clicking on this button in Word will not...

CRM4/RU5 User Cannot Track Delegated Calendar Items
Hi, We are using CRM 4 on rollup 5 (client and server) and our users cannot track e-mail or calendar items in CRM where they have delegate rights to the inbox/calendar in question. Prior to the rollout of rollup 5 there was patchy access (sometimes the option was there, sometimes not) but now there seems to be no CRM access when in another user's calendar/mailbox. Is there any way around this? Thanks in advance, Tony. ...

Problem with Tracking Tab of Meeting
Hi, I have a meeting that was scheduled and invitations were sent to the persons that would be attending the meeting, and they have each sent me a response indicating to accept, decline, change or mark tentative their attendance. I either open or delete the response. I have seen this same process update the tracking tab of a meeting in the calendar, but somehow it is not happening now. I tested in another new meeting and still the tracking tab is reporting None in the Response field. I then opened one of the responses in the inbox and the meeting did not update the response field. I ...

TRACKING CHANGES
I'M UPDATING A PUBLISHER DOC AND WOULD LIKE TO KEEP TRACK OF CHANGES, IN WORD UNDER TOOLS YOU CAN DO IN TRACK CHANGES. ANYONE? -- VERONIQUE Publisher does not have that option. -- JoAnn Paules Microsoft MVP - Publisher How to ask a question http://support.microsoft.com/kb/555375 "VERONIQUE" <VERONIQUE@discussions.microsoft.com> wrote in message news:97E4D8C6-5A50-4F18-B7C3-92F89EF60599@microsoft.com... > I'M UPDATING A PUBLISHER DOC AND WOULD LIKE TO KEEP TRACK OF CHANGES, IN > WORD > UNDER TOOLS YOU CAN DO IN TRACK CHANGES. > ANYONE? > -- &g...

Tracking House Refinance
What is the best way to track mortgage refinancing, particularly if it includes taking money out for other purposes? See http://www.bollar.org/msmoney/#Q86. "Todd Stine" <anonymous@discussions.microsoft.com> wrote in message news:5ed201c400f1$992629f0$a001280a@phx.gbl... > What is the best way to track mortgage refinancing, > particularly if it includes taking money out for other > purposes? ...

Track Changes: Making "All" the default
hello: We are tracking changes on a workbook posted on Sharepoint. Everytime i check out the doc and view it, i must change the Track Changes default from "last time I saved" to "All". How do I make "All" the default so that users do not have to open Track Changes and make this selection (from the "When" pulldown.)?? Much appreciated, Bettergains ...

CRectTracker
In a MDI app I've got a CSrollView derived class (CMyScrollView) containing a CRectTracker object MyTracker In CMyScrollView I handle ON_WM_SETCURSOR() like this BOOL CMyScrollView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { BOOL bRetVal = MyTracker.SetCursor(nHitTest, message); if (bRetVal == FALSE) bRetVal = CScrollView::OnSetCursor(pWnd, nHitTest, message); return bRetVal } BOOL CMyTracker::SetCursor(UINT nHitTest, UINT message) { BOOL bHandled = FALSE; if (some test to find out if the tracker is visible) bHandled = CRectTracker::SetCursor(pOwner, nHi...