Page 1 of 1

DCLISTBOX and DataObject

Posted: Tue Nov 26, 2019 12:25 pm
by Manfred
Hi,
is it possible to use DCLISTBOX with Dataobjects?

Re: DCLISTBOX and DataObject

Posted: Tue Nov 26, 2019 1:06 pm
by rdonnay
Yes.

Here is some sample code:

Code: Select all

#INCLUDE "dcdialog.ch"

FUNCTION Main()

LOCAL GetList[0], oDataObject, cVarName := ''

oDataObject := DataObject():new()

oDataObject:name := 'Roger Donnay'
oDataObject:street1 := '1486 S. Loggers Pond Place'
oDataObject:street1 := 'Apt. 11'
oDataObject:city := 'Boise'
oDataObject:state := 'Idaho'
oDataObject:country := 'U.s.A.'

@ 0,0 DCLISTBOX cVarName LIST oDataObject SIZE 30,10

DCREAD GUI FIT

RETURN nil

* ---------

PROC appsys ; RETURN

Re: DCLISTBOX and DataObject

Posted: Wed Nov 27, 2019 12:38 am
by Manfred
Sorry, it was my mistake. I mean this for example

Code: Select all

LOCAL aJahre         := {}
       LOCAL aVerzeichnisse := {}
       LOCAL cJahre         := ""
       LOCAL cVerzeichnis   := oSysPAra:doParaWs:datenbestand + "jahresabschluss\*"aVerzeichnisse := Directory(cVerzeichnis,"D")                            // nur Directories der Jahre
       IF Len(aVerzeichnisse) > 0
          SELECT field1 AS name FROM (aVerzeichnisse) AS jahr WHERE jahr->field1 <> "." .AND. jahr->field1 <> ".." INTO objects aJahre
       ENDIF
//------------------------------------------------------------------------------
       @ oDialogZusatz:nOben,oDialogZusatz:nLinks DCSAY "Jahr:";
                                                 OBJECT oDialogZusatz:oText;
                                                 PARENT oDialogZusatz:oRahmenKopf;
                                                   SIZE 0
       @ DCGUI_ROW,DCGUI_COL DCLISTBOX cJahre;
                                  LIST aJahre;
                                OBJECT oListbox;
                                PARENT oDialogZusatz:oRahmenKopf;
                                  SIZE oSysPara:SkaliereXbParts(100),oDialogZusatz:nSayHoehe

Re: DCLISTBOX and DataObject

Posted: Wed Nov 27, 2019 9:03 am
by rdonnay
This will not work for you.
DCLISTBOX is built on the DC_XbpListBox() class (inherited from XbpListBox()) which only works with single dimensional arrays or data objects.

I am guessing that I could modify the class in eXpress++, but that would take some work.

You can get the same behavior as DCLISTBOX by using DCBROWSE instead. It already supports arrays of data objects.
Look at the sample in \exp20\samples\adssql\sqltest1.prg.

Re: DCLISTBOX and DataObject

Posted: Wed Nov 27, 2019 9:37 am
by Manfred
thanks a lot. it was a little test. Thats life..... :lol: