Here is a mini working example:
To notice before you answer:
1. I do not use browse in this example, but my tabbed dialogs are full of them as well as lists, images, comboboxes, date fields, buttons, slide-shows, reports, Excel conversion, SQL queries, and everything else that works correctly
2. I cannot change to browse since there are zillions of discrete fields that should be fill-in by the user depending on previous answers
3. The problem is only with ARRAYS (using AADD as explained) and nothing else
4. This is an incomplete example missing a lot of functionalities only done as proof of concept. It will work to show the update problem if you place the DB and required icons (even if they do not correspond)
Code: Select all
// the problem here is ONLY with GETS and SAYS using arrays
#include "fivewin.ch"
STATIC oDlg
FUNCTION Main()
LOCAL aData, ;
oDbfC, ;
aText[3][3]
USE clientes //this DB is located in the samples path of FW
DATABASE oDbfC
oDbfC:LOAD()
oDbfC:GoTop()
Load_Data(@aData, @aText, oDbfC)
DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL
Show_Dialog(aData, aText, oDbfC)
ACTIVATE DIALOG oDlg CENTERED ON INIT (HB_SYMBOL_UNUSED(self), ;
Main_bar(@aData, @aText, oDbfC) )
RETURN nil
STATIC PROCEDURE Show_Dialog(aData, aText, oDbfC)
LOCAL i, j
*? HB_valtoExp(aData)
FOR i := 1 to 3
FOR j := 1 to 3
@ 40 * i, 200 * j GET aData SUBSCRIPT i,j PICTURE "9999" UPDATE SIZE 120,30 PIXEL OF oDlg
NEXT j
NEXT i
for i := 1 to 3
for j := 1 to 3
@ 150+ (40 * i), 200 * j GET aText SUBSCRIPT i,j PICTURE "9999" UPDATE SIZE 120,30 PIXEL OF oDlg
next j
next i
RETURN
************ Fill arrays as needed **********
STATIC PROCEDURE Load_Data(aData, aText, oDbfC )
LOCAL i
aData:={}
FOR i:=1 TO 3
AAdd( aData, { oDbfC:Nombre, oDbfC:Direccion, oDbfC:Telefono } )
oDbfC:Skip(1)
NEXT i
FOR i:=1 TO 3
aText[i][1]:=oDbfC:Nombre
aText[i][2]:=oDbfC:Direccion
aText[i][3]:=oDbfC:Telefono
oDbfC:Skip(1)
NEXT i
RETURN
***** Create button bar (use any image just to ilustrate the point)
STATIC PROCEDURE Main_bar(aData, aText, oDbfC)
LOCAL oBar, oBtn
DEFINE BUTTONBAR oBar OF oDlg SIZE 30,30
DEFINE BUTTON oBtn OF oBar ;
FILE ".\icons\previous.bmp" ;
ACTION (HB_SYMBOL_UNUSED(this), ;
nAccion(1,aData, @aText, @oDbfC) ) ;
TOOLTIP "Next"
DEFINE BUTTON oBtn OF oBar ;
FILE ".\icons\next.bmp" ;
ACTION (HB_SYMBOL_UNUSED(this), ;
nAccion(2,aData, @aText, @oDbfC) ) ;
TOOLTIP "Previous"
DEFINE BUTTON oBtn OF oBar ;
FILE ".\icons\exit.bmp" ;
ACTION (HB_SYMBOL_UNUSED(this), ;
oDlg:END() ) ;
TOOLTIP "Exit"
RETURN
//****** All actions from different button bar go here ***********************************************************
STATIC PROCEDURE nAccion(nAccion, aData, aText, oDbfC)
DO CASE //several possibilities here
CASE nAccion=1 //prev
dbSKIP(-1)
IF BOF()
dbGoTop()
ENDIF
CASE nAccion=2 //next
dbSKIP(1)
IF EOF()
dbGoTop()
ENDIF
ENDCASE
oDbfC:LOAD()
Load_Data(@aData, @aText, oDbfC )
oDlg:Refresh()
oDlg:Update()
RETURN
//----------------------------------------------------------------------------//