_gtkWindowScrolledNew

This function creates a new scrolled window.
You should add it to a "classic" window, via _gtkWidgetAddContainer or into any boxes for example.

Crée une fenêtre avec asccenceur.

Type :

fun [Chn ObjGtk I I I I] ObjGtk

_channel_ : Chn : any channel where create the widget.

_widget_ : ObjGtk : any widget already created. This argument is optional and it can be 'nil'. If set, the widget will added automatically into hte scrolled window via gtk_container_add() if this widget has a native scrolling ability (TextView, Layout and TreeView) or via gtk_scrolled_window_add_with_viewport () for others widgets.

_width_ : I : the width, in pixels. It is optional (except if you use a Fixed container to include this scrolled window).

_heigth_ : I : the heigth, in pixels. It is optional (except if you use a Fixed container to include this scrolled window).

_policy_ : I : how show the horizontal (H) and vertical (V) scrollbars ? You can set this to use a combination of theses flags : SGTK_NEVER_SHOWN_HSCROLL, SGTK_AUTO_SHOWN_HSCROLL (default) or SGTK_ALWAYS_SHOWN_HSCROLL and
SGTK_NEVER_SHOWN_VSCROLL, SGTK_AUTO_SHOWN_VSCROLL (default) or SGTK_ALWAYS_SHOWN_VSCROLL.

_shadow_ : I : the type of the shadow : SGTK_SHADOW_NONE (No outline, default), SGTK_SHADOW_IN (The outline is bevelled inwards), SGTK_SHADOW_OUT, (The outline is bevelled outwards), SGTK_SHADOW_ETCHED_IN (The outline has a sunken 3d appearance) or SGTK_SHADOW_ETCHED_OUT (The outline has a raised 3d appearance).

Return : ObjGtk : the new scrolled window or nil if error.

Examples :

Two examples, two methods, same result !

How put a scrollbar to a TextView?

Ex 1 : with a widget

	typeof win = ObjGtk;;
	typeof texte = ObjGtk;;
	typeof windowScrolled = ObjGtk;;


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

	fun main ()=
		_showconsole;
	
		set win = _gtkWindowNew _channel nil "My test" SGTK_POS_MOUSE;
		_gtkWindowResize win 400 400;
		_gtkWindowCBdestroy win @end nil;
	
		set texte = _gtkTextNew _channel nil;
		_gtkTextSet texte "The Scol language is a GREAT language ! For more information, visit the Scolring, our web site !" nil;
	
		/* texte is already created, we can add it directly */
		set windowScrolled = _gtkWindowScrolledNew _channel texte 150 100 SGTK_NEVER_SHOWN_VSCROLL SGTK_SHADOW_IN;

		_gtkWidgetAddContainer win windowScrolled;
	
		_gtkWidgetShow win;
		_gtkMain;
		0;; 

_gtkWindowScrolledNew

Ex 2 : without a widget

	typeof win = ObjGtk;;
	typeof texte = ObjGtk;;
	typeof windowScrolled = ObjGtk;;


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

	fun main ()=
		_showconsole;
	
		set win = _gtkWindowNew _channel nil "My test" SGTK_POS_MOUSE;
		_gtkWindowResize win 400 400;
		_gtkWindowCBdestroy win @end nil;
		
		/* no widget set, texte is not created yet */	
		set windowScrolled = _gtkWindowScrolledNew _channel nil 150 100 SGTK_NEVER_SHOWN_VSCROLL SGTK_SHADOW_IN;
		
		set texte = _gtkTextNew _channel nil;
		_gtkTextSet texte "The Scol language is a GREAT language ! For more information, visit the Scolring, our web site !" nil;
		
		/* add texte to windowScrolled explicitely */
		_gtkWidgetAddContainer windowScrolled texte;

		_gtkWidgetAddContainer win windowScrolled;
	
		_gtkWidgetShow win;
		_gtkMain;
		0;; 

_gtkWindowScrolledNew

Back