; Module/File: Spin_PbSpinGadgetGetEntry.pb ; Function: Get API entry (StringGadget) from LinuxPureBasic SpinGadget - Linux gtk2/gtk3 ; Author: Omi ; Date: Aug. 24, 2017 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.3/5.4/5.5/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- ;Thus it (GtkEntry) can be manipulated with API commands. EnableExplicit ImportC "" gtk_entry_set_alignment(*entry.GtkEntry, xalign.f); not necessary EndImport ; Object constants #Win_Main = 0 #SpBG1 = 0 Global.i gEvent, gQuit Procedure.i SpinGadget_GetEntry(Gadget) CompilerIf #PB_Compiler_OS = #PB_OS_Linux If GadgetType(Gadget) = #PB_GadgetType_Spin Protected *entry = g_list_nth_data_(gtk_container_get_children_(GadgetID(Gadget)), 0) ProcedureReturn *entry EndIf CompilerEndIf EndProcedure Procedure Create_WinMain() If OpenWindow(#Win_Main, 300, 200, 500, 200, "PB-SpinGadget get entry (StringGadget)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) SpinGadget (#SpBG1, 5, 5, 100, 26, 0, 10, #PB_Spin_Numeric) SetGadgetState(#SpBG1, 5) Debug "StringGadget pointer (GtkEntry) within SpinGadget: " + SpinGadget_GetEntry(#SpBG1) ;as example centering text in StringGadget/entry ... gtk_entry_set_alignment(SpinGadget_GetEntry(#SpBG1), 0.5); centering EndIf EndProcedure Create_WinMain() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 40 ; Folding = - ; EnableUnicode ; EnableXP