' Gambas class file
hToolButton As ToolButton
Label1 As Label
Public Sub TButtons_Click()
Label1.Text = Last.Name
End
Public Sub Form_Open()
Dim HBox1 As HBox
Dim Spring1 As Spring
Dim iLoop As Integer
Dim sName As String[] = ["ToolButton 1", "ToolButton 2", "ToolButton 3"]
Dim sText As String[] = ["&1", "&2", "&3"]
Dim sPicture As String[] = ["icon:/96/administrator", "icon:/96/alarm", "icon:/96/anchor"]
With Me
.H = 150
.W = 450
.Arrangement = Arrange.Vertical
.Padding = 5
End With
HBox1 = New Hbox(Me)
HBox1.H = 96
HBox1.W = 100
For iloop = 0 To 2
With hToolButton = New ToolButton(HBox1) As "TButtons"
.W = 96
.H = 96
.Border = True
.Text = sText[iLoop]
.Name = sName[iLoop]
.Font.Size = 1
.Picture = Picture[sPicture[iLoop]]
End With
If iLoop < 2 Then Spring1 = New Spring(hBox1)
Next
Spring1 = New Spring(Me)
With Label1 = New Label(Me) As "Label1"
.H = 36
.W = 100
.Font.Bold = True
.Alignment = Align.Center
End With
End
Cita:No está mal tu solución, pero me parece un poco zarrapastosa, ¿no crres?¡Estoy destrozado! Me he levantado y lo he vuelto a intentar.
' Gambas class file
hToolButton As ToolButton
Label1 As Label
Timer1 As Timer
Public Sub Form_KeyRelease()
If Key.Code = Key["1"] And Key.Alt Then TButtons_Click("1")
If Key.Code = Key["2"] And Key.Alt Then TButtons_Click("2")
If Key.Code = Key["3"] And Key.Alt Then TButtons_Click("3")
End
Public Sub TButtons_Click(Optional sNo As String)
Dim sText As String = "ToolButton "
If sNo <> "" Then
Label1.Text = sText & sNo
Else
Label1.Text = Last.Name
Endif
End
Public Sub Timer1_Timer()
Me.SetFocus
End
Public Sub Form_Open()
Dim HBox1 As HBox
Dim Spring1 As Spring
Dim iLoop As Integer
Dim sName As String[] = ["ToolButton 1", "ToolButton 2", "ToolButton 3"]
Dim sPicture As String[] = ["icon:/96/administrator", "icon: /96/alarm", "icon:/96/anchor"]
With Me
.H = 150
.W = 450
.Arrangement = Arrange.Vertical
.Padding = 5
End With
HBox1 = New Hbox(Me)
HBox1.H = 96
HBox1 .W = 100
For iloop = 0 To 2
With hToolButton = New ToolButton(HBox1) As "TButtons"
.W = 96
.H = 96
.Border = True
.Name = sName[iLoop]
.Font.Size = 1
.Picture = Picture[sPicture[iLoop]]
End With
If iLoop < 2 Then Spring1 = New Spring(hBox1)
Next
Spring1 = New Spring(Me)
With Label1 = New Label(Me) As "Label1"
.H = 36
.W = 100
. Font.Bold = True
.Alignment = Align.Center
End With
Timer1 = New Timer
Timer1.Start
End