_gtkTextInsertUrl

Insert an url to the text object (textview) at the specific position.

Insère une url dans un objet texte (textview), à une position donnée.

Type :

fun [ObjGtk fun [ObjGtk u0 S] u1 u0 S I [I I I] [I I I] I] ObjGtk

_text_ : ObjGtk : any text object already created.

_reflex_ : fun [ObjGtk u0 S] u1 : callback called when the user click on the url.

_user_parameter_ : u0 : an argument at your convenience (-> _reflex_).

_url_ : S : the url (typacally http://, https://, scol://, ftp:// or mailto:) or another string at your convenience;

_position_ : I : the position where _url_ will added.

_foreground_color_ : [I I I] : red, green and blue composants to the color of the _url_.

_background_color_ : [I I I] : red, green and blue composants to the color of the background.

_underline_ : I : if 1, _url_ will be underlined.

Return : ObjGtk : the same _text_ or nil if error.


See also :
_gtkTextTableTagAdd,
_gtkTextTableTagAddS,
_gtkTextTagCBclick,
_gtkTextTagCBclickEx.

Example :

	typeof win = ObjGtk;;			// window
	typeof object = ObjGtk;;		// textview
	typeof buffer = ObjGtkTextBuffer;;	// textbuffer

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

	fun click_url (obj, user_param, url)=
		_fooS strcat "user_param >>> " user_param;
		_openbrowserhttp strcat url user_param;
		0;;
	
	fun main ()=
		_showconsole;
	
		set win = _gtkWindowNew _channel nil "My test" SGTK_POS_MOUSE;
		_gtkWindowResize win 400 400;
		_gtkWindowCBdestroy win @end nil;
	
		set buffer = _gtkTextBufferNew _channel nil;
		set object = _gtkTextNew _channel buffer;
		_gtkTextSet object "The Scol language is a GREAT language !
For more information, click on this link : " nil;
		let _gtkTextBufferLength buffer -> nbAllChars in
		_gtkTextInsertUrl 
			object 				// textview
			@click_url 			// callback
			"forum.php" 			// user_param
			"http://www.scolring.org/" 	// url
			nbAllChars 			// position (here, at the end)
			[0 0 65535] 			// foreground color
			[50000 60000 60000] 		// background color
			1;				// underlined, yes
	
		_gtkWidgetAddContainer win object;
		_gtkWidgetShow win;
		_gtkMain;
		0;;

When the user click on the url, the callback ('click_url') will called. The console displays

	user_param >>> forum.php
and the default web browser go to the Scolring forum.

gtkTextInsertUrl

Back