Hola, aquí tienen el código de un control de la aplicación que estoy haciendo, Falta mucho aún ya que para poder incorporarle todo lo que debería, también debo incorporarlo al resto de la aplicación pero antes tengo que hacer otras cosas. Bueno, los dejo con eso, es una clase llamada "BarUrl", y seguramente me preguntarán ¿Por qué no funciona nada? Yo les digo: Por lo que dije al principio
Bueno, aquí está la dama:
' gambas class file
'Source de ButtonBox adaptado a el navegador
'Su función actualmente es mostrar unas aplicaciones internas, pero proximamente
'reescribiré el código para que se puedan manejar las aplicaciones también en la UrlBar
Inherits UserControl
Public Const _Properties As String = "*,ButtonShow,Text,Picture,ReadOnly,Border=True"
Public Const _DefaultEvent As String = "Click"
Public Const _DefaultSize As String = "24,4"
Public Const _Similar As String = "ButtonBox"
Event MarkClick
Event Change
Property Url As String
Property Read Length As Integer
Property ReadOnly As Boolean
Property Border As Boolean
Property Favicon As Picture
Private $hPanel As Panel
Private $hBackground As TextBox
Private $hTextBox As TextBox
Private irButton As ToolButton
Private $MarkButton As ToolButton
Private $RssButton As ToolButton
Private $IconButton As PictureBox
Private $hObserver As Observer
Private picFavicon As Picture
Public Sub _new()
Dim sEventName As String = Object.LastEventName
$hObserver = New Observer(Me) As "Observer"
$hPanel = New Panel(Me) As "Panel"
'$hPanel.Border = Border.Sunken
'$hPanel.Background = Color.TextBackground
$hPanel.Arrangement = Arrange.Horizontal
$hPanel.Padding = 3
$hBackground = New TextBox($hPanel) As "Background"
$hBackground.ReadOnly = True
$hBackground.Ignore = True
'$hBackground.Enabled = False
$IconButton = New PictureBox($hPanel)
$IconButton.W = 22
$IconButton.Picture = Picture["Icons/html.png"]
$IconButton.Alignment = Align.Center
$hTextBox = New TextBox($hPanel)
$hTextBox.Expand = True
$hTextBox.Border = False
Object.Attach($hTextBox, Object.Parent(Me), sEventName)
irButton = New ToolButton($hPanel)
irButton.W = Desktop.Scale * 4
irButton.Picture = Themes.Icon("Go")
irButton.Border = False
$MarkButton = New ToolButton($hPanel)
$MarkButton.W = Desktop.Scale * 4
$MarkButton.Picture = Themes.Icon("Bookmark")
$MarkButton.Border = False
$RssButton = New ToolButton($hPanel)
$RssButton.W = Desktop.Scale * 4
$RssButton.Picture = Themes.Icon("Rss")
$hTextBox.SetFocus
End
Public Sub _attach(Parent As Object, Name As String)
If Not Name Then Return
If $hTextBox Then Object.Attach($hTextBox, Parent, Name)
End
Private Function Url_Read() As String
Return $hTextBox.Text
End
Private Sub Url_Write(Value As String)
$hTextBox.Text = Value
End
Public Sub MarkButton_Click()
$hTextBox.SetFocus
favForm.show
End
Public Sub RssButton_Click()
$hTextBox.SetFocus
End
Private Function ReadOnly_Read() As Boolean
Return $hTextBox.ReadOnly
End
Private Sub ReadOnly_Write(Value As Boolean)
$hTextBox.ReadOnly = Value
End
Public Sub Panel_Arrange()
$hBackground.Move(0, 0, $hPanel.W, $hPanel.H)
End
Public Sub Background_GotFocus()
$hTextBox.SetFocus
End
Public Sub Observer_GotFocus()
$hTextBox.SetFocus
End
Public Sub Clear()
$hTextBox.Clear
End
Private Function Length_Read() As Integer
Return $hTextBox.Length
End
Private Function Border_Read() As Boolean
Return $hBackground.Border
End
Private Sub Border_Write(Value As Boolean)
$hBackground.Border = Value
$hPanel.Padding = If(Value, 3, 0)
End
Private Function Favicon_Read() As Picture
Return picFavicon
End
Private Sub Favicon_Write(Value As Picture)
picFavicon = Value
$IconButton.Picture = picFavicon
End
Public Sub HideButton(Buton As String)
'Se puede esconder "GoButton","RssButton","MarkButton"
Select Case Buton
Case "GoButton"
irButton.Hide
Case "RssButton"
$RssButton.Hide
Case "MarkButton"
$MarkButton.Hide
End Select
End
Public Sub ShowButton(Buton As String)
'Se puede ver "GoButton","RssButton","MarkButton"
Select Case Buton
Case "GoButton"
irButton.show
Case "RssButton"
$RssButton.Show
Case "MarkButton"
$MarkButton.Show
End Select
End
Saludos!!
P.D: Si tienen alguna mejora, pues bienvenidos. El código está pobre para lo que estoy planeando, pero es que trabajo en más de 15 clases, 10 módulos y 20 formularios a la vez, a medida que se me ocurren las cosas (y agradezco a Dani26 por darme el consejo de comentar todo).