FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour new Array for XBROWSE -> only 1st Column ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
new Array for XBROWSE -> only 1st Column ?
Posted: Thu May 25, 2023 05:16 AM
hi,

i try to "SET" a new Array for XBROWSE
Code (fw): Select all Collapse
STATIC oMain
STATIC aData

PROCEDURE MAIN( cDbf1, cDbf2 )

   aData := {}

   DEFINE WINDOW oMain ...

      @ 120,10 XBROWSE oBrw SIZE 800-40,600-160 PIXEL OF oMain ;
          DATASOURCE aData AUTOCOLS
      oBrw:CreateFromCode()
      oBrw:hide()
later i "fill" Array aData and try to "show" it
Code (fw): Select all Collapse
   IF ! EMPTY(aData)
      * DoXBROWSE() // work

      * oBrw:aArrayData := aData
      oBrw:SetArray(aData,,,aCols) // aCols := {1,2,3,...}
      oBrw:show()
      oBrw:Refresh()
   ELSE
      MsgInfo("no Data")
   ENDIF
but it does show me only 1st Column "A" :shock:

---

it does work when create XBROWSE after "fill" Array
Code (fw): Select all Collapse
PROCEDURE DoXBROWSE()
LOCAL nWidth   := oMain:nWidth
LOCAL nHeight  := oMain:nHeight
LOCAL oBrw

   IF !EMPTY(aData)
      @ 120,10 XBROWSE oBrw SIZE nWidth-20,nHeight-120 PIXEL OF oMain ;
          DATASOURCE aData AUTOCOLS

      oBrw:CreateFromCode()
      oBrw:SetFocus()
   ENDIF

RETURN
what i´m doing wrong :?:
greeting,

Jimmy
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Thu May 25, 2023 06:15 AM

Jimmy, have you tried inserting some dummy data into your initial aData?

Best regards,

Otto

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Thu May 25, 2023 07:25 AM
hi Otto,
Otto wrote:have you tried inserting some dummy data into your initial `aData`?
LEN(aArray) is much bigger than 1 and "wide" is FCOUNT().

but with my CODE it show only 1st Column "A" when assign "on-fly" to XBROWSE

---

instead of APPEND to DBF i want to "show" Data using XBROWSE
Code (fw): Select all Collapse
                SELECT 1
               aValues := Scatter() // FieldGet()
               AADD(aData,aValues)  // add for XBROWSE
#IFDEF Use_Append
               SELECT 2
               APPEND BLANK
               Gather( aValues )    // Fieldput()
#ENDIF
aValues have Value of all FIELD which i add to aData

as i say it work correct when get Array aData first, but how to assign it later to XBROWSE :?:
is oBrw:SetArray() right :?:
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Thu May 25, 2023 08:36 AM
Please try
Code (fw): Select all Collapse
oBrw:SetArray(aData,,, .T.)
instead of
Code (fw): Select all Collapse
oBrw:SetArray(aData,,,aCols)
Please let us know if this works for you. (Note: This worked for me here in my test)

Note: In any case, we see the need to fecilitate reconfigure the columns at runtime in a much easier way.
We will attend to this.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Thu May 25, 2023 08:41 AM
When we start with an empty array and we know that the array, later will have n columns, then we recommend defining the array with n columns.
Example:
Code (fw): Select all Collapse
   local oDlg, oBrw
   local aData := {}

   DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE aData COLUMNS 1,2,3 ;
      CELL LINES NOBORDER

   oBrw:bRClicked := { || AAdd( aData, { "A","B","C" } ), oBrw:Refresh() }

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED
Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Fri May 26, 2023 03:32 AM
hi,
nageswaragunupudi wrote:Please try
Code (fw): Select all Collapse
oBrw:SetArray(aData,,, .T.)
Yes, this work thx :D
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Fri May 26, 2023 03:36 AM
hi,
nageswaragunupudi wrote:When we start with an empty array and we know that the array, later will have n columns, then we recommend defining the array with n columns.
i do not know how many FIELD a DBF have so i can´t assign it when XBROWSE is "open"

i use Array "temporary" to hold difference of 2 x DBF "to sync" them
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: new Array for XBROWSE -> only 1st Column ?
Posted: Sat May 27, 2023 09:45 AM
Jimmy wrote:hi,
When we start with an empty array and we know that the array, later will have n columns, then we recommend defining the array with n columns.
i do not know how many FIELD a DBF have so i can´t assign it when XBROWSE is "open"

i use Array "temporary" to hold difference of 2 x DBF "to sync" them
In that case, please use :SetArray( aData,,,.T. )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion