FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour align get
Posts: 117
Joined: Mon Aug 13, 2007 05:22 PM
align get
Posted: Fri Aug 19, 2016 11:57 AM

Hello

how do I align get right into resource

DEFINE DIALOG oDlg RESOURCE 'SV_DATA' TITLE "teste get"

  REDEFINE GET oGet VAR nNota  ID 101 OF oDlg

 REDEFINE BUTTON oBtn              ID 102 OF oDlg

ACTIVATE DIALOG oDlg CENTERED

? oGet:LRIGHT
? oGet:RIGHT

so it goes

@ 07, 28 GET nvalor OF oDlg PICTURE "999,999.99" COLORS "B/BG" SIZE 60,10 RIGHT

Marcelo Ferro da Silveira

Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8

SqlLib /xMate/WS
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Fri Aug 19, 2016 12:51 PM

In the resource, you have to use style ES_RIGHT instead of style ES_LEFT.

EMG

Posts: 117
Joined: Mon Aug 13, 2007 05:22 PM
Re: align get
Posted: Fri Aug 19, 2016 01:00 PM
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

already I tried so
DEFINE DIALOG oDlg RESOURCE 'SV_DATA' TITLE "teste get"

REDEFINE GET oGet VAR nNota ID 101 OF oDlg

REDEFINE BUTTON oBtn ID 102 OF oDlg

oGet:nStyle = nOR( WS_CHILD, WS_VISIBLE,;
ES_AUTOHSCROLL,;
WS_TABSTOP ,;
WS_CLIPSIBLINGS,;
0 ,;
0 ,;
---->>>> ES_RIGHT )


ACTIVATE DIALOG oDlg CENTERED

already I tried so
ACTIVATE DIALOG oDlg ON init ( oGet:nStyle = nOR( WS_CHILD, WS_VISIBLE,;
ES_AUTOHSCROLL,;
WS_TABSTOP ,;
WS_CLIPSIBLINGS,;
0 ,;
0 ,;
---->>>> ES_RIGHT ) )

already I tried so
ACTIVATE DIALOG oDlg CENTERED ON INIT ( ChangeAlignment( Get ) )

Static Procedure ChangeAlignment( poGet )

//--Already tried
SetTextAlign( poGet:hDC, 2 ) //-- TA_RIGHT = 2
poGet:Refresh()

Return


neither functioned
Marcelo Ferro da Silveira

Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8

SqlLib /xMate/WS
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Fri Aug 19, 2016 01:06 PM
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


You can't:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb775464(v=vs.85).aspx

EMG
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Fri Aug 19, 2016 01:09 PM

I think the only option is to destroy the control and then recreate it with the new style.

EMG

Posts: 117
Joined: Mon Aug 13, 2007 05:22 PM
Re: align get
Posted: Fri Aug 19, 2016 02:15 PM
Enrico Maria Giordano wrote:I think the only option is to destroy the control and then recreate it with the new style.

EMG




I consulted the fiveWin manager in Brazil he said there is another way , and does not see it as today. Does anyone out there know how to do?
Marcelo Ferro da Silveira

Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8

SqlLib /xMate/WS
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Fri Aug 19, 2016 02:19 PM

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

Posts: 117
Joined: Mon Aug 13, 2007 05:22 PM
Re: align get
Posted: Fri Aug 19, 2016 03:10 PM
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



if he answers put me here in the forum . Will Linares could not help us with that?
Marcelo Ferro da Silveira

Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8

SqlLib /xMate/WS
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: align get
Posted: Mon Aug 22, 2016 06:18 AM
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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: align get
Posted: Mon Aug 22, 2016 06:25 AM
See this:

https://blogs.msdn.microsoft.com/oldnewthing/20090525-00/?p=18173/

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)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Mon Aug 22, 2016 08:13 AM
Great! This is a sample:

Code (fw): Select all Collapse
#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


EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: align get
Posted: Mon Aug 22, 2016 08:28 AM

Enrico,

Is it working fine ?

Parameters for SETWINDOWPOS() are not correct

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: align get
Posted: Mon Aug 22, 2016 08:52 AM
Ops! Strangely enough, it was working. Anyway, this should be the correct version:

Code (fw): Select all Collapse
#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


EMG
Posts: 117
Joined: Mon Aug 13, 2007 05:22 PM
Re: align get
Posted: Mon Aug 22, 2016 11:22 AM

Thank Linares

Marcelo Ferro da Silveira

Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8

SqlLib /xMate/WS

Continue the discussion