xbrowse and detached variables Mr Rao please Help

xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Fri Aug 19, 2022 5:13 pm

good afternoon to all
the code don't work as expected for EDIT_LISTBOX
What are bad on the code ?
please help me
Code: Select all  Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'

function main()

    local aKeys   := {'pichincha','internacio'}
    local hBancos := { => }
    local hRow
    local aCols   := {}
    local oWnd
    local oBrw
    local i
    local oCol1
    local cDbf := '.\test1.dbf'
    local aDbf := { { 'codigo'     , 'C', 10, 0 } ,;
                    { 'pichincha'  , 'C', 15, 0 } ,;
                    { 'internacio' , 'C', 15, 0 } }

    hBancos ['pichincha']  = {}
    hRow = { 'numcuenta' => '1234567' }
    aadd( hBancos ['pichincha'], hRow )

    hBancos ['internacio']  = {}
    hRow = { 'numcuenta' => '890123' }
    aadd( hBancos ['internacio'], hRow )

    dbcreate( cDbf, aDbf )

    use ( cDbf ) new alias camello exclusive
    camello->( dbappend() )
    camello->codigo = '1'
    camello->( dbappend() )
    camello->codigo = '2'
    camello->( dbgotop() )


    DEFINE WINDOW oWnd

    @ 0,0 XBROWSE oBrw OF oWnd alias 'camello' fastedit

    oCol1             := oBrw:AddCol()
    oCol1:bEditValue  := { || ( oBrw:cAlias )->codigo }
    oCol1:cHeader     := "codigo"
    oCol1:cEditPicture:= "@!"
    oCol1:nEditType   := 0
    oCol1:nWidth      := 90
    aCols = {}
    for i = 1 to len( aKeys )
        aadd( aCols, oBrw:AddCol() )
        campotexto( oBrw, i+1, @aCols, i, hBancos, aKeys )
    next

    oBrw:CreateFromCode()


    ACTIVATE WINDOW oWnd





return nil


function campotexto( oBrw, i, aCols, n, hBancos, aKeys )

    local xValue
    local uRet
    local c
    local aRow
    local aEditListTxt
    local aEditListBound
    local j
    local hRow


    aRow                = hBancos[ aKeys[n] ]
    aEditListTxt        = {}
    aEditListBound      = {}
    for j = 1 to len( aRow )
        hRow = aRow[j]
        aadd( aEditListTxt  , hRow['numcuenta'] )
        aadd( aEditListBound, hRow['numcuenta'] )
    next

    c    = alltrim( lower( ( oBrw:cAlias )->( fieldname( i ) ) ) )

    aCols[ n ]:bEditValue       := { || ( oBrw:cAlias )->&( c ) }

    aCols[ n ]:cHeader          := c
    aCols[ n ]:cEditPicture     := "@!"
    aCols[ n ]:nEditType        := EDIT_LISTBOX
    aCols[ n ]:nWidth           := 120
    aCols[ n ]:aEditListTxt     := aEditListTxt  
    aCols[ n ]:aEditListBound   := aEditListBound

    aCols[ n ]:bOnPostEdit      := { |o,v| ( oBrw:cAlias )->&( c )  := v }

 

return uRet
 


best regards
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby Marc Venken » Sun Aug 21, 2022 7:50 am

Wilson,

I'm not shure what your code is all doing, but it seems to be that you do things that Xbrowse can do automaticaly.

This sample uses the edit listbox and is easy, but different from your setup. Maybe It can help you.

Code: Select all  Expand view

function xbtest()

   local aStates
   local oDlg, oBrw, oFont

   RDDSETDEFAULT( "DBFCDX" )

   //aDbf := DIRECTORY( "c:\fwpic\*.jpg" )

   USE STATES SHARED
   aStates  := FW_DbfToArray()
   CLOSE STATES

/*
    Now aStates is 2-dimentional array.
    1st column is State Code
    2nd column is State name

    Customer.dbf has a field "STATE". This is State Code
    We want to display State Name in the browse listbox
    When user selects a State Name, we want to store State Code in the DBF
    XBrowse does this automatically
    PLEASE NEVER NEVER USE BONPOSTEDIT(). This is depricated many years back.

*/


   USE CUSTOMER SHARED
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "First", "City", "State" ;
      CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      WITH OBJECT :State
         :nEditType     := EDIT_LISTBOX
         :aEditListTxt  := aStates
      END
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

 


and here some code that I use as a kind off standard setup :

