Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Visual Basic clásico (http://www.forosdelweb.com/f69/)
-   -   Msflexgrid (http://www.forosdelweb.com/f69/msflexgrid-421509/)

Jennifer_munn 30/08/2006 06:13

Msflexgrid
 
Bueno, allá voy con el más dificil todavia...
Alguien sabe cómo puedo seleccionar texto dentro de una celda de un MSFlexgrid??? y situar el cursor al principio, al final o entre las letras ya escritas???
ahí queda eso...

tazzito 30/08/2006 08:04

queeee tal señorita vamos por parte un msflexgrid no tiene la posibilidad de edicion, para esto se trabaja con otras grillas o en su defecto con un textbox que hace las veces de celda activa, esto no es totalmente dificil, solo debes manejarte bien con el posisionamiento, deberias probar con algo asi
DpiRow=200
textedicion.top = (grilla.rows * DpiRow ) grilla1.top
textedicion.width = grilla.colwith(grilla.col)
txtedicion.text = grilla.text
txtedicion.visible=true
txtedicion.selstart =0
txtedicion.selenght = len(txtedicion.text)

cozas asi jugar con el valor del dpi etc

Neverhood 04/09/2006 22:53

No es algo sencillo, pero aquí lo tienes:

El código del FLEX:
Código:

Private Sub Flex1_KeyPress(KeyAscii As Integer)
    Dim LeftCel As Long, LeftFlx As Long
    Dim TopCel As Long, TopFlx As Long
    Dim WidthCel As Long, HeightCel As Long
    Dim Contenido As String
    Dim Fila As Long, Columna As Long

    If KeyAscii = vbKeyReturn Then
        Fila = Flex1.Row: Columna = Flex1.Col
        Contenido = Flex1.Text
        ContenidoAnterior = Flex1.Text
        If Fila > 0 And Columna = 1 Then 'solo si quieres limitar cual columna es editable, si no, elimina esta linea
            With Flex1
                LeftCel = .CellLeft
                TopCel = .CellTop
                WidthCel = .CellWidth
                HeightCel = .CellHeight
                LeftFlx = .Left
                TopFlx = .Top
                Contenido = .Text
                .Enabled = False
            End With

            With TxtDecim
                .Height = HeightCel
                .Width = WidthCel
                .Left = LeftCel + LeftFlx
                .Top = TopCel + TopFlx
                .Text = Contenido
                .Visible = True
                .SetFocus
            End With
        End If

        KeyAscii = 0
    End If
End Sub

Ahora el código del TEXT:
Código:

Private Sub TxtDecim_KeyPress(KeyAscii As Integer)
    Dim ContenidoText As String
   
    If KeyAscii = vbKeyReturn Then
        With TxtDecim
            ContenidoText = .Text
            .Visible = False
        End With
        With Flex1
            .Text = ContenidoText
            .Enabled = True
            .SetFocus
        End With
    End If
End Sub

Espero te sirva!!! Y cualquier duda, estoy a tus órdenes


La zona horaria es GMT -6. Ahora son las 09:38.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.