Enrico Maria Giordano wrote:In the resource, you have to use style ES_RIGHT instead of style ES_LEFT.
EMG
marca wrote:Enrico Maria Giordano wrote:In the resource, you have to use style ES_RIGHT instead of style ES_LEFT.
EMG
hello Enrico!!!
I want to do at runtime
Enrico Maria Giordano wrote:I think the only option is to destroy the control and then recreate it with the new style.
EMG
Enrico Maria Giordano wrote:Have you read MS docs? They say it can't be done. Do you think MS docs are wrong? If you find a way please inform us. I'd also need to change this style on the fly.
EMG
Have you read MS docs? They say it can't be done. Do you think MS docs are wrong? If you find a way please inform us. I'd also need to change this style on the fly.
you can indeed change the alignement of an edit control at runtime. It works, therefore this blog entry is wrong.
————————————–
I wrote an MFC dialog with two buttons to modify the style of the edit control. here are the message handlers:
void CTestEditDlg::OnBnClickedButton1()
{
m_TestEdit.ModifyStyle( ES_RIGHT, ES_LEFT );
m_TestEdit.Invalidate();
}
void CTestEditDlg::OnBnClickedButton2()
{
m_TestEdit.ModifyStyle( ES_LEFT, ES_RIGHT );
m_TestEdit.Invalidate();
}
MFC’s ModifyStyle does SetWindowLong and SetWindowPos( SWP_FRAMCHANGED)
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet, cVar := SPACE( 35 )
DEFINE DIALOG oDlg
@ 1, 1 GET oGet VAR cVar
@ 2, 1 BUTTON "Change style";
ACTION CHANGESTYLE( oGet )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
#define GWL_STYLE -16
#define SWP_FRAMECHANGED 0x0020
STATIC FUNCTION CHANGESTYLE( oGet )
SETWINDOWLONG( oGet:hWnd, GWL_STYLE, NOR( GETWINDOWLONG( oGet:hWnd, GWL_STYLE ), ES_RIGHT ) )
SETWINDOWPOS( SWP_FRAMECHANGED )
oGet:Refresh()
RETURN NIL
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet, cVar := SPACE( 35 )
DEFINE DIALOG oDlg
@ 1, 1 GET oGet VAR cVar
@ 2, 1 BUTTON "Change style";
ACTION CHANGESTYLE( oGet )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
#define GWL_STYLE -16
#define SWP_FRAMECHANGED 0x0020
#define SWP_NOSIZE 1
#define SWP_NOMOVE 2
STATIC FUNCTION CHANGESTYLE( oGet )
SETWINDOWLONG( oGet:hWnd, GWL_STYLE, NOR( GETWINDOWLONG( oGet:hWnd, GWL_STYLE ), ES_RIGHT ) )
SETWINDOWPOS( oGet:hWnd, , , , , , NOR( SWP_FRAMECHANGED, SWP_NOMOVE, SWP_NOSIZE ) )
oGet:Refresh()
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 47 guests