DCTREEROOT

This forum is for eXpress++ general support.
Message
Author
Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

DCTREEROOT

#1 Post by Wolfgang Ciriack »

Hello,
i have an DCTREEROOT on a DCSTATIC, in the dialog i do an DC_ExpandTree(oTree) in the EVAL codeblock of DCREAD GUI.
Because there are alot of items, a vertical scrollbar is shown in the static and after the expand the last item is visible.
How can i manipulate the static, that the first item of the treeview is visible ?
_______________________
Best Regards
Wolfgang

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

Re: DCTREEROOT

#2 Post by rdonnay »

Wolfgang -

Try this:

Code: Select all

oTannenbaum:setData(oTannenbaum:rootItem:getChildItems()[1])
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCTREEROOT

#3 Post by Wolfgang Ciriack »

That does not change anything.
Is there an Event i can post to the DCSTATIC that scrolls up to the beginning ?
_______________________
Best Regards
Wolfgang

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

Re: DCTREEROOT

#4 Post by rdonnay »

It works in my DC_ExpandTree() function. I will need to see your code to see why it doesn't work for you.

Code: Select all

FUNCTION DC_ExpandTree( oTree, lExpand )

LOCAL i, aChildList, oTannenBaum := oTree

DEFAULT lExpand := .t.

IF IsMethod(oTannenBaum,'LOCKUPDATE')
  oTannenBaum:lockUpdate(.t.)
ENDIF

IF oTree:isDerivedfrom('XbpTreeView')
   oTree := oTree:rootItem
ENDIF

aChildList := oTree:getChildItems()

FOR i := 1 TO Len(aChildList)
  aChildList[i]:expand(lExpand)
  DC_ExpandTree( aChildList[i], lExpand )
NEXT

IF IsMethod(oTannenBaum,'LOCKUPDATE')
  oTannenBaum:lockUpdate(.f.)
ENDIF

IF IsMemberVar(oTannenbaum,'rootitem')
  oTannenbaum:setData(oTannenbaum:rootItem:getChildItems()[1])
ENDIF

RETURN nil
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCTREEROOT

#5 Post by Wolfgang Ciriack »

Hello Roger,
here it is:

Code: Select all

aItems:={ ;
  {"Kunden", 0, 0}, ;
    {"ohne Auftrag in Zeitraum..",1,                       12}, ;
    {"Monatsumsatz nach Abfallarten",1,                    27}, ;
    {"Umsatzrangliste (aus Lfs.)",1,                       30}, ;
    {"Mengenliste nach AVV-Nr. mit BV-Auswahl",1,          32}, ;
    {"Jahresabfallbilanz nach AVV-Nr. aus Rechnungen",1,   35}, ;
    {"Jahresabfallbilanz nach Artikeln (detailliert)",1,   37}, ;
    {"Jahresabfallbilanz Einzelartikel",1,                 38}, ;
  {"Auftragsanschriften", 0, 0}, ;
    {"ohne Auftrag in Zeitraum..",1,                       13}, ;
    {"Leistungen nach Mitarbeitern",1,                     93}, ;
  {"Beh„lter", 0, 0}, ;
    {"ohne Bewegung in Zeitraum..",1,                      11}, ;
    {"Beh„lterauslastung Monatsvergleich (2 Jahre)",1,    100}, ;
    {"Beh„lterauslastung 3-Jahres-Vergleich", 1,          103}, ;
  {"Fahrzeuge", 0, 0}, ;
    {"Tageserl”se/Kosten pro Monat",1,                     21}, ;
    {"nach Kfz-Gruppen",1,                                 22}, ;
    {"Jahresauswertung Erl”se/Kosten", 1,                 104}, ;
    {"Tageserl”se nach Baustellen pro Monat",1,            36}, ;
  {"Personal/Fahrer", 0, 0}, ;
    {"Tageserl”se/Kosten pro Monat",1,                     24}, ;
    {"Leistungen von Mitarbeitern",1,                      94}, ;
    {"Jahresauswertung Erl”se/Stunden", 1,                105}, ;
  {"Auftr„ge", 0, 0}, ;
    {"šS-Liste nach Zeitraum",1,                           31}, ;
    {"šS-Liste nach Abfallarten",1,                        33}, ;
    {"šS-Liste nach Entsorgern",1,                         34}, ;
    {"nach Erl”s/Preis (Alle,Kunden,ADM)",1,               23}, ;
    {"Entsorgungsleistungen",1,                            25}, ;
    {"Umsatzerl”se nach Konten/Kostenstellen",1,           26}, ;
    {"Auftr„ge nach Ort/Bezirk",1,                         29}, ;
    {"Auftr„ge mit/ohne Lfs.", 1,                           5}, ;
    {"Jahresvergleich Auftr„ge", 1,                         8}, ;
    {"Anzahlungsliste fr Auftr„ge", 1,                   102}, ;
  {"Diverses", 0, 0}, ;
    {"Monatsumsatz Deponien nach Abfallarten",1,           28}, ;
    {"Mengen fr Entsorgungsnachweise",1,                   7}, ;
    {"Tagesmengen Auftr„ge und Platz", 1,                   9}, ;
  {"Auswertung fr Sub-Auftr„ge", 0,                      101} ;
}

