DCLISTBOX and DataObject

This forum is for eXpress++ general support.
Post Reply
Message
Author
Manfred
Posts: 14
Joined: Sun Jul 22, 2012 12:10 am
Location: Wesel

DCLISTBOX and DataObject

#1 Post by Manfred »

Hi,
is it possible to use DCLISTBOX with Dataobjects?

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCLISTBOX and DataObject

#2 Post 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
The eXpress train is coming - and it has more cars.

Manfred
Posts: 14
Joined: Sun Jul 22, 2012 12:10 am
Location: Wesel

Re: DCLISTBOX and DataObject

#3 Post 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

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCLISTBOX and DataObject

#4 Post 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.
The eXpress train is coming - and it has more cars.

Manfred
Posts: 14
Joined: Sun Jul 22, 2012 12:10 am
Location: Wesel

Re: DCLISTBOX and DataObject

#5 Post by Manfred »

thanks a lot. it was a little test. Thats life..... :lol:

Post Reply