Public Sub menuMYQUOTE_Click()
Dim seleccion As String
Dim cadena1 As String
Dim cadena2 As String
Dim contador As Integer
Dim posicion As Integer
posicion = TextEditor1.Line
seleccion = TextEditor1.SelectedText
contador = Len(seleccion)
cadena1 = seleccion
cadena2 = "\\begin{myquote}\n \\enquote{" & seleccion & "}\n\\end{myquote}"
If contador >= 1 Then
TextEditor1.Text = Replace(TextEditor1.Text, cadena1, cadena2)
Endif
TextEditor1.Line = posicion + 1
End
''Reqiures gb.form.editor
''Requiere gb.form.editor
sText As String[]
TextEditor1 As TextEditor
HBox1 As HBox
SliderCol As Slider
SliderRow As Slider
Label1 As Label
Public Sub Form_Open()
sText = ["0/. Hola = Hello", "1/. Adi ós = Goodbye", "2/. Por favor = Please", "3/. Gracias = Thank you", "4/. Lo siento = Sorry", "5/. Salud = Bless you", "6/. Sí = Yes", "7/. No = No", "8/. ¿Quién? = Who?", "9/. ¿Qué? = What?", "10/. ¿Por qué? = Why?", "11/. ¿Dónde? = Where?"]
BuildForm
SliderRow.Value = sText.max
TextEditor1_Cursor
TextEditor1.SetFocus
TextEditor1.Text = sText.Join(gb.NewLine)
Me.Center
End
Public Sub SliderCol_Change()
TextEditor1.Goto(SliderCol.Value, SliderRow.MaxValue - SliderRow.Value)
End
Public Sub SliderRow_Change()
TextEditor1.Goto(SliderCol.Value, SliderRow.MaxValue - SliderRow.Value)
End
Public Sub TextEditor1_Cursor()
Label1.Text = "Row = " & TextEditor1.Line & " Column = " & TextEditor1.Column
End
Public Sub BuildForm()
With Me
.Height = 400
.Width = 500
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With HBox1 = New HBox(Me)
.Expand = True
End With
With SliderRow = New Slider(HBox1) As "SliderRow"
.W = 28
.MaxValue = sText.Max
End With
With TextEditor1 = New TextEditor(HBox1) As "TextEditor1"
.Expand = True
.Wrap = True
.Font.Size = 16
.Font.Bold = True
End With
With SliderCol = New Slider(Me) As "SliderCol"
.Value = 0
.H = 28
.MaxValue = 25
End With
With Label1 = New Label(Me) As "Label1"
.H = 28
.Font.Bold = True
.Alignment = Align.Center
End With
End
Public Sub menuMYQUOTE_Click()
Dim seleccion As String
Dim cadena1 As String
Dim cadena2 As String
Dim contador As Integer
Dim pos1 As Integer
Dim pos2 As Integer
pos1 = TextEditor1.Line 'tomo el valor de la linea (pos Y)
pos2 = TextEditor1.Count 'cuento la posición del cursor (pos X)
seleccion = TextEditor1.SelectedText
contador = Len(seleccion)
cadena1 = seleccion
cadena2 = "\\begin{myquote}\n \\enquote{" & seleccion & "}\n\\end{myquote}"
If contador >= 1 Then
TextEditor1.Text = Replace(TextEditor1.Text, cadena1, cadena2)
Endif
TextEditor1.Goto(pos2, pos1 + 3) 'le indico al cursor que se mueva a la posición X,Y(+3 lineas) después del reemplazo
End