Page 1 of 1

slight delay

PostPosted: Mon May 31, 2021 6:43 am
by Silvio.Falconi
on a xbrowse I have these columns (I'm creating a procedure to set permissions of users)

Image

on xbrowse I have

oGrid3:bKeyDown:={|nKey| IF(nKey=VK_RETURN,Asigna(oPermessi,oGrid3,oBtnCambia),IF(nKey=VK_F5,Cambia(oPermessi,oGrid3,oBtnCambia),))}
oGrid3:bLDblClick:={|| Asigna(oPermessi,oGrid3,oBtnCambia)}

we are operating on the second column of xbrowse (oGrid3), the user change the data on oPermessi:ABC from "A" to "R" and viceversa



I'm using tdata(base) and oPermessi is a DBF with this structure
Code: Select all  Expand view

aFields := { { "USUARIO", "C", 8, 0 },;
                   { "MODULO", "C", 6, 0 },;
                   { "M", "C", 1, 0 },;
                   { "DESCRI", "C", 30, 0 },;
                   { "PERMISO", "L", 1, 0 },;
                   { "ABC", "C", 1, 0 },;
                   { "TIPO", "C", 1, 0 } }




cambia function
Code: Select all  Expand view


Function Cambia(oPermessi,oGrid3,oBtnCambia)
   IF lABC
     IF oPermessi:Permiso
        IF oPermessi:ABC="A"
           oPermessi:ABC:="R"
         ELSE
           oPermessi:ABC:="A"
         ENDIF
         oPermessi:save(.t.)
        Refr_Btn(oBtnCambia,oPermessi)
      ENDIF
      Refr_Btn(oBtnCambia,oPermessi)
      oGrid3:refresh()
   ENDIF
   oGrid3:SetFocus()
RETURN (NIL)


Refr_Btn(oBtnCambia,oPermessi) is a function where change the state of a button

I think the function Cambia() not have errors but sometimes I saw a slight delay when the record is changed

Sometimes I must press F5 more time to change the record
the same happen when the use click double
the function asigna() is the same of cambia()

I saw a slight delay is I use (tdata)base instead of dbf exlusive

why it happen ?