Code: Select all  Expand view

   local aGroepen:={ "BEDRIJVEN","ZELFSTANDI","VERENIGING","SCHOOLTURN","SCHOOLTECH","SCHOOLZORG","SCHOLEN","HORECA","GEMEENTEN","INSTELLING"}

   aVelden :=  { ;
   { "email"      , "Email"         ,nil, 150 }, ; // 7
   { "klantcode"  , "Klant"         ,nil,  45 }, ; // 1
   { "naam"       , "Naam"          ,nil, 100 }, ; // 1
   { "Groep"      , "Groep"         ,nil,  95 }, ; // 4
   //  here was more ....
   { "optout"     , "Optout"        ,nil,  50 }, ; // 1
   { "mail005"    , "M5"            ,nil,  30 }, ; // 6
   { "mail006"    , "M6"            ,nil,  30 }, ; // 6
   { "mail007"    , "M7"            ,nil,  30 }}   // 19

   @ 70,10 XBROWSE oBrw size 1400,500 PIXEL OF oDlg font oFont ;
      DATASOURCE "mailbulk";
      COLUMNS aVelden;
      AUTOSORT CELL LINES NOBORDER FOOTERS
      //FASTEDIT

     oBrw:nEditTypes = EDIT_GET
     oBrw:lF2KeyToEdit := .t.  // Edit when F2 is pressed
     oBrw:bRClickHeaders := { || XbrColSelector( oBrw ) }

     oBrw:SetChecks()
     oBrw:bKeyDown := {|nkey| iif(nkey=VK_ADD,  iif(oBrw:sel:VALUE=.t.,oBrw:sel:VarPut( .F. ),oBrw:sel:VarPut( .t. ))  ,)}

     oBrw:bron:bClrStd := { || showcolors(oBrw:bron:Value)  }

     for n := 1 to Len( oBrw:aCols )
       WITH OBJECT oBrw:aCols[ n ]
          if :cDataType != 'L'
            :uBarGetVal    := uValBlank( :Value )
            :cBarGetPic    := :cEditPicture
          endif
       END
     next

     WITH OBJECT oBrw


      WITH OBJECT:Groep
       :nEditType     := EDIT_LISTBOX
       :aEditListTxt  := aGroepen
      END


      :SetGroupHeader( "Mailings", oBrw:oCol("M1"):nCreationOrder, oBrw:oCol("M7"):nCreationOrder )
      :bRClicked        := {|nRow, nCol| MenuPop( nRow,nCol, oBrw ),oBrw:refresh() }

      :nFreeze:=4
      :lSeekbar   := .T.

      :lFooter          := .t.
      :email:bFooter    := { | oCol | Len( oBrw:aSelected ) }

      :bRecSelHeader    := { || "RowNo" }
      :bRecSelData      := { |o| o:KeyNo }
      :bRecSelFooter    := { |o| o:nLen }
      :oRecSelFont      := oFont  // optional
      :nRecSelWidth     := "999999" // required size

      //:SetGroupHeader( 'Omzet', 5, 6, oBold )
      //:SetGroupHeader( 'Aanmaningen', 9, 11, oBold )

      //:nStretchCol   := 10

      //:lDisplayZeros    := .f.
      //:nStretchCol      := 4

      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW }}
      :bClrRowFocus     := { || { CLR_BLACK, RGB(185,220,255) } }


      :nColDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
      :bClrRowFocus     := { || { CLR_BLACK, RGB(185,220,255) } }
      :nMarqueeStyle    := MARQSTYLE_HIGHLROWMS


      //:lIncrFilter   := .t.
      //:lSeekWild     := ( nWild == 2 )
      //:cFilterFld    := "naam"
      //:bFooters         := { |oCol| If( Empty( oCol:cOrder ), "", oBrw:cSeek("") ) }
      //:oSeek            := TSeek():New( oBrw )

   END

   BrwBarBtns( oBar, oBrw )
   oBrw:CreateFromCode()

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: xbrowse and detached variables Mr Rao please Help

Postby Antonio Linares » Sun Aug 21, 2022 9:11 am

Dear Marc,

Thank you so much for your help

I have added your example to FWH provided examples as marc.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Sun Aug 21, 2022 7:02 pm

Dear Marc many thanks for your help
but unfortunately does;n solve my problem
I prepare better example if I don't use detached locals work Well like the column tipo_docu1
In real life we need fields like pichincha an internatio as a result of data driven code because may have 2 columns or 3 or more columns and need an listbox asociatted to every column but xbrowse don't work this kind of column but work well in ocol4 column as your example
Code: Select all  Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'

