; Module/File: EditField_SelectOnFocus.pb ; Function: StringGadget - set autoselection on focus - Linux ; Author: Omi ; Date: Aug. 21, 2015 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.40 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" g_object_set(*object.GObject, property_name.p-utf8, *data, v= 0) EndImport ; Object constants #MainWin= 0 #But1 = 0 #Strg1 = 1 #Strg2 = 2 #Strg3 = 3 Global.i gEvent, gQuit Global *gSettings If OpenWindow(#MainWin, 300, 200, 300, 150, "StringGadget select on focus", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(#But1, 5, 5, 150, 25, "Select on focus", #PB_Button_Toggle) StringGadget(#Strg1, 5, 35, 150, 25, "Focus me with [Tab]") StringGadget(#Strg2, 5, 65, 150, 25, "Focus me with [Tab]") StringGadget(#Strg3, 5, 95, 150, 25, "Focus me with [Tab]") SetGadgetState(#But1, #True) *gSettings= gtk_settings_get_default_() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget If EventGadget() = #But1 ;*** focus-setting is set here ... *** g_object_set(*gSettings, "gtk-entry-select-on-focus", GetGadgetState(#But1)) ;*** *** EndIf EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.40 LTS (Linux - x64) ; CursorPosition = 25 ; EnableUnicode ; EnableXP