#include ONCE "window9.bi"

sub SetGadgetText(iGadget as Long , sText as string) export
	
	dim as hwnd pWidget 
	
	dim as long classWidget
	
	dim as ListT ptr pTemp = pGlobalTypeWindow9->ListGadgets->findNodeFunc(iGadget)
	
	if pTemp <> 0 then
		
		pWidget = cast(hwnd,pTemp->anyTwoData)
		
		classWidget = pTemp->anyThreeData
		
	else
		
		exit sub
		
	endif
	
	select case classWidget
			
		Case 1 , 9 , 10
			
			gtk_button_set_label(cast(any ptr,pWidget) , strptr(sText))
			
			var f = g_object_get_data (cast(any ptr, pWidget), "FONT")
			
			gtk_widget_modify_font(gtk_bin_get_child(GTK_BIN(pWidget)) , f)		
			
		case 2
			
			dim as  GtkTextBuffer ptr buffer = gtk_text_view_get_buffer(cast(any ptr,pWidget))
			
			if len(sText) then
				
				gtk_text_buffer_set_text( buffer, sText ,-1)
				
			else
				
				gtk_text_buffer_set_text( buffer, "" ,-1)
				
			EndIf	
			
		Case 5
			
			gtk_label_set_text(cast(any ptr,pWidget) , strptr(sText))
			
		case 6 , 7
			
			if len(sText) then
				
				gtk_entry_set_text(cast(any ptr,pWidget) , strptr(sText))
				
			else
				
				gtk_entry_set_text(cast(any ptr,pWidget) , "")
				
			EndIf
			
		case 11
			
			gtk_label_set_text(cast(any ptr,pWidget) , strptr(sText))
			
			gtk_label_set_markup (cast(any ptr,pWidget), "<u>" & sText & "</u>")
			
		case 16
			
			dim as any ptr label = gtk_frame_get_label_widget(cast(any ptr,pWidget))
			
			gtk_label_set_text(label, strptr(sText))
			
		case 27
			
			dim as any ptr label = g_object_get_data (cast(any ptr,pWidget), "statusbarchild")
			
			gtk_label_set_text(cast(any ptr,label) , strptr(sText))
			
	End Select			
	
End Sub