|
Aaaahhh!!! How annoying! I wish it couldn've told me it was a stupid syntax error!
Danny
The stupidity of others amazes me!
|
|
|
|
|
The OP missed the semicolon at the end of the class declaration?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
OP? I assume you mean the compiler? In that case, yes, it missed it. How annoying!
Danny
The stupidity of others amazes me!
|
|
|
|
|
|
Oh, thanks. Yes, and I feel dumb for having missed it.
Danny
The stupidity of others amazes me!
|
|
|
|
|
Hi everyone,
I hope that someone can help me solve my problem...
Well, I would like to click-and-drag the child window and move it within its parent!
From child's window procedure, catching WM_MOUSEMOVE, I tried to call SendMesage(hWndParent,WM_MOUSEMOVE, NULL, NULL) in order to make it move.
Well it does not work! I tried Handling WM_MOUSEMOVE from the parent only but the child window would move with the mouse only whan the mouse leaves the child and 'touches' the parent window!
Is there anyone who can, in simple C++, help me to get over this issue?!
Thanks!
|
|
|
|
|
... SS_NOTIFY ....
see one thread below
SkyWalker
|
|
|
|
|
Frstly thanks to SkyWalker for the agility.
Unfortunately it will not work with the SS_NOTIFY because I referred to the windows which I created from the scratch, i.e. I did not use the MFC.
I have two windows involved, one is the main app’s window and the other one is created with the extended style, which identifies it as a child window (WS_CHILD).
I managed to move the child window by calling SetWindowPos while catching WM_MOUSEMOVE events from the parent window!
The thing is that, while with the mouse over the child window, I do not know how to catch WM_MOUSEMOVE of the parent. Naturally while over the child window all messages are going to that window!
I hope that the picture of my problem is slightly clearer.
|
|
|
|
|
Then you have to treat the event in the PreTranslateMassage() of the app class.
SkyWalker
|
|
|
|
|
Hi -
I did this.
The best way to do it is to have the child window capture the mouse input and move itself.
MFC makes it easy to do. You can do it with a WIN32 API windProc - but it's more straight foward in MFC.
void myStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::SetCapture(*this) ;
::OutputDebugString("myStatic::OnLButtonDown\n") ;
mdown = 1 ;
m_x = point.x ;
m_y = point.y ;
// CStatic::OnLButtonDown(nFlags, point);
}
void myStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if( mdown )
{
::OutputDebugString("myStatic::OnMouseMove\n") ;
RECT lrect ;
::GetWindowRect(*this,&lrect) ;
point.x -= m_x;// modify the pt with the saved point
point.y -= m_y;
POINT lpt ;
lpt.x = lrect.left ;
lpt.y = lrect.top ;
::ScreenToClient(*this->GetParent(),&lpt) ;
lpt.x += point.x ;
lpt.y += point.y ;
::SetWindowPos( *this, 0, lpt.x, lpt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
}
// CStatic::OnMouseMove(nFlags, point);
}
void myStatic::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if( mdown )
{
mdown = 0 ;
::OutputDebugString("myStatic::OnLButtonUp\n") ;
::ReleaseCapture() ;
}
// CStatic::OnLButtonUp(nFlags, point);
}
- Joe
-- modified at 16:28 Thursday 20th October, 2005
|
|
|
|
|
Hi,
I am developing and application that requires images manipulation.
All the interface is developped using Dialogs.
The controls were images are displayed are derived from CStatic control.
The problem is that I cannot catch the OnLButtonDown event straight in the CStatic control. I must catch the OnLButtonDown event in the dialog and then call the OnLButtonDown member function for each of my controls.
This doesn't happend with a CButton derived class.
I will apreciate any help.
Thank you.
Cédric
-- modified at 10:05 Thursday 20th October, 2005
|
|
|
|
|
And why don't you make it a custom control instead ?
I never subclassed a CStatic control so I cannot answer your question but for me it looks like a custom control instead.
|
|
|
|
|
The CStatic control must have the SS_NOTIFY> style.
Check "Notify" within the "Style" properties tab.
SkyWalker
-- modified at 10:27 Thursday 20th October, 2005
|
|
|
|
|
I already tried this but it didn't work!
I also tried to override the OnCreate member function but it is not called!
Thank's.
|
|
|
|
|
This cannot be
Make a break point in the mouse button handler. Tell me if it goes there.
If not, I send you tomorrow a piece of code.
SkyWalker
|
|
|
|
|
Sorry it worked!
I had a wrong statement in my OnLButtonDown(), and the break point was after!
The Notify style was the solution!
Thank you for your help!
|
|
|
|
|
HI
I don`t know how to write in an xml file through mfc. The whole file has to be written. Also, the file has to be created from mfc code. I am working on VS 6 in windows XP environment.
Thanx a lot
|
|
|
|
|
|
Can you use the DOMDocument or IXMLDOMDocument2 interface?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
http://www.codeproject.com/soap/markupclass.asp
in this article, after creating the xml,u can store the xml in a CString (CString csXML = xml.GetDoc();)
if u r creating the File using MFC ie CFile
char* ptoxml=csXML.GetBuffer(csXML.GetLength()+1);
CFile::Write((LPVOID)ptoxml,csXML.GetLength()+1);
|
|
|
|
|
as Sunit5 has mentioned MarkUp class is good alternative for writing and reading XML file but.. By My Personel Preferenc would you learn XMLDOM object ( if time permits you) other wise MARKUP class is good alternative
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi
I have TreeView Application which which appends tree nodes to the root at run time.the problem is that when v left click on the tree node label during run time it gets replicated.
eg: RootNode
--->sample1(these nodes are generated at run time)
--->sample2
......
if v click on sample2(eg) at run time it displays as follows
Rootnode
-->sample1
--->sample2
--->sample2
--->sample2
--->sample3
this problem occurs randomly without any particular series.
the code is as follows:
void CJobTreeCtrl::ProcessLeftBtnSelect(HTREEITEM mhtvClicked_Item, UINT nFlags, CPoint point)
{
SetFocus();
mhtvitmclicked = mhtvClicked_Item;
if (GetItemState(mhtvClicked_Item, TVIS_SELECTED) & TVIS_SELECTED)
{
mblnIsSelectPending = true;
mpntClick = point;
}
else
{
SelectMultiple(mhtvClicked_Item, nFlags);
mblnIsSelectPending = false;
}
}
how to rectify this
Thanx in advance
|
|
|
|
|
The only time an item will be added to the tree control is when you call InsertItem(). What I would do is do a search of your code for "InsertItem" and place a breakpoint by every line that you find. Then run your program. Just skip over the breakpoints (press F5) that you hit when the app starts. When your app is up and running click on an item in the tree control, the debugger should stop your app on the line that is calling InsertItem to duplicate the current item. Use the call stack to figure out how you got there from the click event.
HTH
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
hi,
The problem i am facing with ur suggestion is i could not
click on the tree nodes being generated at run time while debugging.
As the nodes are appended at run time , i could only see the application for a split of second and i dont have the oppurtunity to click on tree nodes while debugging
|
|
|
|
|
Which is why I said "Just skip over the breakpoints (press F5) that you hit when the app starts. When your app is up and running click on an item in the tree control".
Just keep hitting F5 until the tree is populated. Then you can click on a node.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|