; Module/File: EditField_GetTextscrollOffset.pb ; Function: Get textscroll offset on to long strings - Linux ; Author: Omi ; Date: Mar. 13, 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_property(*object.GObject, property.p-utf8, *gval) g_object_get_property(*object.GObject, property.p-utf8, *gval) EndImport ; Object constants #MainWin= 0 #St1 = 0 #But1 = 1 #WinX= 300 #WinY= 200 #WinW= 300 #WinH= 200 Global.i gEvent, gQuit Global *gString.GtkWidget Global gval.GValue ;GType ... #G_TYPE_INT = 24 If OpenWindow(#MainWin, 100, 120, #WinW, #WinH, "StringGadget: textscroll-offset", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) StringGadget(#St1, 5, 2, 150, 25, "Too much text in the StringGadget to show all") ButtonGadget(#But1, 5, 30, 190, 26, "Show text-scroll-offset") *gString= GadgetID(#St1) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget If EventGadget()= #But1 g_value_init_(@gval,#G_TYPE_INT) g_value_set_int_(@gval, #Null) g_object_get_property(*gString, "scroll-offset", @gval) Debug "Textscroll-Offset [pix]: " + Str(g_value_get_int_(@gval)) g_value_unset_(@gval) EndIf EndSelect Until gQuit EndIf End ; IDE Options = PureBasic 5.41 LTS (Linux - x64) ; CursorPosition = 15 ; EnableUnicode ; EnableXP ; CurrentDirectory = /home/charly-xubuntu/Programming/PureBasic/purebasic/