Insertion of nodes via API doesn't work correctly in PB 4
Posted: Thu Jun 08, 2006 10:06 am
This example code
adds 5 nodes to a tree list and works quite well in PB 3.94 but in PB 4.0 you see only black text on a black background. If you use the native PB AddGadgetItem() command instead of the API the nodes are displayed as expected even in PB 4.0. Does anyone have an explanation for it?
Code: Select all
NodeText.S
If OpenWindow(0, 0, 0, 250, 300, "Demo: Add Nodes to TreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
TreeGadget(0, 10, 10, 230, 280, #PB_Tree_AlwaysShowSelection | #PB_Tree_CheckBoxes)
For i = 1 To 5
NodeText = "Node " + Str(i)
; AddGadgetItem(0, -1, NodeText, 0)
InsertStruct.TV_INSERTSTRUCT\hParent = hItemParent
InsertStruct.TV_INSERTSTRUCT\hInsertAfter = #TVI_LAST
InsertStruct.TV_INSERTSTRUCT\Item\Mask = #TVIF_TEXT
InsertStruct.TV_INSERTSTRUCT\Item\pszText = @NodeText
InsertStruct.TV_INSERTSTRUCT\Item\cchTextMax = Len(NodeText)
SendMessage_(GadgetID(0), #TVM_INSERTITEM, 0, @InsertStruct)
Next i
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EndIf