Page 1 of 1

Get right to leff

Posted: Fri May 11, 2018 2:34 pm
by Wanderson
Hi,

How I can set get to show right to left? Like this:

01 Left RIGHT
02 (Default)
03
04 ___.___,__ ___.___,__
05 1__.___,__ ___.__1,__
06 12_.___,__ ___._12,__
07 123.___,__ ___.123,__
08 123.4__,__ __1.234,__
09 __1.234,__ __1.234,5_
10 __1.234,5_ __1.234,56
11 __1.234,56 __1.234,56

Thanks in advance!

Re: Get right to leff

Posted: Sun May 13, 2018 1:49 am
by nageswaragunupudi

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg, oGet, oFont
   local nVar, cVar, cPic, nCent

   SetGetColorFocus()

   nVar        := 0
   cPic        := "999,999,999,999" // Can have any number of decimals
   nCent       := 10 ^ LEN( AFTERATNUM( ".", cPic ) )
   cPic        += " "
   cVar        := TRANSFORM( nVar, cPic )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 400,300 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 GET oGet VAR cVar SIZE 200,24 PIXEL OF oDlg RIGHT

   WITH OBJECT oGet
      :bGotFocus  := { || oGet:SetPos( Len( oGet:oGet:buffer ) ) }
      :bKeyChar   := <|nKey,nFlags|
         if nKey >= 0x30 .and. nKey <= 0x39
            nVar        := nVar * 10 + ( nKey - 0x30 ) / nCent
            oGet:cText  := Transform( nVar, cPic )
            oGet:SetPos( Len( oGet:oGet:buffer ) )
         endif
         if nKey == VK_TAB .or. nKey == VK_RETURN
            return nil
         endif
         return 0
         >
      :bKeyDown   := <|nKey,nFlags|
         if nKey == VK_DELETE .or. nKey == VK_BACK
            nVar        := Int( nVar * nCent / 10 ) / nCent
            oGet:cText  := Transform( nVar, cPic )
            oGet:SetPos( Len( oGet:oGet:buffer ) )
            return 0
         endif
         return nil
         >
   END

   @ 60,20 BUTTON "OK" SIZE 100,30 PIXEL OF oDlg ACTION MsgInfo( nVar )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 

Re: Get right to leff

Posted: Mon May 14, 2018 12:00 pm
by wartiaga
nageswaragunupudi wrote:

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg, oGet, oFont
   local nVar, cVar, cPic, nCent

   SetGetColorFocus()

   nVar        := 0
   cPic        := "999,999,999,999" // Can have any number of decimals
   nCent       := 10 ^ LEN( AFTERATNUM( ".", cPic ) )
   cPic        += " "
   cVar        := TRANSFORM( nVar, cPic )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 400,300 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 GET oGet VAR cVar SIZE 200,24 PIXEL OF oDlg RIGHT

   WITH OBJECT oGet
      :bGotFocus  := { || oGet:SetPos( Len( oGet:oGet:buffer ) ) }
      :bKeyChar   := <|nKey,nFlags|
         if nKey >= 0x30 .and. nKey <= 0x39
            nVar        := nVar * 10 + ( nKey - 0x30 ) / nCent
            oGet:cText  := Transform( nVar, cPic )
            oGet:SetPos( Len( oGet:oGet:buffer ) )
         endif
         if nKey == VK_TAB .or. nKey == VK_RETURN
            return nil
         endif
         return 0
         >
      :bKeyDown   := <|nKey,nFlags|
         if nKey == VK_DELETE .or. nKey == VK_BACK
            nVar        := Int( nVar * nCent / 10 ) / nCent
            oGet:cText  := Transform( nVar, cPic )
            oGet:SetPos( Len( oGet:oGet:buffer ) )
            return 0
         endif
         return nil
         >
   END

   @ 60,20 BUTTON "OK" SIZE 100,30 PIXEL OF oDlg ACTION MsgInfo( nVar )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Thank you so much Mr. Nages, but this is the easiest way? So many gets to change.

Re: Get right to leff

Posted: Mon May 14, 2018 2:07 pm
by Rick Lipkin
Rao

What are the < > markers .. should they be { codeblock .... }

Also ... If I need to trap arrow down and oRs:EOF with latest version on Fwh I can do something like :

Code: Select all

:bKeyChar   := {|nKey,nFlags|, if(nKey = VK_DOWN, If(oLbxB:bPastEof, _AddNewRow( ... ), ) )}
 
Something like the above ?

Thanks
Rick Lipkin

Re: Get right to leff

Posted: Wed May 16, 2018 4:46 am
by nageswaragunupudi
but this is the easiest way? So many gets to change.
The easiest way is to use FWH 18.04.

Re: Get right to leff

Posted: Wed May 16, 2018 12:36 pm
by wartiaga
nageswaragunupudi wrote:
but this is the easiest way? So many gets to change.
The easiest way is to use FWH 18.04.
Hi Nages,

What kind of changes in fwh18.04 to make easy this implementation?
Thank you!

Re: Get right to leff

Posted: Wed May 16, 2018 12:38 pm
by nageswaragunupudi
@ <r>, <c> GET <normal clauses> RIGHTTOLEFT <anymoreclauses>

Re: Get right to leff

Posted: Wed May 16, 2018 2:27 pm
by wartiaga
nageswaragunupudi wrote:@ <r>, <c> GET <normal clauses> RIGHTTOLEFT <anymoreclauses>
Great news! Thanks.