; Module/File: OptionGadget_GetGroupMembers.pb ; Function: Get group member widget id's of an OptionGadget - Linux ; Author: Omi ; Date: Oct. 16, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.4x ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ; Object constants #Win_Main = 0 Global.i gEvent, gQuit Global.i gRadioButtonFirst, gRadioButtonLast gRadioButtonFirst = #PB_Compiler_EnumerationValue Enumeration #OpG1 #OpG2 #OpG3 EndEnumeration Enumeration #PB_Compiler_EnumerationValue #OpG4 #OpG5 #OpG6 EndEnumeration gRadioButtonLast = #PB_Compiler_EnumerationValue- 1 Procedure OptionGadget_GetMemberIDs(Gadget); Gadget= PB-Id of Group-member Protected.i I Protected.i MemberId = GadgetID(Gadget) Protected *gsList0.GList = gtk_radio_button_get_group_(MemberId) Protected *gsList.GList = *gsList0 Protected *widget.GtkWidget If *gsList Debug "Members of OptionGadget-(RadioButton-)group for selection ..." Repeat *widget= *gsList\data For I= gRadioButtonFirst To gRadioButtonLast If *widget = GadgetID(I) Debug "Gadget: " + Str(I) + " '" + GetGadgetText(I) + "' = Widget (GadgetID): " + *widget EndIf Next I *gsList= *gsList\next Until *gsList = 0; must not be freed! EndIf ProcedureReturn *gsList0 EndProcedure Procedure Create_WinMain() If OpenWindow(#Win_Main, 300, 200, 400, 100, "OptionGadget (Groupmembers)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) OptionGadget(#OpG1, 5, 5, 190, 26, "Choose me") OptionGadget(#OpG2, 5, 30, 190, 26, "or me") OptionGadget(#OpG3, 5, 55, 190, 26, "or maybe me") TextGadget (#PB_Any, 0, 0, 10, 22, ""); pseudo - for new RadioButtonGroup ... OptionGadget(#OpG4, 205, 5, 190, 26, "Click me") OptionGadget(#OpG5, 205, 30, 190, 26, "or click me") OptionGadget(#OpG6, 205, 55, 190, 26, "me, me, me") EndIf EndProcedure Create_WinMain() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget Debug "Group-GList @: " + Str(OptionGadget_GetMemberIDs(EventGadget())) Debug " ---" EndSelect Until gQuit ; IDE Options = PureBasic 5.46 LTS Beta 2 (Linux - x86) ; CursorPosition = 3 ; Folding = - ; EnableUnicode ; EnableXP