new Array for XBROWSE -> only 1st Column ?

new Array for XBROWSE -> only 1st Column ?

Postby Jimmy » Thu May 25, 2023 5:16 am

hi,

i try to "SET" a new Array for XBROWSE

Code: Select all  Expand view
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: Select all  Expand view
  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: Select all  Expand view
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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: new Array for XBROWSE -> only 1st Column ?

Postby Otto » Thu May 25, 2023 6:15 am

Jimmy, have you tried inserting some dummy data into your initial `aData`?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: new Array for XBROWSE -> only 1st Column ?

Postby Jimmy » Thu May 25, 2023 7: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: Select all  Expand view
               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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: new Array for XBROWSE -> only 1st Column ?

Postby nageswaragunupudi » Thu May 25, 2023 8:36 am

Please try
Code: Select all  Expand view
oBrw:SetArray(aData,,, .T.)

instead of
Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: new Array for XBROWSE -> only 1st Column ?

Postby nageswaragunupudi » Thu May 25, 2023 8: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: Select all  Expand view
  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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: new Array for XBROWSE -> only 1st Column ?

Postby Jimmy » Fri May 26, 2023 3:32 am

hi,
nageswaragunupudi wrote:Please try
Code: Select all  Expand view
oBrw:SetArray(aData,,, .T.)

Yes, this work thx :D
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: new Array for XBROWSE -> only 1st Column ?

Postby Jimmy » Fri May 26, 2023 3: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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: new Array for XBROWSE -> only 1st Column ?

Postby nageswaragunupudi » Sat May 27, 2023 9:45 am

Jimmy wrote: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

In that case, please use :SetArray( aData,,,.T. )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 104 guests