none
How to remove the WS_EX_LAYOUTRTL

    Question

  •  

    Hi .

    Can anyone help me to remove WS_EX_LAYOUTRTL from an editcontrol dynamically at runtime?

    I have an editcontrol in my mfc dialog from  that can change  it's layouts  to  RTL(right to left mirror ) at run time, but tired to remove this ExStyle and return it to LTR layout . . .

     

    here is the code :

     

    if(isRTL)

    {

    GetDlgItem(IDC_ENFA_TEXT)->ModifyStyleEx(0,WS_EX_LAYOUTRTL);

    GetDlgItem(IDC_ENFA_TEXT)->SetFocus();

    }

    else

    {

     

    GetDlgItem(IDC_ENFA_TEXT)->ModifyStyleEx(WS_EX_LAYOUTRTL,0);

    //GetDlgItem(IDC_ENFA_TEXT)->ModifyStyleEx(WS_EX_LAYOUTRTL,0,SWP_FRAMECHANGED);

    //RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW |RDW_ERASE|RDW_ALLCHILDREN);

    GetDlgItem(IDC_ENFA_TEXT)->SetFocus();

    }

    UpdateWindow();

     

     

    Friday, November 30, 2007 9:30 PM

Answers

  • Hello

     

    Try following code:

    Code Block

    LONG lStyle = ::GetWindowLong(GetDlgItem(IDC_ENFA_TEXT)->m_hWnd,GWL_EXSTYLE);
    lStyle &= ~WS_EX_LAYOUTRTL;
    ::SetWindowLong(GetDlgItem(IDC_ENFA_TEXT)->m_hWnd, GWL_EXSTYLE, lStyle);

     

    hope it helps

    rico

    Thursday, December 06, 2007 8:27 AM
    Moderator

All replies

  • Hello

     

    Try following code:

    Code Block

    LONG lStyle = ::GetWindowLong(GetDlgItem(IDC_ENFA_TEXT)->m_hWnd,GWL_EXSTYLE);
    lStyle &= ~WS_EX_LAYOUTRTL;
    ::SetWindowLong(GetDlgItem(IDC_ENFA_TEXT)->m_hWnd, GWL_EXSTYLE, lStyle);

     

    hope it helps

    rico

    Thursday, December 06, 2007 8:27 AM
    Moderator
  • Thanks !

    Friday, December 07, 2007 11:51 PM