Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
V

Vladislav Gospodinov

@Vladislav Gospodinov
About
Posts
6
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    So it doesn't TRACE() anything at all when called in

    CMainFrame::OnMouseMove

    so it's like it doesn't get the mouse moving at all in MainFrame class... it does trace correct values if I call it in the View class

    CpositionView::OnMouseMove

    however I can't find a way to send them from View to MainFrame, although I have included ***View.h and taka them like

    CpositionView::positionX

    I get a lot of errors :P

    C / C++ / MFC question data-structures help tutorial announcement

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    I can't rly get the debuger to stop there ... It's kinda like skipping it all? Any other way of checking ?

    C / C++ / MFC question data-structures help tutorial announcement

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    Yes... Seems like OnMouseMove doesn't update posX and posY. If I do :

    void CMainFrame::OnUpdateCursor(CCmdUI *pCmdUI){
    CString pos;
    posX=100;
    posY=200;
    pos.Format(L" x: %d ,y: %d ",posX,poxY);
    m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_CURSOR),pos);
    }

    It does put

    "x: 100,y: 200"

    in the status bar...

    C / C++ / MFC question data-structures help tutorial announcement

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    Nothing. Stays the same:

    "x: 0 , y: 0"

    C / C++ / MFC question data-structures help tutorial announcement

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    Well that is the problem :P I've added SetCapture() when you press LButton, but I'm not rly sure if I need it?

    void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
    {
    // TODO: Add your message handler code here and/or call default
    SetCapture();
    CFrameWnd::OnLButtonDown(nFlags, point);
    }

    void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
    {
    // TODO: Add your message handler code here and/or call default
    if(GetCapture()==this){
    posX=point.x;
    posY=point.y;
    }
    CFrameWnd::OnMouseMove(nFlags, point);
    }

    void CMainFrame::OnUpdateCursor(CCmdUI *pCmdUI){
    CString pos;
    pos.Format(ID_INDICATOR_CURSOR,posX,posY);
    m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_CURSOR),pos);
    }

    Well atleast now the sting is updated with 0's. Its defined as " x: %d ,y: %d ". So the OnUpdateCursor() is working but not with the right values...

    C / C++ / MFC question data-structures help tutorial announcement

  • How to get cursor position in status bar?
    V Vladislav Gospodinov

    Hello...This question may sound silly to some of you but I've been stuck on it for few days and can't find any answer... So I need to have the mouse position x and y displayed in the status bar. So far I add new string to the table, in the indicators array, afx_msg void OnUpdateCurPos(CCmdUI *pCmdUI) in the message map and ON_UPDATE_COMMAND_UI(ID_INDICATOR_CURSOR,OnUpdateCurPos) When I run it's there but can't find the right way to update the cords. I think it must work with ON_MOUSEMOVE func...I've tried several codes in ON_MOUSEMOVE and OnUpdateCurPos but it doesn't work at all... Working with SDI.

    C / C++ / MFC question data-structures help tutorial announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups