Get previous item in outline

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




In the previous section, we defined an overloaded version of GetNextItem()
which returns the next item in the outline as if the outline were completely
expanded. We now define its counterpart: GetPrevItem(). This function uses
the GetLastItem() defined in an earlier section.

 

// GetNextItem  – Get previous item
as if outline was completely expanded

// Returns             
– The item immediately above the reference item

// hItem               
– The reference item

HTREEITEM CTreeCtrlX::GetPrevItem( HTREEITEM hItem )

{

        HTREEITEM      
hti;



        hti = GetPrevSiblingItem(hItem);

        if( hti == NULL )

               
hti = GetParentItem(hItem);

        else

               
hti = GetLastItem(hti);

        return hti;

}

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read