#include ONCE "window9.bi"

function LenItemTextComboBox(iGadget as Long, iItem as Long ) as Long export
	
	dim as GtkListStore ptr liststore
	
	dim as GtkTreeIter iter
	
	dim as Long iIndex
	
	dim as Long iRet
	
	dim as zstring ptr item_s	
	
	dim as Hwnd combo = GadgetId(iGadget)	
	
	liststore = cast(any ptr , gtk_combo_box_get_model(cast(any ptr,combo)))	
	
	iRet = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(liststore), @iter)
	
	while iRet	
		
		if iIndex = iItem then
			
			gtk_tree_model_get(GTK_TREE_MODEL(liststore), @iter, 1, @item_s,  -1)
			
			function = len(WSTR(*item_s))
			
			exit while
			
		EndIf
		
		iIndex += 1
		
		iRet = gtk_tree_model_iter_next (GTK_TREE_MODEL(liststore), @iter)
		
	Wend		
	
End Function