Xbrowse and EDIT_LISTBOX solved
Posted: Tue Oct 29, 2019 5:00 pm
Hello Rao ,
is it possible to see the description ( item 0 ) when I have a value = zero?
Maurizio
is it possible to see the description ( item 0 ) when I have a value = zero?
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd, aLin := {{0,"",0}}, i, oBrw, oBtn
local aTabla:= { { 0, "item 0", 0.00 },;
{ 1, "item 1", 1.00 },;
{ 2, "item 2", 2.00 },;
{ 3, "item 3", 3.00 } }
DEFINE WINDOW oWnd
@ 10,10 XBROWSE oBrw OF oWnd DATASOURCE aLin ;
COLUMNS 1, 1, 3 ;
HEADERS 'Cod', 'Description', 'Price' ;
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
WITH OBJECT :Description
:nEditType := EDIT_LISTBOX
:aEditListTxt := aTabla
:bOnChange := { || oBrw:aRow[ 3 ] := aTabla[ oBrw:aRow[ 1 ], 3 ], ;
oBrw:aRow[ 2 ] := aTabla[ oBrw:aRow[ 1 ], 2 ] }
END
:bPastEof := <||
if oBrw:nLen == 0 .or. !Empty( ATail( oBrw:aArrayData )[ 1 ] )
AAdd( oBrw:aArrayData, { 0, "", 0 } )
oBrw:GoDown()
oBrw:Refresh()
endif
return nil
>
:CreateFromCode()
END
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd CENTERED
RETURN NIL