; Module/File: ComboBox_PopupShownNotify.pb ; Function: ComboBox: Retrieve popup-shown state - Linux ; 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 "" g_object_get(*object.GObject, property.p-utf8, *pdata, v= 0) g_signal_connect(*instance, detailed_signal.p-utf8, *c_handler, *data, destroy= 0, flags= 0) As "g_signal_connect_data" EndImport #Win_Main= 0 #CbG1 = 1 Global.i gEvent, gQuit, gI ProcedureC Callback_PopupShown(*widget.GtkComboBox, dummy, user_data) Protected.i Res If *widget = GadgetID(#CbG1) g_object_get(*widget, "popup-shown", @Res) Debug "Popup at Gadget " + Str(user_data) + " is shown? " + Str(Res) EndIf EndProcedure If OpenWindow(#Win_Main, #PB_Ignore, #PB_Ignore, 400, 150, "ComboBox: popup shown?", #PB_Window_ScreenCentered) ComboBoxGadget(#CbG1, 5, 5, 200, 30) For gI= 1 To 5 AddGadgetItem(#CbG1, -1, "item #"+ Str(gI)) Next gI SetGadgetState(#CbG1, 0) g_signal_connect(GadgetID(#CbG1), "notify::popup-shown", @Callback_PopupShown(), #CbG1) EndIf Repeat gEvent = WaitWindowEvent() If EventWindow()= #Win_Main Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget Select EventGadget() Case #CbG1 Debug "ComboBox item selection = " + Str(GetGadgetState(#CbG1)) EndSelect EndSelect EndIf Until gQuit ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 13 ; Folding = - ; EnableUnicode ; EnableXP