Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CTreeViewCtrl
Message
 
To
02/06/2005 00:20:44
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Miscellaneous
Thread ID:
01019236
Message ID:
01019242
Views:
81
When working with the treeview control, I've always just put the line assigning the imagelist property in the init of the OLEControl container. Never failed on me, but without it there it has always failed for me.

>Hi all,
>
>I'm trying to use the cTreeViewCtrl class. Seems like it should be simple enough, however, when the class goes through the Init method it throws me an error at the "This.TreeView.Object.ImageList = This.Imagelist.Object" line.
>
>The error is:
>#1429 - OLE IDispatch exception code 0 from TreeCtrl: ImageList must be initialized before it can be used.
>
>The AddImageList method is called earlier so I'm assuming the ImageList is initialized. How do I check or verify that it is in fact initialized? Any ideas on solving this one?
>
>Here's the Init code in it's entirety for reference (this is the code included with the MM Framework, it is untouched)
>
>*---------------------- Location Section ------------------------
>*   Library: CActiveX.vcx
>*   Class:   CTreeViewBaseCtrl
>*   Method:  Init()
>*----------------------- Usage Section --------------------------
>*)  Description:
>*)		Adds the ImageList and TreeView controls to the
>*)		CTreeViewBaseCtrl container.
>
>*   Scope:
>*   Parameters:
>*$  Usage:
>*$
>*   Returns:  .F. if errors were encountered instantiating
>*				the TreeView or ImageList objects. Otherwise .T.
>*--------------------- Maintenance Section ----------------------
>*
>*   Change Log:
>*       CREATED 	06/01/98 - KJM
>*		MODIFIED	06/18/98 - QBT
>*			Ignore the return value of This.AddImageList()
>*		MODIFIED	03/16/99 - KJM
>*			Fixed a typo in the code that determines if the
>*			ImageList control successfully instantiated
>******************************************************************
>LOCAL llRetVal
>
>*------------------------------------------------------
>*-- Do not allow this class to be directly instantiated
>*------------------------------------------------------
>IF IsAbstract(This.Class, 'CTreeViewBaseCtrl')
>  RETURN .F.
>ENDIF
>
>*-------------------------------------------
>*--- Add the ImageList and TreeView controls
>*-------------------------------------------
>This.AddImageList()
>llRetVal = This.AddTreeView()
>IF llRetVal
>	*------------------------------------------------
>	*--- Set the TreeView control's dimensions to the
>	*--- height/width of the CTreeViewBaseCtrl container
>	*------------------------------------------------
>	This.TreeView.Height = This.Height
>	This.TreeView.Width = This.Width
>
>	*----------------------------------------------
>	*--- Store an object reference to the ImageList
>	*--- in the TreeView's ImageList property
>	*----------------------------------------------
>	IF TYPE('This.ImageList') == 'O'
>		This.TreeView.Object.ImageList = ;
>		  This.Imagelist.Object
>	ENDIF
>ENDIF
>
>RETURN llRetVal
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform