I'm not asking for the moon... Resolved!!

Re: I'm not asking for the moon...

Postby Otto » Fri Jan 19, 2024 8:16 am

Hello Silvio,
I'm sorry I can't be of more help.
Here, when I use STRTRAN() in addition to Cesar's code, I get the desired result.
Maybe you could post the example including xbrowse(), so we can replicate the problem.

But my focus is on a different approach now.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: I'm not asking for the moon...

Postby Silvio.Falconi » Fri Jan 19, 2024 8:42 am

Otto wrote:Hello Silvio,
I'm sorry I can't be of more help.
Here, when I use STRTRAN() in addition to Cesar's code, I get the desired result.
Maybe you could post the example including xbrowse(), so we can replicate the problem.

But my focus is on a different approach now.
Best regards,
Otto



I insert a test on Previous message
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: I'm not asking for the moon...

Postby Otto » Fri Jan 19, 2024 9:26 am

Why don't you try using STRTRAN(). It is the solution here.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: I'm not asking for the moon...

Postby Silvio.Falconi » Fri Jan 19, 2024 9:40 am

Otto wrote:Why don't you try using STRTRAN(). It is the solution here.


where i I must put STRTRAN????????
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: I'm not asking for the moon...

Postby Jimmy » Fri Jan 19, 2024 9:49 am

hi Silvio,

i have try your Sample and it seems me "wrong PICTURE" for "Calculater" Style

Code: Select all  Expand view
*   local cPicture:="@Z 999.99"
   local cPicture:="@S@F6.2"

but you need to use "." and not "," (Komma) from NotePad
Code: Select all  Expand view
aGet[1]:bLostFocus := {|| (aGet[1]:Assign(),aGet[1]:cText := STR(VAL(STRTRAN(aGet[1]:cText,",","."))), aGet[1]:Refresh()) }
aGet[2]:bLostFocus := {|| (aGet[2]:Assign(),aGet[2]:cText := STR(VAL(STRTRAN(aGet[2]:cText,",","."))), aGet[2]:Refresh()) }
aGet[3]:bLostFocus := {|| (aGet[3]:Assign(),aGet[3]:cText := STR(VAL(STRTRAN(aGet[3]:cText,",","."))), aGet[3]:Refresh()) }
aGet[4]:bLostFocus := {|| (aGet[4]:Assign(),aGet[4]:cText := STR(VAL(STRTRAN(aGet[4]:cText,",","."))), aGet[4]:Refresh()) }

aGet[1]:bGotFocus := {|| (aGet[1]:cText := STR(VAL(STRTRAN(aGet[1]:cText,",","."))), aGet[1]:Refresh(),aGet[1]:SelectAll()) }
aGet[2]:bGotFocus := {|| (aGet[2]:cText := STR(VAL(STRTRAN(aGet[2]:cText,",","."))), aGet[2]:Refresh(),aGet[2]:SelectAll()) }
aGet[3]:bGotFocus := {|| (aGet[3]:cText := STR(VAL(STRTRAN(aGet[3]:cText,",","."))), aGet[3]:Refresh(),aGet[3]:SelectAll()) }
aGet[4]:bGotFocus := {|| (aGet[4]:cText := STR(VAL(STRTRAN(aGet[4]:cText,",","."))), aGet[4]:Refresh(),aGet[4]:SelectAll()) }
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: I'm not asking for the moon...

Postby Silvio.Falconi » Fri Jan 19, 2024 10:02 am

Jimmy wrote:hi Silvio,

i have try your Sample and it seems me "wrong PICTURE" for "Calculater" Style

Code: Select all  Expand view
*   local cPicture:="@Z 999.99"
   local cPicture:="@S@F6.2"

but you need to use "." and not "," (Komma) from NotePad
Code: Select all  Expand view
aGet[1]:bLostFocus := {|| (aGet[1]:Assign(),aGet[1]:cText := STR(VAL(STRTRAN(aGet[1]:cText,",","."))), aGet[1]:Refresh()) }
aGet[2]:bLostFocus := {|| (aGet[2]:Assign(),aGet[2]:cText := STR(VAL(STRTRAN(aGet[2]:cText,",","."))), aGet[2]:Refresh()) }
aGet[3]:bLostFocus := {|| (aGet[3]:Assign(),aGet[3]:cText := STR(VAL(STRTRAN(aGet[3]:cText,",","."))), aGet[3]:Refresh()) }
aGet[4]:bLostFocus := {|| (aGet[4]:Assign(),aGet[4]:cText := STR(VAL(STRTRAN(aGet[4]:cText,",","."))), aGet[4]:Refresh()) }

