Re: Structs Question
- Posted by euman at bellsouth.net Jul 14, 2001
- 375 views
Never mind I figured it out. if I free(iParent) before I send this message hParent = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct}) there wont be any text for the root item. Now how in hek is this? I poked the text into the structure then free'd the allocated_string before I sent the message and it doesnt work and when I move the free() after the message......hmmm Im at a loss. (beats me) but it works now. Euman euman at bellsouth.net > > Thanks Derek for takeing a look! > > I already tried setting this up as below and it works showing > the parent and children and the pszText of the children and > the order of the tree is correct but, > the parent (above) pszText does not show, in other words > the parent doesnt have a name. > > I thought I might be missing something here. > > This is where Im looseing the text name for the root when I send > this message. > > hParent = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct}) > > and this doesnt make any since to me. > > Here it is again with changes>... > > > hImageList = c_func(xImageList_Create,{16,16,ILC_COLOR16,2,10}) > > hBitmap = LoadImage("list.bmp", IMAGE_BITMAP) > junk = c_func(xImageList_Add,{hImageList,hBitmap,NULL}) > c_proc(xDeleteObject, {hBitmap}) > > junk = c_func(SendMessage,{TreeView1,TVM_SETIMAGELIST,0,hImageList}) > > tvstruct = allocate_struct( SIZEOF_tvstruct ) > > poke4( tvstruct + TVINSERTSTRUCT_hParent,NULL) > poke4( tvstruct + TVINSERTSTRUCT_hInsertAfter,TVI_ROOT) > > poke4( tvstruct + > TVINSERTSTRUCTITEM_mask,or_all({TVIF_TEXT+TVIF_IMAGE+TVIF_SELECTEDIMAGE})) > > iParent = allocate_string("Parent Item") > poke4( tvstruct + TVINSERTSTRUCTITEM_pszText,iParent) > poke4( tvstruct + TVINSERTSTRUCTITEM_iImage,0) > poke4( tvstruct + TVINSERTSTRUCTITEM_iSelectedImage,1) > free(iParent) > > hParent = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct}) > > poke4( tvstruct + TVINSERTSTRUCT_hParent, hParent) > poke4( tvstruct + TVINSERTSTRUCT_hInsertAfter,TVI_LAST) > > Child1 = allocate_string("Child One") > poke4(tvstruct + TVINSERTSTRUCTITEM_pszText,Child1) > junk = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct}) > free(Child1) > > Child2 = allocate_string("Child Two") > poke4(tvstruct + TVINSERTSTRUCTITEM_pszText,Child2) > junk = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct}) > free(Child2) > > free(tvstruct) > > Euman > euman at bellsouth.net