strange behavior of a TGet

strange behavior of a TGet

Postby Silvio.Falconi » Wed May 12, 2021 7:41 am

I have 3 numeric get controls

when I insert a number in the first tget it would become the third update because it is a clause of the bchange and it performs a calculation

but if I delete the number in the first get it does not execute the bchange for the second time,

is normal or there is something wrong because in my opinion when I update a get automatically the third should be updated


Image

I had never noticed this problem, today trying the program I realized that there was something unusual
if I activate the bchange I cannot enter any number in the get
here the sample test

Code: Select all  Expand view  RUN

 
#include "fivewin.ch"

#include "report.ch"
#include "constant.ch"

 Function test()
   Local oDlgMod,oFont,oBold

   Local nBottom   := 19.7
   Local nRight    := 65.4
   Local nWidth    := Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight   := nBottom * DLG_CHARPIX_H
   local aGet[10]

   local nCosto,nSconto,nTotale

    nCosto   := 5.00
    nSconto  := 0
    nTotale  := 5.00


   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD
   DEFINE DIALOG oDlgMod SIZE nWidth, nHeight PIXEL ;
          TITLE "Modifica una tariffa base " FONT oFont ;
          COLOR CLR_BLACK,CLR_WHITE TRANSPARENT
  oDlgMod:lHelpIcon := .F.
  oDlgMod:nStyle    := nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )


  @ 96, 10  Say "Costo :" SIZE 90,10 PIXEL OF oDlgMod
  @ 94, 75 GET aGet[7] VAR nCosto   OF oDlgMod SIZE 60, 12 ;
            PIXEL PICTURE  '@ €99,999.99' RIGHT FONT oFont UPDATE ;
            ON CHANGE Calcolo_tariffa(nCosto,nSconto,@nTotale,aGet,oDlgMod)

  @ 96, 145  Say "Sconto :" SIZE 90,10 PIXEL OF oDlgMod
  @ 94, 175 GET aGet[8] VAR nsconto   OF oDlgMod SIZE 60, 12 ;
            PIXEL PICTURE  '@ €99,999.99' RIGHT FONT oFont UPDATE  ;
           ON CHANGE Calcolo_tariffa(nCosto,nSconto,@nTotale,aGet,oDlgMod)


           * ON CHANGE ((aGet[8]:assign(),ntotale:=  ncosto-nsconto),aGet[9]:assign(),aGet[9]:refresh())

   @ 116, 10  Say "Totale :" SIZE 90,10 PIXEL OF oDlgMod
   @ 114, 75 GET aGet[9] VAR ntotale    OF oDlgMod SIZE 60, 12 ;
            PIXEL PICTURE  '@ €99,999.99' RIGHT FONT oFont UPDATE


 @ 128,160  BUTTONBMP oBtnSave;
             PROMPT "    Salva"  ;
             SIZE 45,15 PIXEL ;
             OF  oDlgMod  ;
             RESOURCE ".\bitmaps\SAVE.png" ;
             TEXTRIGHT FONT oBold ;
             ACTION ( oDlgMod:end( IDOK ) )

    @ 128,210 BUTTONBMP oBtnSave;
             PROMPT "     Annulla"  ;
             SIZE 45,15 PIXEL ;
             OF  oDlgMod  ;
             RESOURCE "bitmaps\NO.png" ;
             TEXTRIGHT FONT oBold ;
             ACTION ( oDlgMod:end( IDCANCEL ) )




 ACTIVATE DIALOG oDlgMod center
     * ON INIT (DlgCenter( oDlgMod, oGrid ), aGet[5]:aItems[2]:disable())


      If oDlgMod:nresult == IDOK
           if msgYesNo( i18n("¿ E' sicuro di voler modificare questa tariffa ?") )



           endif
      Endif

RETURN NIL



   Function Calcolo_tariffa(nCosto,nSconto,nTotale,aGet, oDlgMod)
        ntotale:=  ncosto-nsconto
        aGet[9]:cText(ntotale)
        oDlgMod:Update()
       return nil

 
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: strange behavior of a TGet

Postby Silvio.Falconi » Wed May 12, 2021 8:07 am

Now I correct with

Code: Select all  Expand view  RUN

  @ 96, 10  Say "Costo :" SIZE 90,10 PIXEL OF oDlgMod
  @ 94, 75 GET aGet[7] VAR nCosto   OF oDlgMod SIZE 60, 12 ;
            PIXEL PICTURE  '@ €99,999.99' RIGHT FONT oFont UPDATE ;
             ON CHANGE ( aGet[7]:assign(), ;
                         Calcolo_tariffa(nCosto,nSconto,@nTotale,aGet))


  @ 96, 145  Say "Sconto :" SIZE 90,10 PIXEL OF oDlgMod
  @ 94, 175 GET aGet[8] VAR nsconto   OF oDlgMod SIZE 60, 12 ;
            PIXEL PICTURE  '@ €99,999.99' RIGHT FONT oFont UPDATE  ;
            ON CHANGE ( aGet[8]:assign(), ;
                         Calcolo_tariffa(nCosto,nSconto,@nTotale,aGet))

 


now it seems to work but it is a little weird behavior this problem never happened
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 41 guests