aGet[1]:bGotFocus := {|| (aGet[1]:cText := STR(VAL(STRTRAN(aGet[1]:cText,",","."))), aGet[1]:Refresh(),aGet[1]:SelectAll()) }
aGet[2]:bGotFocus := {|| (aGet[2]:cText := STR(VAL(STRTRAN(aGet[2]:cText,",","."))), aGet[2]:Refresh(),aGet[2]:SelectAll()) }
aGet[3]:bGotFocus := {|| (aGet[3]:cText := STR(VAL(STRTRAN(aGet[3]:cText,",","."))), aGet[3]:Refresh(),aGet[3]:SelectAll()) }
aGet[4]:bGotFocus := {|| (aGet[4]:cText := STR(VAL(STRTRAN(aGet[4]:cText,",","."))), aGet[4]:Refresh(),aGet[4]:SelectAll()) }
 


Error description: Error BASE/1073 Argument error: <
Args:
[ 1] = C 0.75
[ 2] = N 0

Stack Calls
===========
Called from: ../../../tget.prg => TCLIPGET:PUTMASK( 0 )
Called from: ../../../tget.prg => TCLIPGET:UPDATEBUFFER( 0 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: I'm not asking for the moon...

Postby Silvio.Falconi » Fri Jan 19, 2024 10:07 am

Otto wrote:Why don't you try using STRTRAN(). It is the solution here.



Yes, do you test with STRTRAN ? run all ok ? sure ?


IF nMode==2 //modify
ntest1 := STRTRAN(str(oBrowse:aArraydata[nRecord][2]), ".", ",")
ntest2 := STRTRAN(str(oBrowse:aArraydata[nRecord][3]), ".", ",")
ntest3 := STRTRAN(str(oBrowse:aArraydata[nRecord][4]), ".", ",")
ntest4 := STRTRAN(str(oBrowse:aArraydata[nRecord][5]), ".", ",")
Endif


Image

test with strtran not run , so tell me where I wrong

Code: Select all  Expand view

#include "Fivewin.ch"
#include "xbrowse.ch"

  REQUEST DBFCDX


Function main()
local     nWd  := GetSysMetrics(0) * .58
local     nHt  := GetSysMetrics(1) / 2.5
local oDlg,oFont,oBold
local oBrw,oBar
local oBtn:=array(3)
local aData:= {}
local cCod_temp:= "00001" // to demo
local oDbf
local cDir:= cFilePath(GetModuleFileName( GetInstance() ))  + "Data\"



 RddSetDefault( "
DBFCDX" )

       SetHandleCount( 100 )
       FWNumFormat( "
E", .t. )

       SET DATE FORMAT "
dd-mm-yyyy"
       SET DELETED     ON
       SET CENTURY     ON
       SET EPOCH TO    year( date() ) - 20
       SET MULTIPLE    OFF



 oFont := TFont():New( "
Tahoma", 0, 18,, )
 oBold  := TFont():New( "
Tahoma", 0, 16,,.t. )


        // Creation Dbf for Demo test
           Build_Dbf(cDir) // create dbf

        // Open dDbf
      oDbf:=TSample():New()
       oDbf:setorder(1)
       oDbf:Gotop()

  // take the records for cCod_temp
  aData := oDbf:DbfToArray( , { ||FIELD->cod == cCod_temp  } )





DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL ;   //TRUEPIXEL
       TITLE "
test numeric" ;
       FONT oFont   COLOR CLR_BLACK, CLR_WHITE ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)
//---------------------------------------------------------------------//
DEFINE BUTTONBAR oBar OF oDlg  SIZE 80,70  BOTTOM NOBORDER  2015
DEFINE BUTTON oBtn[1] OF oBar  ;
      FILENAME "
DLG_NO";
      PROMPT "
Add" TOOLTIP "Esci" ;
      ACTION   Modify(oBrw,1,oFont)

      DEFINE BUTTON oBtn[2] OF oBar  ;
      FILENAME "
HLP_DLG";
      PROMPT "
Modify" TOOLTIP "Aiuto" ;
      ACTION Modify(oBrw,2,oFont)   GROUP

      DEFINE BUTTON oBtn[3] OF oBar  BTNRIGHT  ;
      FILENAME "
DLG_OK";
      PROMPT "
Exit" ;
      TOOLTIP "
Conferma i dati" ;
      ACTION   ( oDlg:end( IDOK ) )
//--------------------------------------------------------------------------//

   @  2, 5 XBROWSE  oBrw OF oDlg ;
              COLUMNS  2,3,4,5;
              HEADERS "
Peso1","Peso2","Peso3","Peso4" ;
              COLSIZES 90,90,90,90 ;
              ARRAY aData      ;
              SIZE -5,-60 PIXEL   STYLE FLAT NOBORDER

        WITH OBJECT oBrw
            :lHScroll  := .f.
            :CreateFromCode()
         END

 ACTIVATE DIALOG oDlg CENTERED ;
       ON INIT (  oDlg:resize(),   ChangeButtons( oBar ) )


 return nil
//------------------------------------------------------------------//

 function ChangeButtons( oBar )
   AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
return .T.







FUNCTION Modify(oBrowse,nMode,oFont)  // cesar test
   LOCAL oDlg1, oGet := array(4)
   local nVar := {'     0','     0','     0','     0'}, oBot1

   local nRecord:= oBrowse:nArrayAt
   local ntest1,ntest2,ntest3,ntest4
   local cPicture:="
@9" //"@Z 999.99"
   local aGet:= array(4)
   local     nWd  := GetSysMetrics(0) * .58
   local     nHt  := GetSysMetrics(1) / 4
   local oBtn1,oBtn2,oBar



IF nMode==2 //modify
     ntest1    := STRTRAN(str(oBrowse:aArraydata[nRecord][2]), "
.", ",")
     ntest2    := STRTRAN(str(oBrowse:aArraydata[nRecord][3]), "
.", ",")
     ntest3    := STRTRAN(str(oBrowse:aArraydata[nRecord][4]), "
.", ",")
     ntest4    := STRTRAN(str(oBrowse:aArraydata[nRecord][5]), "
.", ",")
  Endif




SET CONFIRM ON
DEFINE DIALOG oDlg1 SIZE nWd, nHt PIXEL ;
       TITLE "
test numeric" ;
       FONT oFont   COLOR CLR_BLACK, CLR_WHITE ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)


    //-------------------------------------------------------------------//
      DEFINE BUTTONBAR oBar OF oDlg1 SIZE 70,70  2015   BOTTOM NOBORDER
      DEFINE BUTTON oBtn1 OF oBar  ;
      FILENAME "
DLG_NO";
      PROMPT "
Annulla" TOOLTIP "Esci" ;
      ACTION   ( oDlg1:end( IDCANCEL ) )

      DEFINE BUTTON oBtn2 OF oBar BTNRIGHT  ;
      FILENAME "
DLG_OK";
      PROMPT "
Conferma" ;
      TOOLTIP "
Conferma i dati" ;
      ACTION   ( oDlg1:end( IDOK ) )
      //-------------------------------------------------------------------//




      @ 70, 20  GET aGet[1] VAR ntest1   OF oDlg1 SIZE 32, 12 PIXEL  FONT oFont    PICTURE cPicture  UPDATE RIGHT
      @ 70, 82  GET aGet[2] VAR ntest2   OF oDlg1 SIZE 32, 12 PIXEL  FONT oFont    PICTURE cPicture  UPDATE RIGHT
      @ 70, 245 GET aGet[3] VAR ntest3   OF oDlg1 SIZE 32, 12 PIXEL  FONT oFont    PICTURE cPicture  UPDATE RIGHT
      @ 70, 295 GET aGet[4] VAR ntest4   OF oDlg1 SIZE 32, 12 PIXEL  FONT oFont    PICTURE cPicture  UPDATE RIGHT

aGet[1]:bLostFocus := {|| (aGet[1]:Assign(),aGet[1]:cText := STR(VAL(aGet[1]:cText) /100,6,2), aGet[1]:Refresh()) }
aGet[2]:bLostFocus := {|| (aGet[2]:Assign(),aGet[2]:cText := STR(VAL(aGet[2]:cText) /100,6,2), aGet[2]:Refresh()) }
aGet[3]:bLostFocus := {|| (aGet[3]:Assign(),aGet[3]:cText := STR(VAL(aGet[3]:cText) /100,6,2), aGet[3]:Refresh()) }
aGet[4]:bLostFocus := {|| (aGet[4]:Assign(),aGet[4]:cText := STR(VAL(aGet[4]:cText) /100,6,2), aGet[4]:Refresh()) }

aGet[1]:bGotFocus := {|| (aGet[1]:cText := STR(VAL(aGet[1]:cText) *100,6), aGet[1]:Refresh(),aGet[1]:SelectAll()) }
aGet[2]:bGotFocus := {|| (aGet[2]:cText := STR(VAL(aGet[2]:cText) *100,6), aGet[2]:Refresh(),aGet[2]:SelectAll()) }
aGet[3]:bGotFocus := {|| (aGet[3]:cText := STR(VAL(aGet[3]:cText) *100,6), aGet[3]:Refresh(),aGet[3]:SelectAll()) }
aGet[4]:bGotFocus := {|| (aGet[4]:cText := STR(VAL(aGet[4]:cText) *100,6), aGet[4]:Refresh(),aGet[4]:SelectAll()) }



   ACTIVATE DIALOG oDlg1 CENTERED ;
       ON INIT (  oDlg1:resize(),   ChangeButtons( oBar ) )
       IF oDlg1:nresult == IDOK
              oBrowse:aArraydata[nRecord][2]:= ntest1
              oBrowse:aArraydata[nRecord][3]:= ntest2
              oBrowse:aArraydata[nRecord][4]:= ntest3
              oBrowse:aArraydata[nRecord][5]:= ntest4
      endif
RETURN nil

//------------------------------------------------------------------------------------//
Function Build_Dbf(cDir)
    local lAppend     := .F.
   FIELD cod

            local aFields := { {  "
Cod",       "C",   5, 0 },;
                               {  "
test1",     "N",   6, 2 },;
                               {  "
test2",     "N",   6, 2 },;
                               {  "
test3",     "N",   6, 2 },;
                               {  "
test4",     "N",   6, 2 }}

   IF !lIsDir(alltrim(cDir))
       IF !lMkDir(cDir)
          MsgAlert("
Attention")
       ENDIf
    ENDIf



 if File( cdir+"
sample.dbf" )
      if !File( cdir+"
sample.cdx" )
         USE  &(cdir+"
sample") NEW EXCLUSIVE ALIAS DB
           INDEX ON Cod          TAG COD  FOR !Deleted()
         CLOSE DB
      endif
   else
      DbCreate( cdir+"
sample.dbf", aFields, "DBFCDX", .T., "DB" )
      lAppend  := .T.
         INDEX ON Cod         TAG COD  FOR !Deleted()
         CLOSE DB
      endif

/// add test


   if lAppend
      USE  &(cdir+"
sample") NEW EXCLUSIVE ALIAS DB
      INDEX ON Cod         TAG COD  FOR !Deleted()

   APPEND BLANK
      REPLACE COD WITH "
00001"
      REPLACE TEST1 WITH  0.10
      REPLACE TEST2 WITH  0.20
      REPLACE TEST3 WITH  3.60
      REPLACE TEST4 WITH  0.70
  APPEND BLANK
      REPLACE COD WITH "
00001"
      REPLACE TEST1 WITH  0.75
      REPLACE TEST2 WITH  0.20
      REPLACE TEST3 WITH  3.60
      REPLACE TEST4 WITH  0.50
   APPEND BLANK
      REPLACE COD WITH "
00001"
      REPLACE TEST1 WITH 1.2
      REPLACE TEST2 WITH 0.20
      REPLACE TEST3 WITH 3.60
      REPLACE TEST4 WITH 0.4

         CLOSE DB
   Endif
RETURN NIL


//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//

 CLASS TXData from TDatabase
    DATA cDbfPath init cFilePath(GetModuleFileName( GetInstance() ))  + "
Data\"
  ENDCLASS

CLASS TSample from TXData
METHOD New()
ENDCLASS

METHOD New( lShared ) CLASS TSample
   Default lShared := .t.
   ::super:New(,::cDbfPath + "
Sample" ,"DBFCDX", lShared)
   if ::use()
      ::setOrder(1)
      ::gotop()
   endif
   RETURN Self
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//









Image

then when I digit came me all "*"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: I'm not asking for the moon... Resolved!!

Postby Silvio.Falconi » Fri Jan 19, 2024 7:37 pm

Resolved!

Otto,
no strtran !!!

Cesar,
No bgotfocus and blostfocus

Jimmy,
No "@9" picture

Resolved !!!
Only in my initial test was the statement missing: FWNumFormat( "E", .t. )
and the picture to put is "@E ###.##"

Now it seems run ok as U can see on video


Image



THANKS TO RAO
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: I'm not asking for the moon... Resolved!!

Postby paquitohm » Fri Jan 19, 2024 8:43 pm

¿ No hay gracias para los que intentaron ayudar ?
Algunos ya pasamos por el trance y desistimos por siempre jamás
paquitohm
 
Posts: 266
Joined: Fri Jan 14, 2022 8:37 am

Re: I'm not asking for the moon... Resolved!!

Postby Otto » Fri Jan 19, 2024 9:35 pm

Great that you have a solution. I have been dealing a bit with the issue that the numbers are filled from right to left and
that one can navigate with the TAB key, with the cursor always standing on the right in overwrite mode.

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests