#include ONCE "window9.bi"

function GadgetToolTip(iGadgetParent as Long  , sText as String , iGadget as Long = 0) as integer export

	if iGadget then
	
		FreeGadget(iGadget)
		
		pGlobalTypeWindow9->OptGroup = 0 ' reset Group OptionGadget
		
		tree_add_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)
		
		dim as zstring ptr pszText = callocate(len(sText)+2)
		
		if pszText then
		
			*pszText = sText
			
			gtk_widget_set_tooltip_text(Cast(any ptr , GadgetID(iGadgetParent)) , pszText)
			
			pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , cast(integer,pszText) ,  24 , iGadgetParent)	
		
		else
		
			print "Allocated memory error in GadgetToolTip!"
		
		endif
		
	else
	
		gtk_widget_set_tooltip_text(Cast(any ptr , GadgetID(iGadgetParent)) , strptr(sText))

	EndIf 
	
	return 0
		
End Function