Posted: Sat Aug 31, 2002 12:18 am
Restored from previous forum. Originally posted by freak.
Hi all,
I want to create a TreeView Control on my own, becourse i want to
enable drag&drop which seems to be disabled in TreeGadget().
I read the TreeView Stuff in the Platform SDK, and also found an example there, wich i translated to PureBasic. But it always crashes
at the SendMessage_() command.
I allready have some experience in adding/deleting items (see viewtopic.php?t=1929), so this part can not be the problem.
Here's the code:
Hope anyone can help me here...
Timo
--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
...So far, the universe is winning.
Hi all,
I want to create a TreeView Control on my own, becourse i want to
enable drag&drop which seems to be disabled in TreeGadget().
I read the TreeView Stuff in the Platform SDK, and also found an example there, wich i translated to PureBasic. But it always crashes
at the SendMessage_() command.
I allready have some experience in adding/deleting items (see viewtopic.php?t=1929), so this part can not be the problem.
Here's the code:
Code: Select all
#WC_TREEVIEW.s = "SysTreeView"
#ID_TREEVIEW = 107
#Flags = #WS_VISIBLE | #WS_CHILD | #WS_BORDER | #TVS_HASLINES
Structure TVITEM
mask.l
hItem.l
state.l
stateMask.l
pszText.l
cchTextMax.l
iImage.l
iSelectedImage.l
cChildren.l
lParam.l
EndStructure
Structure TVINSERTSTRUCT
hParent.l
hInsertAfter.l
item.TVITEM
EndStructure
hWnd = OpenWindow(0, 0, 0, 640, 480, #PB_Window_SystemMenu, "")
; There must be some fault! This is the example code from SDK:
; -----------------------------------------------------------
; hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View",
; WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES,
; 0, 0, 640, 480,
; hwndParent, (HMENU) ID_TREEVIEW, g_hinst, NULL);
hwndTV = CreateWindowEx_(0, #WC_TREEVIEW, "Tree View", #Flags, 0, 0, 640, 480, hWnd, #ID_TREEVIEW, GetModuleHandle_(0), #NULL)
text.s = "Hello World!" ; This stuff used to work with a TreeGadget()
lpis.TVINSERTSTRUCT
lpis\hParent = #TVI_ROOT
lpis\hInsertAfter = #TVI_ROOT
lpis\item\mask = #TVIF_TEXT
lpis\item\pszText = @text
lpis\item\cchTextMax = Len(text)
hItem = SendMessage_(hwndTV, #TVM_INSERTITEM, 0, @lpis) ; prog crashes here!
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
End
Timo
--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
...So far, the universe is winning.