#include ONCE "window9.bi"

sub SetToolTipText(iGadgetParent as Long , iGadget as Long , sText as string) export
	
	dim as ListT ptr pList = pGlobalTypeWindow9->ListGadgets->firstNode
	
	while pList
	
		if pList->anyOneData = iGadget then
			
			gtk_widget_set_tooltip_text(Cast(any ptr , GadgetID(pList->anyFourData)) , 0)
				
			dim as zstring ptr pszText = cast(any ptr ,pList->anyTwoData) 
			
			if pszText then deallocate(pszText)

			pszText = callocate(len(sText)+2)
			
			if pszText then
				
				*pszText = sText
				
			else
			
				print "Allocated memory error in SetToolTipText!"
				
			EndIf
			
			pList->anyTwoData = cast(integer,pszText)

			gtk_widget_set_tooltip_text(Cast(any ptr , GadgetID(pList->anyFourData)) , cast(any ptr ,pList->anyTwoData))
			
			exit while

		EndIf
		
		pList = pList->nextNode

	Wend	

End Sub