|
... 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!
|
|
|
|
|
hi,
I did exactly the way u said ,but the problem i'm facing is
once i start the run the nodes are being at run time.
the code is like this,
for(int i=0;i<ncount;i++)
{
="" strname="pDoc-">GetTraverseSpectralDataName(0,i);
TreeItem = m_treeCtrl->InsertItem(strName,5,5,m_hCS);
// kept my break point in the above line
m_treeCtrl->SetItemData(TreeItem,i);
}
now the corsor gets stuck in the for loop even is i press
F5 , my application appears for only a split of sec and
i could not have the chance of clicking on the samples (nodes)
as the nodes are generated continuously till the server stops.unless i click on the nodes at run time i could not find out why the duplicate sample(node) is being generated.
thanx for ur valuable suggestions
|
|
|
|
|
vamshin wrote: as the nodes are generated continuously till the server stops
What do you mean by "continously"? Do you mean that the loop runs once to fill the tree once at app startup (ie: adds say 1000 nodes and stops)? or do you mean that as long as the app is running, be it five minutes or five hours, there is always nodes being added to the tree? How about you change your code temporarily so that it only adds a few items (say 10) to the tree just to make debugging easier.
"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
I want to make scrolling marquee which scrolls from right to left horizontally in my dialog based MFC application.
I have used timer and at perticular interval I am showing my text again and again at few fixels ahead of last time i have shown.
But it creates problem when I make my font size very big e.g. Font height of 200.
I have also tried the CBannerStatic class given here in codeproject example. But it also gets very slow when I make my font very big.
Is there a way through which I can show big text font whith smoothly moving marquee.
Any idea any program will definitely help me.....
Thanking you
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
I sent an image ticker to genaro picazo here at CP some time ago. Ask him,
or drop me an e-mail to send it also to you.
SkyWalker
|
|
|
|
|
Use a memory bitmap. Draw your text onto the bitmap (preferably only once when the app starts) and use bitblt() to draw the bitmap onto the screen at the postion required.
"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 all
I am trying to open a workspace by opening .dsw ..but visual studio is empty ...nothing is opened !!!
And I opened .dsp ..it created a new .dsw ..with this new dsw also the workspace not opened ...!!
Have never seen such things before ...
anyone faced it before ? Any clues why its happening ?
I am sure there is no makefiles in the workspace
redindian
|
|
|
|