; Module/File: ComboBox_SetTearOff.pb ; Function: ComboBox: Set popup as tearoff - Linux < gtk3.10/deprecated in gtk3 ; Author: Omi ; Date: Oct. 20, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.4/5.5/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" gtk_combo_box_set_add_tearoffs(*combo_box.GtkComboBox, add_tearoffs) gtk_combo_box_set_title(*combo_box.GtkComboBox, title.p-utf8) EndImport #Win_Main= 0 #Bt1 = 0 #CbG1 = 1 Global.i gEvent, gQuit, gI If OpenWindow(#Win_Main, #PB_Ignore, #PB_Ignore, 400, 250, "ComboBox: set tearoff", #PB_Window_ScreenCentered) ButtonGadget (#Bt1, 5, 5, 200, 26, "ComboBox as 'tearoff'", #PB_Button_Toggle) TextGadget (#PB_Any, 5, 35, 300, 22, "After popup, click on the (1.) tearoff item ...") ComboBoxGadget(#CbG1, 5, 75, 200, 30) For gI= 1 To 5 AddGadgetItem(#CbG1, -1, "item #"+ Str(gI)) Next gI SetGadgetState(#CbG1, 0) gtk_combo_box_set_title(GadgetID(#CbG1), "Select item"); < gtk3.10, title for extra window in tearoff-mode EndIf Repeat gEvent = WaitWindowEvent() If EventWindow()= #Win_Main Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget Select EventGadget() Case #Bt1 gtk_combo_box_set_add_tearoffs(GadgetID(#CbG1), GetGadgetState(#Bt1)); #True / #False Case #CbG1 Debug GetGadgetState(#CbG1) EndSelect EndSelect EndIf Until gQuit ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 8 ; EnableUnicode ; EnableXP