|
You can use CRect::PtInRect where the point is the mouse pointer and the Rect the TreeControl coordinates. Don't forguet to call CRect::NormalizeRect Before to call PtInRect
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
As you want to handle the WM_LBUTTONDOWN before it goes to the TreeCtrl, I would override PreTranslateMessage() as follows:
BOOL CYourDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_LBUTTONDOWN)
{
CPoint p ;
GetCursorPos(&p) ;
CWnd *pWnd = GetWindowFromPoint(p) ;
if (pWnd != NULL)
{
if (pWnd->GetDlgCtrlID() == ID_OF_TREE_CTRL && pWnd->GetParent() == this)
{
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Its all written from memory, so some calls/parameters etc may not be correct, but it should do something close to what you need.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
Hi, I am trying to use GetActiveIndex() in the property sheet to get the index of an active page. I encountered a problem in GetTabControl() which returns 0xcccccccc. I believe the setup of my property sheet and pages should be right by using DoModal() and AddPage(). Please give me some suggestions on troubleshooting this problem. Thanks!
|
|
|
|
|
Are you calling GetTabControl before DoModal?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
I called GetActiveIndex() after DoModal() and Addpages(). If I go straight to display data on the first page, it works fine when I am on the first page and vice versa on the other pages. However, I would like to display data by the active page which gives me more flexability.
|
|
|
|
|
Hi, I'm trying to create a save dialog box with 2 filters. How can i update the extention in the filename whenever the "Save As Type" box is highlighted.
Thanks
|
|
|
|
|
I've just started learning how to debug, and I'm still kinda new with C++ programming language.
I have two variables declared as doubles: x, slope
while debugging, I noticed that sometimes in the loop they're values came up as:
slope = 1.#INF000000000
x = -1.#IND000000000
what does that mean?....why does it happen?
|
|
|
|
|
(EDIT: Corrections)
1.#INF stands for positive infinity.
1.#IND stands for positive ideterminite.
If you add a negative, then they are negative infinity.
This can happen if a variable has yet to be initialized. It can also happen during ASCII to float conversions and math operations.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
So can I use that value just like other values in my code, for example in an if statement, could I say:
if(x==1.#INF)
{
//do stuff
}
or when I say
if(x>=9000)
{
//do stuff
}
will the infinite value be regarded as greater than 9000?
|
|
|
|
|
You can use _finite to test to see if a value is finite. Thus your NAN, QNAN, INF, IND should return false. (???)
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
1.#INF means positive infinity - usually you get it when you divide by zero. 1.#IND represents so-called 'quiet-nan' - for example, when you take the logarithm of negative value.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
So can I use that value just like other values in my code, for example in an if statement, could I say:
if(x==1.#INF)
{
//do stuff
}
or when I say
if(x>=9000)
{
//do stuff
}
will the infinite value be regarded as greater than 9000?
|
|
|
|
|
Don't - instead figure out what is setting the bad values.
Those numbers indicate that you are doing something wrong. If the variables are uninitialized there is no guarantee that they will always be the same. If you are dividing by 0 or taking the log of a negative number you should be checking your inputs because they are faulty.
Dave Huff
There are no small projects - only young ones.
|
|
|
|
|
1.INF/-1.INF = Positive/Negative infinity
1.IND/-1.IND = Positive/Negative indeterminate
1.QNAN/-1.QNAN = Positive/Negative quiet not-a-number
1.NAN/-1.NAN = Positive/Negative not-a-number
IEEE Reference information
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
Can someone tell me ,
How to show and handle CFormView in
an ActiveX Control.
Thanks,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
FormView wasn't really designed for placing in an activex control. What are you try to achieve as there may be a better way.
I'm guessing you are wanting an activex control made up on a number of other controls? Have a search on MSDN for composite controls.
Michael
|
|
|
|
|
Hi,
Actually trying to develop an ActiveX , where I can
show other some ActiveX's , which also needs to be dragged.
So I believe that I need CFormView for this.
According to the art Q155973, this is possible , but I am
unable to find the sample DLGX.EXE at microsoft.com,
any suggestions .
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
If you do not intend to take advantage of SDI/MDI architecture, it's much easier to embed a CDialog -based object, just by specifying the ActiveX window as the parent when creating the dialog. Some CRect arithmetic could be needed too in the process of embedding. If you follow this approach, you can even get scroll bars without much effort.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi,
1.how to find weather the item clicked is a root or leaf in a tree.
2.should the menu resource be initialised or something before loading it to diaplay popup menu because I get run time error saying the handle is null. I use the same procedure said all over this site.
help
|
|
|
|
|
Regarding (1):
Handle WM_LBUTTONDOWN. Use CTreeCtrl::HitTest to get HTREEITEM. CTreeCtrl::GetRootItem returns root, so simple comparison of HTREEITEMS will answer your question. If you need to check if item is leaf, call CTreeCtrl::GetChildItem and pass clicked HTREEITEM - if it returns NULL, your item is a leaf.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Hi,
I have a dialog-based MFC application. In response to a button
click on the dialog I need another dialog to popup. So far so good.
I also need the text in an edit field in Dialog_1 to appear in an
edit field in Dialog_2.
In short, I need parameters to be passed from one window to another.
How can I do this?
With best regards,
Sayan Mukherjee
(sayanmukherjee@indiatimes.com)
|
|
|
|
|
Add data members do dialog2 and initialize them before calling DoModal.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Your comment is FILTHY You are SICK
|
|
|
|
|
Did you forget to take your pills today?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Hi Tomasz
Initially I was confused as to his post too. The I guessed.
The sig must have upset him. Or if I guess right "upset her".
The anonymous poster is in all probability a woman
Your sig :- "** If you're going to rape, pillage and burn, be sure to do things in that order. **"
Nish
p.s. don't worry Tomasz. different people have different senses and levels of humor.
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|