Thread: MFC Question

  1. #1
    Unregistered
    Guest

    MFC Question

    Hi,

    How do you reposition/move a control in a dialog box using MFC.

    Thank You For Your Help,
    Matt

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    5
    This is similiar to a question I posted last week. This is the line of code I ended up using. Do a search in Help for an explanation on how to use it.

    m_ptrCEdit = CWnd::GetNextDlgTabItem(GetFocus(), false);

    I used the accelerator table to remap the arrow keys.

    Or in a different setting:

    m_editDiameterLength.SetFocus();

    jumps the focus to the m_editDiameterLength edit box...

    It took me two days last week to get this figured out.

    'til anon,
    Lyle

    ps please let us know if it works

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    223
    how 'bout


    //Somewhere in dialog

    CWnd* pWnd = GetDlgItem( IDC_MYCONTROL );


    //****
    ....determine new location you want here
    //****
    pWnd->SetWindowPos( NULL, xLocation, yLocation, 0, 0,
    SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOZORDER );

    if you already have a control asscociated with your window such as a CButton or CEdit myControl


    //****
    ....determine new location you want here
    //****
    m_ctlMyControl.SetWindowPos( NULL, xLocation, yLocation, 0, 0,
    SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOZORDER );

    with this function you can also resize your button... of course you have to change those 0s to with and height and get rid of the SWP_NOSIZE flag....
    zMan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC check box question
    By MyglyMP2 in forum Windows Programming
    Replies: 2
    Last Post: 03-09-2009, 05:47 PM
  2. MFC simple question
    By dole.doug in forum Windows Programming
    Replies: 5
    Last Post: 09-26-2008, 06:11 AM
  3. Window Resize question (MFC)
    By IfYouSaySo in forum Windows Programming
    Replies: 2
    Last Post: 11-16-2005, 12:34 PM
  4. MFC UI question
    By naruto in forum Windows Programming
    Replies: 1
    Last Post: 04-21-2005, 10:10 PM
  5. MFC Dialog App Screen Refresh Question
    By Scotth10 in forum Windows Programming
    Replies: 2
    Last Post: 10-18-2002, 02:07 PM