function main()

    local aKeys   := {'pichincha','internacio'}
    local hBancos := { => }
    local hRow
    local aCols   := {}
    local oWnd
    local oBrw
    local i
    local oCol1
    local oCol4
    local cDbf := '.\test1.dbf'
    local aDbf := { { 'codigo'     , 'C', 10, 0 } ,;
                    { 'pichincha'  , 'C', 15, 0 } ,;
                    { 'internacio' , 'C', 15, 0 } ,;
                    { 'tipo_docu1' , 'C', 02, 0 } }

    hBancos ['pichincha']  = {}
    hRow = { 'numcuenta' => '1234567' }
    aadd( hBancos ['pichincha'], hRow )

    hBancos ['internacio']  = {}
    hRow = { 'numcuenta' => '890123' }
    aadd( hBancos ['internacio'], hRow )

    dbcreate( cDbf, aDbf )

    use ( cDbf ) new alias camello exclusive
    camello->( dbappend() )
    camello->codigo = '1'
    camello->( dbappend() )
    camello->codigo = '2'
    camello->( dbgotop() )


    DEFINE WINDOW oWnd

    @ 0,0 XBROWSE oBrw OF oWnd alias 'camello' fastedit



    oCol1             := oBrw:AddCol()
    oCol1:bEditValue  := { || ( oBrw:cAlias )->codigo }
    oCol1:cHeader     := "codigo"
    oCol1:cEditPicture:= "@!"
    oCol1:nEditType   := 0
    oCol1:nWidth      := 90
    aCols = {}
    for i = 1 to len( aKeys )
        aadd( aCols, oBrw:AddCol() )
        campotexto( oBrw, i+1, @aCols, i, hBancos, aKeys )
    next

    oCol4                   := oBrw:AddCol()
    oCol4:bEditValue        := { || ( oBrw:cAlias )->tipo_docu1 }
    oCol4:cHeader           := "Tipo1"
    oCol4:cEditPicture      := "@!"
    oCol4:nEditType         := EDIT_LISTBOX
    oCol4:nWidth            := 80
    oCol4:aEditListTxt      := {'deposito','anticipo'}
    oCol4:aEditListBound    := {'DP','AN'}
    oCol4:bOnPostEdit       := { |o,v| ( oBrw:cAlias )->tipo_docu1 := v }


    //oBrw:nEditTypes    := EDIT_GET

    oBrw:CreateFromCode()


    ACTIVATE WINDOW oWnd





return nil


function campotexto( oBrw, i, aCols, n, hBancos, aKeys )

    local xValue
    local uRet
    local c
    local aRow
    local aEditListTxt
    local aEditListBound
    local j
    local hRow



    aRow                = hBancos[ aKeys[n] ]
    aEditListTxt        = {}
    aEditListBound      = {}
    for j = 1 to len( aRow )
        hRow = aRow[j]
        aadd( aEditListTxt  , { hRow['numcuenta'], hRow['numcuenta'] } )
        aadd( aEditListBound, { hRow['numcuenta'], hRow['numcuenta'] } )
    next

    c    = alltrim( lower( ( oBrw:cAlias )->( fieldname( i ) ) ) )

    aCols[ n ]:bEditValue       := { || ( oBrw:cAlias )->&( c ) }

    aCols[ n ]:cHeader          := c
    aCols[ n ]:cEditPicture     := "@!"
    aCols[ n ]:nEditType        := EDIT_LISTBOX
    aCols[ n ]:nWidth           := 120
    aCols[ n ]:aEditListTxt     := aEditListTxt

    //aCols[ n ]:bOnPostEdit      := { |o,v| ( oBrw:cAlias )->&( c )  := v }


return uRet

Many Thanks for your time and help
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby nageswaragunupudi » Mon Aug 22, 2022 5:32 pm

Mr. Wilson
I see your point.
Please let me know the FWH version you are using.
Regards

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

Re: xbrowse and detached variables Mr Rao please Help

Postby Cgallegoa » Mon Aug 22, 2022 9:15 pm

Hi Mr. Rao

I have version FWH 20.07 with the same and other problems in xBrowse. Is there a corrected version of xBrowse for FWH 20.07 ?

Thanks for your help,

Regards,
Saludos,

Carlos Gallego

*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Cgallegoa
 
Posts: 491
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Mon Aug 22, 2022 10:06 pm

dear master
Code: Select all  Expand view
┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 19.09 - Sep. 2019           Harbour development power  │▄
(c) FiveTech 1993-2019 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour 3.2.0dev (r1909261630)
Copyright (c) 1999-2019, https://harbour.github.io/
Compiling 'xbrowse.prg' and generating preprocessed output to 'xbrowse.ppo'...
Lines 5333, Functions/Procedures 2
Generating C source output to 'xbrowse.c'... Done.
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies,
 Inc.