DCGET OPTIONS ICON iconnr TABSTOP SAYLEFT CHECKGET HIDE

@ 1,48 DCSTATIC TYPE XBPSTATIC_TYPE_RAISEDBOX SIZE 68,23 OBJECT oShowBox

@ 1,1 DCTREEROOT SIZE 45,25 OBJECT oTree ;
      HASLINES ;
      HASBUTTONS ;
      ALWAYSSHOWSELECTION ;
      ITEMMARKED {|o| nSelected:=o:cargo[3],SetVonBis(nSelected), dc_getrefresh(Getlist) }

l:=len(aItems)
for i:=1 to l
   if aItems[i][2]=0
       oTreeZr:=nil
       DCTREEITEM CAPTION aItems[i][1] PARENT oTree OBJECT oTreeZr CARGO aItems[i][3] IMAGENORMAL ICON_ARROW_R
   else
       DCTREEITEM CAPTION aItems[i][1] PARENT oTreeZr CARGO aItems[i][3] IMAGENORMAL ICON_INFO IMAGEMARKED ICON_INFO
   endif
next
....

DCREAD GUI ;
   TITLE cTitel ;
   OPTIONS GetOptions ;
   FIT ;
   SETAPPWINDOW ;
   SETFOCUS @oTree ;
   HANDLER StdDlgHandler ;
   EVAL {|o| oDlg:=o, DC_ExpandTree(oTree), CenterControl(o,M->oMainDlg), o:show() }
_______________________
Best Regards
Wolfgang

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

Re: DCTREEROOT

#6 Post by rdonnay »

Does this work?:

Code: Select all

EVAL {|o| oDlg:=o, DC_ExpandTree(oTree), ;
              oTree:setData(oTree:rootItem:getChildItems()[1], ;
              CenterControl(o,M->oMainDlg), o:show() }
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCTREEROOT

#7 Post by Auge_Ohr »

hi,

oTree:SetData() may set Focus to Item but it does not mean that it is visible.

i have look into my native Treeview and found this

Code: Select all

/****************************************************************************
* http://msdn.microsoft.com/en-us/library/windows/desktop/bb773566%28v=vs.85%29.aspx
*
* Ensures that a tree-view item is visible, expanding the parent item
* or scrolling the tree-view control, if necessary.
*
*    wParam
*       Must be zero.
*
*    lParam
*       Handle to the item.
*
*    Return value
*       Returns nonzero if the system scrolled the items in the tree-view control
*       and no items were expanded. Otherwise, the message returns zero.
*****************************************************************************/

//#define TV_FIRST                                                0x1100
//#define TVM_ENSUREVISIBLE                               (TV_FIRST + 20)
// o:APIEnsureVisible( oTree:rootItem:getChildItems()[1]:GethWnd() )

INLINE METHOD APIEnsureVisible(hItem)
LOCAL hRet   := 0
   hRet := @user32:SendMessageA(hTreeView,TVM_ENSUREVISIBLE,0,tem)
RETURN hRet
greetings by OHR
Jimmy

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCTREEROOT

#8 Post by Wolfgang Ciriack »

@Roger,
no this does not work, that is what i tried after your first posting.

@Jimmy,
i do not know how to integrate this.

I try to post a ready to compile example.
_______________________
Best Regards
Wolfgang

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

Re: DCTREEROOT

#9 Post by rdonnay »

If you can give me some code that will compile and run, I will figure this out for you.

I can't compile the code you posted. It is missing functions.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCTREEROOT

#10 Post by Auge_Ohr »

hi,

have try

Code: Select all

xxx := oTree:rootItem:getChildItems()[1] -> XbpTreeViewItem()
zzz := xxx:GethWnd() -> crash
so a XbpTreeViewItem() does not give me a Handle ... :(

but as Roger say

Code: Select all

 oTree:setdata(XbpTreeViewItem) 
must work
greetings by OHR
Jimmy

Post Reply