sync GRID with DBF

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

sync GRID with DBF

Post by AUGE_OHR »

hi,

while

Code: Select all

   SET BROWSESYNC ON
does not work with GRID i need other Solution

when using GRID with ROWSOURCE for DBF it will change Property "Recno" ( NOT "Value" )

Code: Select all

   #IFDEF Use_Browse
      nRecNo := GetProperty( "XPPTEL", "Browse_1", "value")
   #ELSE
      nRecNo := GetProperty( "XPPTEL", "Browse_1", "RecNo")
   #ENDIF
now you NEED

Code: Select all

   GOTO(nRecNo)
to sync DBF with GRID

---

i try to use a Thread to check if "Recno" have change while ONCHANGE does not react

Code: Select all

   hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @Wait4Action() )

Code: Select all

PROCEDURE Wait4Action()
LOCAL nRecNo := 1
STATIC xOld := 0
DO WHILE lRunning = .T.
   IF USED()
      IF IsControlDefined ("Browse_1", "XPPTEL")
         #IFDEF Use_Browse
            nRecNo := GetProperty( "XPPTEL", "Browse_1", "value")
         #ELSE
            nRecNo := GetProperty( "XPPTEL", "Browse_1", "RecNo")
         #ENDIF
         IF xOld <> nRecNo
            xOld := nRecNo
            GOTO(nRecNo)
            XPPTEL_Store()
         ENDIF
      ENDIF
   ENDIF
   DO EVENTS
   hb_idleSleep( 1 )
ENDDO
RETURN
but it does not work :o ... hm

so i use a TIMER

Code: Select all

DEFINE TIMER internal_timer_2 INTERVAL 100 ACTION Wait4Action()

Code: Select all

PROCEDURE Wait4Action()
LOCAL nRecNo := 1
STATIC xOld := 0
   IF USED()
      IF IsControlDefined ("Browse_1", "XPPTEL")
         #IFDEF Use_Browse
            nRecNo := GetProperty( "XPPTEL", "Browse_1", "value")
         #ELSE
            nRecNo := GetProperty( "XPPTEL", "Browse_1", "RecNo")
         #ENDIF
         IF xOld <> nRecNo
            xOld := nRecNo
            GOTO(nRecNo)
            XPPTEL_Store()
         ENDIF
      ENDIF
   ENDIF
   DO EVENTS
RETURN
and this work

Question : why is Thread not working here :?:
have fun
Jimmy
Post Reply