; Module/File: StatusBar_AddComboBoxText.pb ; Function: Adds ComboBoxText to existing statusbar - Linux [gtk3] ; Author: Omi ; Date: Dec. 19, 2014 ; Version: 0.2; 64-Bit-Prob. fixed ; Target Compiler: PureBasic 5.22/5.31/5.40/5.5/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" gtk_combo_box_text_new_with_entry() gtk_combo_box_text_append(*combo_box.GtkWidget, id.p-utf8, text.p-utf8); needs gtk3 gtk_combo_box_text_insert(*combo_box.GtkWidget, position, id.p-utf8, text.p-utf8); needs gtk3 gtk_combo_box_text_get_active_text(*combo_box.GtkWidget) g_signal_connect(*instance, detailed_signal.p-utf8, *c_handler, *data, destroy= 0, flags= 0) As "g_signal_connect_data" EndImport ; Object constants #Win_Main = 0 #StatusBar = 0 Global.l gEvent, gQuit Global *StatusBar, *SB_ComboBoxText1.GtkWidget ProcedureC Callback_ChangedEvent(*widget, signal, user_data) Protected.i activetext If *widget= *SB_ComboBoxText1 activetext= gtk_combo_box_text_get_active_text(*Widget) Debug "New Statusbar-ComboBoxText changed: " + PeekS(activetext, -1, #PB_UTF8) g_free_(activetext) EndIf EndProcedure If OpenWindow(#Win_Main, 300, 200, 300, 200, "Statusbar add ComboBoxText", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) If CreateStatusBar(#StatusBar, WindowID(#Win_Main)) AddStatusBarField(150) StatusBarText(#StatusBar, 0, "StatusBar-Text") *StatusBar= StatusBarID(#StatusBar) *SB_ComboBoxText1 = gtk_combo_box_text_new_with_entry() ;gtk_button_set_relief_(*SB_ComboBoxText1, #GTK_RELIEF_NONE); If you dont like a border gtk_combo_box_text_append(*SB_ComboBoxText1, "1", "entry 1"); fill boxtext, method 1 gtk_combo_box_text_append(*SB_ComboBoxText1, "2", "entry 2") ;or ... ; gtk_combo_box_text_insert(*SB_ComboBoxText1, 0, "0", "entry 1"); fill boxtext, method 2, use position= -1 for append ; gtk_combo_box_text_insert(*SB_ComboBoxText1, 1, "1", "entry 2") gtk_box_pack_start_(*StatusBar, *SB_ComboBoxText1, #True, #True, 10); pack in statusbar with 10pix distance gtk_widget_show_(*SB_ComboBoxText1) g_signal_connect(*SB_ComboBoxText1, "changed", @Callback_ChangedEvent(), 0, #Null, #Null) EndIf Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 16 ; Folding = - ; EnableUnicode ; EnableXP