?? tnw-tut-5.html
字號:
Description: Gets the radio button group caption.<P>Returns: 1 on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>int tnGetRadioButtonGroupClickedPos(TN_WIDGET *widget,int *x,int *y)</PRE><HR></CODE></BLOCKQUOTE>Description: Returns the x & y co-ordinates at which the pointer is clicked inside the radio button group.<P>Returns: 1 on success. -1 on failure.<H2><A NAME="TN_RADIOBUTTON"></A> <A NAME="ss5.6">5.6 TN_RADIOBUTTON</A></H2><P><H3>Introduction</H3><P>This is the radio button widget. It is to be placed inside a radio button group widget.<H3>Specification</H3><P>The default caption for a radio button is "Radio Button". The following properties can be defined via the <I>tnCreateWidget</I> call<UL><LI>TN_CAPTION : The radio button caption.</LI></UL><H3>Utility Functions</H3><P><BLOCKQUOTE><CODE><HR><PRE>int tnSetRadioButtonCaption(TN_WIDGET *widget,char *caption)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the caption text for the radio button.<P>Returns: 1 on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>int tnGetRadioButtonCaption(TN_WIDGET *widget,char *caption)</PRE><HR></CODE></BLOCKQUOTE>Description: Gets the radio button caption.<P>Returns: 1 on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>int tnSetRadioButtonStatus(TN_WIDGET *widget,TN_BOOL status)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the radio button status to selected (TN_TRUE) or unselected (TN_FALSE).<P>Returns: 1 on success. -1 on failure.<H2><A NAME="TN_TEXTBOX"></A> <A NAME="ss5.7">5.7 TN_TEXTBOX</A></H2><P><H3>Introduction</H3><P><B><I>The current textbox implementation although is almost usable is still under development. The user is advised to use the textbox widget with care.</I></B><P>This is the textbox widget. The textbox provides an editable text box on a window. Currenltly TinyWidgets supports single line (text entry field) and multiline textboxes(text areas). The textbox uses many special keys and hence relies on the scancode driver of microwindows. It has <B>NOT</B> been tested on other keyboard drivers and we wish to state clearly that it may not work with them. By default the textbox is a single line textbox with no default text.<H3>Specifications</H3><P>The following properties can be specified optionally for a textbox while calling <I>tnCreateWidget</I><UL><LI>TN_TEXTBOXTYPE : Choose either of TN_SINGLE_LINE or TN_MULTI_LINE.</LI><LI>TN_DEFAULTTEXT : Sets the default(initial) text for the textbox.</LI><LI>TN_FONTNAME : Selects the font to be used in the textbox.</LI><LI>TN_FONTSIZE : Chooses the size of the font.</LI><LI>TN_FGCOLOR : Sets the foreground color of text.</LI></UL>Examples:<P>A single line textbox with font <I>Times New Roman</I>, size 16 points and default text set to "Hello World!"<BLOCKQUOTE><CODE><HR><PRE>mytextbox=tnCreateWidget(TN_TEXTBOX,mywindow,10,10, TN_TEXTBOXTYPE,TN_SINGLE_LINE, TN_DEFAULTTEXT,"Hello World!", TN_FONTNAME,"times", TN_FONTSIZE,16, TN_END);</PRE><HR></CODE></BLOCKQUOTE><P>A simple multiline textbox with no default text.<BLOCKQUOTE><CODE><HR><PRE>mytextbox=tnCreateWidget(TN_TEXTBOX,mywindow,10,10, TN_TEXTBOXTYPE,TN_MULTI_LINE, TN_END);</PRE><HR></CODE></BLOCKQUOTE> <H3>Callbacks</H3><P>The following callbacks can be specified while calling <I>tnRegisterCallBack</I> for a textbox.<UL><LI>GOTFOCUS :Event occurs typically when user clicks in a textbox.</LI><LI>LOSTFOCUS :Event occurs typically when a user clicks elsewhere.</LI><LI>MODIFIED :Event occurs when keyboard activity modifies text in the textbox.</LI></UL><P><H3>Utility Functions</H3><P>The following utility functions can be used for a textbox to access and change its properties.<P><BLOCKQUOTE><CODE><HR><PRE>char * tnGetText(TN_WIDGET *widget)</PRE><HR></CODE></BLOCKQUOTE>Description: Returns the text in a buffer contained in the textbox. The user has to free the returned buffer.<P>Returns: A pointer to a character buffer containing the characters in the textbox on success, NULL on error.<BLOCKQUOTE><CODE><HR><PRE>int tnSetText(TN_WIDGET *widget,char *text)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the text in the textbox to <I>text</I><P>Returns: 1 on success. -1 on failure.<H2><A NAME="TN_SCROLLBAR"></A> <A NAME="ss5.8">5.8 TN_SCROLLBAR</A></H2><P>This is the scrollbar widget. These scrollbars can be placed on windows. The scrollbar widget has two orientations, namely TN_HORIZONTAL and TN_VERTICAL. By default the scrollbar is is a vertical scrollbar, with range set from 0 to 100 and linestep = 1 , pagestep = 5. The thumb can also be dragged to an arbitary position using the mouse.<P><H3>Specifications</H3><P>The following properties can be specified optionally for a scrollbar while calling <I>tnCreateWidget</I><P><UL><LI>TN_ORIENTATION :Selects one of TN_VERTICAL and TN_HORIZONTAL.</LI><LI>TN_MINVAL :Sets the value for the scrollbar when it is at minimum scrolled position</LI><LI>TN_MAXVAL :Sets the value for the scrollbar when it is at maxmum scrolled position</LI><LI>TN_LINESTEP :Sets the increment per single line of scrolling.</LI><LI>TN_PAGESTEP :Sets the increment per a page of scrolling.</LI></UL><P>Example: A vertical scrollbar with range 50 to 100 and pagestep = 10 , linestep = 2 <BLOCKQUOTE><CODE><HR><PRE>myscrollbar=tnCreateWidget(TN_SCROLLBAR,mywindow,10,10, TN_ORIENTATION,TN_VERTICAL, TN_MINVAL,50, TN_MAXVAL,100, TN_LINESTEP,2 TN_PAGESTEP,10, TN_END);</PRE><HR></CODE></BLOCKQUOTE>A horizontal scrollbar with default properties<BLOCKQUOTE><CODE><HR><PRE>myscrollbar=tnCreateWidget(TN_SCROLLBAR,mywindow,10,10, TN_ORIENTATION,TN_HORIZONTAL, TN_END);</PRE><HR></CODE></BLOCKQUOTE><P><H3>Callbacks</H3><P>The following callbacks can be specified while calling <I>tnRegisterCallBack</I> for a scrollbar.<P><UL><LI>CLICKED :This event occurs when user clicks on any part of the scrollbar.</LI></UL><P><H3>Utility functions </H3><P><BLOCKQUOTE><CODE><HR><PRE>int tnGetScrollbarOrientation(TN_WIDGET *widget,int *orientation)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets *orientation to either of TN_HORIZONTAL or TN_VERTICAL<P>Returns: 1 on success, -1 on error<BLOCKQUOTE><CODE><HR><PRE>int tnSetScrollbarOrientation(TN_WIDGET *widget,int orientation)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the orientation of scrollbar to <I>orientation</I><P>Returns: 1 on success, -1 on error<BLOCKQUOTE><CODE><HR><PRE>int tnGetScrollRange(TN_WIDGET *widget,int *minval,int *maxval)</PRE><HR></CODE></BLOCKQUOTE>Description: Gets the range of scrollbar into *minval and *maxval<P>Returns: 1 on success, -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnSetScrollRange(TN_WIDGET *widget,int minval,int maxval)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the range of scrollbar from <I>minval</I> to <I>maxval</I><P>Returns: 1 on success, -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnGetScrollStepSizes(TN_WIDGET *widget,int *pagestep,int *linestep)</PRE><HR></CODE></BLOCKQUOTE>Description: Gets the pagestep and linestep of scrollbar into *pagestep and *linestep respectively<P>Returns: 1 on success , -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnSetScrollStepSizes(TN_WIDGET *widget,int pagestep,int linestep)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the pagestep and linestep of scrollbar to <I>pagestep</I> and <I>linestep</I> respectively<P>Returns: 1 on success , -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnSetThumbPosition(TN_WIDGET *widget,int position)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the position of the thumb to <I>position</I><P>Returns: 1 on success , -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnGetThumbPosition(TN_WIDGET *widget)</PRE><HR></CODE></BLOCKQUOTE><P>Description: Gets the position of the thumb <P>Returns: Thumb position on success , -1 on failure.<P><BLOCKQUOTE><CODE><HR><PRE>int tnGetLastScrollEvent(TN_WIDGET *scrollbar)</PRE><HR></CODE></BLOCKQUOTE>Description: Gets the last scrolling event that occured with the scrollbar.<P>Returns: On success returns one of <UL><LI>TN_SCROLL_NOSCROLL</LI><LI>TN_SCROLL_LINEUP</LI><LI>TN_SCROLL_LINEDOWN</LI><LI>TN_SCROLL_PAGEUP</LI><LI>TN_SCROLL_PAGEDOWN</LI><LI>TN_SCROLL_THUMBMOVE</LI></UL>On failure returns -1<P><P><H2><A NAME="TN_PROGRESSBAR"></A> <A NAME="ss5.9">5.9 TN_PROGRESSBAR</A></H2><P><H3>Introduction</H3><P>This is the progressbar widget. It can be placed inside a window widget.<H3>Specifications</H3><P>A progress bar can be of type :<UL><LI>Continuous</LI><LI>Discrete</LI></UL>A continous progressbar is created by default. The following properties can be optionally specified for a progressbar via the a call to <I>tnCreateWidget</I><UL><LI>TN_STEPSIZE : The step size for the discrete progressbar.</LI><LI>TN_FILLCOLOR : The fill color for the bar.</LI><LI>TN_FONTNAME : The font to be used for the text which indicate completion status.</LI><LI>TN_FONTSIZE : The font size for the above mentioned text.</LI></UL><H3>Utility functions</H3><P><BLOCKQUOTE><CODE><HR><PRE>void tnProgressBarUpdate(TN_WIDGET *pbar, int value)</PRE><HR></CODE></BLOCKQUOTE>Description: Set the value for the progress bar.Returns: nothing<P><BLOCKQUOTE><CODE><HR><PRE>int tnGetProgressBarValue(TN_WIDGET *widget)</PRE><HR></CODE></BLOCKQUOTE>Description: Returns the current value for the progress bar.<P>Returns: The current value on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>int tnSetProgressBarFillColor(TN_WIDGET *widget,TN_COLOR color)</PRE><HR></CODE></BLOCKQUOTE>Description: Set the current fill color to "color".<P>Returns: 1 on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>TN_COLOR tnGetProgressBarFillColor(TN_WIDGET *widget)</PRE><HR></CODE></BLOCKQUOTE>Description: Returns the fill color.<P>Returns: The current fill color on success. -1 on failure.<BLOCKQUOTE><CODE><HR><PRE>int tnSetProgressBarStepSize(TN_WIDGET *widget,int stepsize)</PRE><HR></CODE></BLOCKQUOTE>Description: Sets the step size for a discrete progress bar.<P>Returns: 1 on success. -1 on failure; will return -1 for a continuous progress bar.<BLOCKQUOTE><CODE><HR><PRE>int tnGetProgressBarStepSize(TN_WIDGET *widget)</PRE><HR></CODE></BLOCKQUOTE>Description: Returns the current step size.<P>Returns: The current step size on success. -1 on failure ; will return -1 for a continuous progress bar.<H2><A NAME="TN_LISTBOX"></A> <A NAME="ss5.10">5.10 TN_LISTBOX</A></H2><P><P><H3>Introduction</H3><P>This is a listbox widget which allows the user to display a list of items on the screen.<P><H3>Specifications</H3><P>The following optional properties can be specified while calling <I>tnCreateWidget</I>.<UL><LI> TN_FONTNAME : The name of the font to be used to display the List items. This property will be valid only if the specified fontname is installed and Nano-X is compiled with freetype support.</LI><LI> TN_FONTSIZE : The size of the font to be used.</LI><LI> TN_FGCOLOR : The color to be used for displaying the ListItems in the Listbox.</LI><LI> TN_COUNT : The number of items to be displayed in the Listbox</LI><LI> TN_LISTITEMS : The list of items to be displayed in the ListBox. This property will be valid only if the TN_COUNT property is specified correctly.</LI><LI> TN_RESIZE : This property, if set to TN_TRUE, causes the listbox to be resized whenever the number of items in the listbox does not fit in the specified height. By default it is set to TN_TRUE.</LI></UL>Examples:<P>A listbox specification with default properties and 5 Items to be displayed.<P><BLOCKQUOTE><CODE><HR><PRE> char *s[] = {"Monday","Tuesday","Wednesday","Thursday","Friday"};listbox1 = tnCreateWidget(TN_LISTBOX,window1,10,20,TN_COUNT,5,TN_LISTITEMS,s,TN_END);</PRE><HR></CODE></BLOCKQUOTE><P>An empty Listbox with Times Font to be used to display the List Items.<P><BLOCKQUOTE><CODE><HR><PRE>listbox2 = tnCreateWidget(TN_LISTBOX,window1,20,30,TN_FONTNAME,"times",TN_FONTSIZE,12,TN_END);</PRE><HR>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -