]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/textctrl.cpp
Various changes to make pop up menus work
[wxWidgets.git] / src / gtk1 / textctrl.cpp
index 8dff685433d179120daa1479f3e8dbddb5362fe4..1c63ae186ea6967e14abacb3eec346d42b72a5b1 100644 (file)
@@ -791,9 +791,19 @@ void wxTextCtrl::SetSelection( long from, long to )
     gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
 }
 
-void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
+void wxTextCtrl::ShowPosition( long pos )
 {
-//    SetInsertionPoint( pos );
+    if (m_windowStyle & wxTE_MULTILINE)
+    {
+        GtkAdjustment *vp = GTK_TEXT(m_text)->vadj;
+        float totalLines =  (float) GetNumberOfLines();
+        long posX;
+        long posY;
+        PositionToXY(pos, &posX, &posY);
+        float posLine = (float) posY;
+        float p = (posLine/totalLines)*(vp->upper - vp->lower) + vp->lower;
+        gtk_adjustment_set_value(GTK_TEXT(m_text)->vadj, p);
+    }
 }
 
 long wxTextCtrl::GetInsertionPoint() const