xbrowse.c:
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, In
c.
Fatal: Could not open xbrowse.exe (program still running?)
 


many thanks for your time
regards
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Thu Aug 25, 2022 4:50 pm

Dear Master Rao, any News ?
best regards
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby Antonio Linares » Thu Aug 25, 2022 6:35 pm

Estimado Wilson,

Le acabo de escribir al Sr. Rao para que lo revise cuanto antes.

Te pedimos disculpas por el retraso
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Thu Aug 25, 2022 7:37 pm

Gracias Antonio en verdad estoy necesitando ese tema para terminar un proyecto
saludos
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: xbrowse and detached variables Mr Rao please Help

Postby nageswaragunupudi » Fri Aug 26, 2022 12:18 pm

Mr. Wilson

Please try this sample and let me know if it serves your purpose.
Code: Select all  Expand view
#include 'fivewin.ch'

function main()

   local aKeys   := {'pichincha','internacio'}
   local hBancos := { => }
   local hRow
   local aCols   := {}
   local oWnd
   local oBrw
   local i
   local oCol1
   local cDbf := '.\test1.dbf'
   local aDbf := { { 'codigo'     , 'C', 10, 0 } ,;
                   { 'pichincha'  , 'C', 15, 0 } ,;
                   { 'internacio' , 'C', 15, 0 } }

   hBancos ['pichincha']  = {}
   hRow = { 'numcuenta' => '1234567' }
   aadd( hBancos ['pichincha'], hRow )

   hBancos ['internacio']  = {}
   hRow = { 'numcuenta' => '890123' }
   aadd( hBancos ['internacio'], hRow )

   dbcreate( cDbf, aDbf )

   use ( cDbf ) new alias camello exclusive
   camello->( dbappend() )
   camello->codigo = '1'
   camello->( dbappend() )
   camello->codigo = '2'
   camello->( dbgotop() )

   // REVISED CODE BEGIN
   //-------------------

   aCols := { "codigo" }
   AEval( aKeys, { |c| AAdd( aCols, c ) } )

   DEFINE WINDOW oWnd

   @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CAMELLO" ;
      COLUMNS aCols FASTEDIT

   WITH OBJECT oBrw
      for i := 1 to 2
         WITH OBJECT oBrw:aCols[ i + 1 ]
            :nWidth        := 120
            :nEditType     := EDIT_LISTBOX
            :aEditListTxt  := {}
            AEval( hBancos[ :cExpr ], { |hRow| AAdd( :aEditListTxt, hRow['numcuenta'] ) } )
         END
      next
      :CreateFromCode()
   END

   ACTIVATE WINDOW oWnd CENTERED

return nil
 
Regards

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

Re: xbrowse and detached variables Mr Rao please Help

Postby nageswaragunupudi » Fri Aug 26, 2022 12:19 pm

Cgallegoa wrote:Hi Mr. Rao

I have version FWH 20.07 with the same and other problems in xBrowse. Is there a corrected version of xBrowse for FWH 20.07 ?

Thanks for your help,

Regards,


Can you please let me know your other problems?
Regards

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

Re: xbrowse and detached variables Mr Rao please Help

Postby nageswaragunupudi » Fri Aug 26, 2022 2:16 pm

Mr. Wilson

Your way of creating columns using oBrw:AddCol()

Code: Select all  Expand view
#include 'fivewin.ch'

function main()

    local aKeys   := {'pichincha','internacio'}
    local hBancos := { => }
    local hRow
    local aCols   := {}
    local oWnd
    local oBrw
    local i
    local oCol1
    local cDbf := '.\test1.dbf'
    local aDbf := { { 'codigo'     , 'C', 10, 0 } ,;
                    { 'pichincha'  , 'C', 15, 0 } ,;
                    { 'internacio' , 'C', 15, 0 } }


    hBancos ['pichincha']  = {}
    hRow = { 'numcuenta' => '1234567' }
    aadd( hBancos ['pichincha'], hRow )

    hBancos ['internacio']  = {}
    hRow = { 'numcuenta' => '890123' }
    aadd( hBancos ['internacio'], hRow )

    dbcreate( cDbf, aDbf )

    use ( cDbf ) new alias camello exclusive
    camello->( dbappend() )
    camello->codigo = '1'
    camello->( dbappend() )
    camello->codigo = '2'
    camello->( dbgotop() )

    DEFINE WINDOW oWnd

    @ 0,0 XBROWSE oBrw OF oWnd alias 'camello' fastedit

    oCol1             := oBrw:AddCol()
    oCol1:bEditValue  := { || ( oBrw:cAlias )->codigo }
    oCol1:cHeader     := "codigo"
    oCol1:cEditPicture:= "@!"
    oCol1:nEditType   := 0
    oCol1:nWidth      := 90

    for i = 1 to len( aKeys )
      CreateColumn( oBrw, aKeys[ i ], hBancos )
    next

    oBrw:CreateFromCode()

    ACTIVATE WINDOW oWnd

