; Module/File: Editor_GetScrolledWindow.pb ; Function: EditorGadget: Get ScrolledWindow for access to scrollbars/adjustments - Linux gtk2/gtk3 ; Author: Omi ; Date: Jan. 01, 2016 ; 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 "" gtk_scrolled_window_get_vscrollbar(*scrolled_window.GtkScrolledWindow); gtk 2.8+ gtk_scrolled_window_get_hscrollbar(*scrolled_window.GtkScrolledWindow); gtk 2.8+ EndImport ; Object constants #Win_Main = 0 #Edt1 = 0 #Edt2 = 1 #Splitter = 2 #But1 = 3 Global.i gEvent, gQuit Global.GtkTextView *gTextView Global.GtkScrolledWindow *gScrolledWindow Global.GtkWidget *gVScrollbar, *gHScrollbar Global.GtkAdjustment *gVAdjustment, *gHAdjustment Global.s S1= "A little Text to demonstrate a multiple view of the same text being shown and editable in 2 (or more) PureBasic-EditorGadget. " + #LF$ + #LF$ + "To make this possible it is necessary To use the same 'TextBuffer' for several EditorGadgets (TextViews)!" + #LF$ + #LF$ + "Enter some new text here and change the Editor to type in your text ..." + #LF$ + #LF$ + #LF$ + #LF$ + "Some lines to fill the place:" + #LF$ + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. "+ #LF$ + "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. "+ #LF$ + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. "+ #LF$ + "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." If OpenWindow(#Win_Main, 0, 0, 500, 235, "Editor - ScrolledWindow & more", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(#But1, 5, 5, 200, 26, "Get ScrolledWindow & more") EditorGadget(#Edt1, 5, 40, 490, 190, #PB_Editor_WordWrap) AddGadgetItem(#Edt1, -1, S1) *gTextView= GadgetID(#Edt1) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget Select EventGadget() Case #But1 *gScrolledWindow= gtk_widget_get_parent_(*gTextView); here's the ScrolledWindow from EditorGadget *gVScrollbar = gtk_scrolled_window_get_vscrollbar(*gScrolledWindow); here's the vertical scrollbar from ScrolledWindow *gHScrollbar = gtk_scrolled_window_get_hscrollbar(*gScrolledWindow); here's the horizontal scrollbar *gVAdjustment = gtk_scrolled_window_get_vadjustment_(*gScrolledWindow); here's the vertical adjustment from ScrolledWindow *gHAdjustment = gtk_scrolled_window_get_hadjustment_(*gScrolledWindow); here's the horizontal adjustment Debug "Editors ScrolledWindow " + Str(*gScrolledWindow) Debug "ScrolledWindows vertical Scrollbar " + Str(*gVScrollbar) Debug "ScrolledWindows horizontal Scrollbar " + Str(*gHScrollbar) Debug "ScrolledWindows vertical Adjustment " + Str(*gVAdjustment) Debug "ScrolledWindows horizontal Adjustment " + Str(*gHAdjustment) EndSelect EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 3 ; EnableUnicode ; EnableXP