_gtkTextBufferInsertWithTag

Insère une chaîne dans un textbuffer en précisant une liste de tags à placer sur cette chaîne.

Insère une chaîne dans un textbuffer en précisant une liste de tags à placer sur cette chaîne.

Type :

fun [ObjGtkTextBuffer [S r1] S I I] ObjGtkTextBuffer

_textbuffer_ : ObjGtkTextBuffer : any textbuffer already created.

_name_tags_list_ : [S r1] : a list of tag name already created. A tag should be created to _gtkTextTableTagAdd function. Of course, these tags must belong to the table (ObjGtkTextTableTag) of the textbuffer. If this list equals nil, this function is similar at _gtkTextBufferInsert.

_string_ : S : any string to insert to the buffer.

_position_ : I : an integer (position) where the string should be inserted. If negative, th position will be from the end. If nil, the position will be set to 0.

_length_ : I : inserted length of the string. If negatif, la valeur part depuis la fin de la chaine.

Return : ObjGtkTextBuffer : the same textbuffer or nil if error.

Example :

	typeof win = ObjGtk;;
	typeof object = ObjGtk;;
	typeof buffer = ObjGtkTextBuffer;;
	typeof table = ObjGtkTextTableTag;;
	typeof fixed = ObjGtk;;

	fun end (obj, u)=
		_gtkMainQuit;
		_closemachine;
		0;;

	fun click_url (obj, user_param, url)=
		_fooS strcat "user_param >>> " user_param;
		_openbrowserhttp url;
		0;;
	
	fun main ()=
		_showconsole;
	
		set win = _gtkWindowNew _channel nil "My test" SGTK_POS_MOUSE;
		_gtkWindowResize win 400 400;
		_gtkWindowCBdestroy win @end nil;
	
		/* create table tag, textbuffer and textview */
		set table = _gtkTextTableTagNew _channel;
		set buffer = _gtkTextBufferNew _channel table;
		set object = _gtkTextNew _channel buffer;
		
		/* add two tags to our table :
		 * first : a tag named "tag_underline". It sets the property "underline" to the value SGTK_UNDERLINE_SINGLE ;
		 * second : a tag named "tag_justify_weight". It sets two properties ("weight" and "justification").*/
		_gtkTextTableTagAdd table "tag_underline" ["underline" SGTK_UNDERLINE_SINGLE] :: nil;
		_gtkTextTableTagAdd table "tag_justify_weight" ["weight" SGTK_WEIGHT_ULTRABOLD] :: ["justification" SGTK_JUSTIFY_CENTER] :: nil;

		/* Set the content of the textbuffer ... */
		_gtkTextBufferSet buffer "The Scol language is a language !
For more information, click on this link : " nil;
		_gtkTextBufferInsertWithTag 
				buffer 	// textbuffer
				"tag_underline" :: "tag_justify_weight" :: nil	// list of the tag names
				"GREAT "	// the string
				(-55)	// the position, here from the end of the content of the textbuffer
				nil;	// length, here the entire string
		_gtkTextInsertUrl object @click_url "my_id" "http://www.scolring.org/" _gtkTextBufferLength buffer [0 0 65535] [50000 60000 60000] 1;

		set fixed = _gtkFixedNew _channel;
		_gtkFixedPut fixed object 10 10;
		_gtkWidgetAddContainer win fixed;
	
		_gtkWidgetShow win;
		_gtkMain;
		0;;

_gtkTextBufferInsertWithTag

Back