Presentation is loading. Please wait.

Presentation is loading. Please wait.

Control of The Text Area and The Status Bar.

Similar presentations


Presentation on theme: "Control of The Text Area and The Status Bar."— Presentation transcript:

1 Control of The Text Area and The Status Bar.
Sung-Ju Kang Department of Physics Kangwon National University We will study the method of to control of the text area and the method of handle the status bar. We will use the GTK functions for to control(Cope, Cut, Paste) the text area. Finally, we study an exercise of File Open to handle the status bar.

2 1. Control of The Text Area
GtkText -- text widget which allows display and manipulation of arbitrary text. Gtk functions for text boxes include gtk_editable_get_chars() : changed gtk_text_thaw() : undid gtk_text_freeze() : fixed gtk_text_insert() : insert the text and others. Copy We use the function of void gtk_editable_copy_clipboard(GtkEditable *editable); 기본적으로 텍스트 영역 위젯 자체가 텍스트 입력 기능, 입력된 텍스트의 선택 기능, 방향키 및 백스페이스 키 기능 등을 사용자에게 텍스트의 내용을 편집할 수 있게 하거나 또는 사용자에게 여러 줄의 텍스트를 보여주기만 할 수 있다. 이 두가지 모드 사이를 왔다갔다하기 위해서 on_Copy_activate() in Callback.c gtk_editable_copy_clipboard( (GtkEditable *)gTextArea );

3 Declaration of the global variable in callbacks.c.
GtkText *gTextArea To make the handler of signal focus_in_event, and to add the code in the handler. gboolean on_text1_focus_in_event( GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { /* Add Start */ g_print( "on_text1_focus_in_event() start\n" ); if ( gTextArea == NULL ) gTextArea = (GtkText *)user_data; /* Add End */ return FALSE; }

4 Cut We use the function of void gtk_editable_cut_clipboard(GtkEditable *editable); on_Cut_activate() in Callback.c gtk_editable_cut_clipboard( (GtkEditable *)gTextArea ); Paste We use the function of void gtk_editable_paste_clipboard(GtkEditable *editable); on_Paste_activate() in Callback.c gtk_editable_paste_clipboard( (GtkEditable *)gTextArea );

5 2. Control of The Status Bar
We use the function for print of message. guint gtk_statusbar_push (GtkStatusbar *statusbar, guint context_id, const gchar *text); First parameter above function, GtkStatusbar *statusbar. Declaration of the global variable in interface.c. GtkStatusBar *gStatusBar = NULL; And Declaration variable in the function of create_window1(). gStatusBar = statusbar1;

6 Mouse signal handler Declaration of the global variable in callback.c.
extern GtkStatusbar gStatusBar ; In mouse enter signal handler gtk_statusbar_push( gStatusbar, 1, “File Open” ); And the mouse leave signal handler gtk_statusbar_pop( gStatusbar, 1 );

7 Summary 1. We can to control of the text area and the status bar as to modify the source cord. 2. To modify the source cord is used GTK functions.


Download ppt "Control of The Text Area and The Status Bar."

Similar presentations


Ads by Google