return nil

function CreateColumn( oBrw, cField, hBancos )

   local oCol, nFld

   WITH OBJECT ( oCol := oBrw:AddCol() )

      nFld           := ( oBrw:cAlias )->( FieldPos( cField ) )
      :cHeader       := cField
      :cExpr         := cField
      :bEditValue    := { || FieldGet( nFld ) }
      :bOnPostEdit   := { |o,x,n| If( n == VK_ESCAPE,,( oBrw:cAlias )->( FieldPut( nFld, x ) ) ) }
      :cEditPicture  := "@!"
      :nWidth        := 120

      :nEditType     := EDIT_LISTBOX
      :aEditListTxt  := {}
      AEval( hBancos[ cField ], { |hRow| AAdd( :aEditListTxt, hRow[ "numcuenta" ] ) } )

   END

return oCol
 


Please try this also.
Regards

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

Re: xbrowse and detached variables Mr Rao please Help

Postby nageswaragunupudi » Fri Aug 26, 2022 2:35 pm

Using fieldname macro, instead of FieldPut() and FieldGet() as in the sample you posted.
Code: Select all  Expand view
#include 'fivewin.ch'

function main()

    local aKeys   := {'pichincha','internacio'}
    local hBancos := { => }
    local hRow
    local aCols   := {}
    local oWnd
    local oBrw
    local i
    local oCol1
    local cDbf := '.\test1.dbf'
    local aDbf := { { 'codigo'     , 'C', 10, 0 } ,;
                    { 'pichincha'  , 'C', 15, 0 } ,;
                    { 'internacio' , 'C', 15, 0 } }


    hBancos ['pichincha']  = {}
    hRow = { 'numcuenta' => '1234567' }
    aadd( hBancos ['pichincha'], hRow )

    hBancos ['internacio']  = {}
    hRow = { 'numcuenta' => '890123' }
    aadd( hBancos ['internacio'], hRow )

    dbcreate( cDbf, aDbf )

    use ( cDbf ) new alias camello exclusive
    camello->( dbappend() )
    camello->codigo = '1'
    camello->( dbappend() )
    camello->codigo = '2'
    camello->( dbgotop() )

    DEFINE WINDOW oWnd

    @ 0,0 XBROWSE oBrw OF oWnd alias 'camello' fastedit

    oCol1             := oBrw:AddCol()
    oCol1:bEditValue  := { || ( oBrw:cAlias )->codigo }
    oCol1:cHeader     := "codigo"
    oCol1:cEditPicture:= "@!"
    oCol1:nEditType   := 0
    oCol1:nWidth      := 90

    for i = 1 to len( aKeys )
      CreateColumn( oBrw, aKeys[ i ], hBancos )
    next

    oBrw:CreateFromCode()

    ACTIVATE WINDOW oWnd

return nil

function CreateColumn( oBrw, cField, hBancos )

   local oCol

   WITH OBJECT ( oCol := oBrw:AddCol() )

      :cHeader       := cField
      :cExpr         := cField
      :bEditValue    := { || &( cField ) }
      :bOnPostEdit   := { |o,x,n| If( n == VK_ESCAPE,,( oBrw:cAlias )->&( cField ) := x ) }
      :cEditPicture  := "@!"
      :nWidth        := 120

      :nEditType     := EDIT_LISTBOX
      :aEditListTxt  := {}
      AEval( hBancos[ cField ], { |hRow| AAdd( :aEditListTxt, hRow[ "numcuenta" ] ) } )

   END

return oCol

 
Regards

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

Re: xbrowse and detached variables Mr Rao please Help

Postby wilsongamboa » Sat Aug 27, 2022 1:47 am

Dear Master Rao
Hats Off !!!!!!!!!!!!!!!
all works fine
Many many thanks !!!
The code exceed my knowledge but xbrowse is great !!
I'll Continue with my project

Again
Many Thnaks
best regards
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 593
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 41 guests