\' Gambas class file
Public Sub _new()
Me.title = "Barra"
End
Public Sub Form_Open()
\'lectura de posicion de la ventana inicial...
Settings.Read(Me)
\'If Settings["ventana/ancho"] = "" Then
\'Else
\' Me.w = Settings["ventana/ancho"]
\'Endif
\'If Settings["ventana/largo"] = "" Then
\'Else
\' Me.h = Settings["ventana/largo"]
\'Endif
\'If Settings["ventana/x"] = "" Then
\'Else
\' Me.x = Settings["ventana/x"]
\'Endif
\'If Settings["ventana/y"] = "" Then
\'Else
\' Me.y = Settings["ventana/y"]
\'Endif
\'----------------------------------------------------
\'parametros para leer datos del boton 4 y 5
\'-------------------------------------------------
If Settings["Boton4/icono"] = "" Then
Else
ToolButton4.Picture = Picture.Load(Settings["Boton4/icono"])
Endif
If Settings["Boton4/tag"] = "" Then
ToolButton4.tag = ""
Else
ToolButton4.tag = Settings["Boton4/tag"]
Endif
If Settings["Boton5/icono"] = "" Then
Else
ToolButton5.Picture = Picture.Load(Settings["Boton5/icono"])
Endif
If Settings["Boton5/tag"] = "" Then
ToolButton5.tag = ""
Else
ToolButton5.tag = Settings["Boton5/tag"]
Endif
End
Public Sub HPanel1_MouseDown()
\'defino grupo de botones
\'se define en la ventana de propiedades como Group=BarraBotones
ToolButton1.tag = "libreoffice --writer" \'comando al que se va a llamar
ToolButton2.tag = "evolution"
ToolButton3.tag = "rhythmbox"
End
Public Sub Form_Resize()
If Me.w < 42 Then Me.w = 42
If Me.h < 49 Then Me.h = 49
HPanel1.w = Me.W
HPanel1.h = Me.h
End
Public Sub form_Close()
\'guardo los datos de la barra
Settings.Write(Me) \'mejora dada por Shordi: http://www.gambas-es.org/viewtopic.php?f=1&t=3611&highlight=
\'Settings["ventana/ancho"] = Me.w
\' Settings["ventana/largo"] = Me.h
\'Settings["ventana/x"] = Me.x
\'Settings["ventana/y"] = Me.y
End
Public Sub BarraBotones_Click()
accionbotones()
End
Public Sub accionbotones()
Dim lectura As String
If Last.tag <> "" Then
Shell Last.tag
Endif
End
Public Sub BarraBotones_Menu()
\'boton izquierdo...
Dim comando As String
If Last = ToolButton4 Or Last = ToolButton5 Then
Message.Info("A continuacion se le pedira el icono de la aplicacion")
Dialog.Filter = ["*.png", "png", "*.jpg", "jpg"]
If Dialog.OpenFile() Then
Else
Last.picture = Picture.Load(Dialog.path)
Endif
comando = InputBox("Comando:")
Last.tag = comando
If Last.name = "ToolButton4" Then
Settings["Boton4/icono"] = Dialog.path
Settings["Boton4/tag"] = ToolButton4.Tag
Else
Settings["Boton5/icono"] = Dialog.path
Settings["Boton5/tag"] = ToolButton5.Tag
Endif
Endif
End