Código fuente: https://www.gambas-es.org/download.php?id=1005
Allanando el camino a los iniciados en Gambas, porque programar en Gambas es un placer!!
Mostrando las entradas con la etiqueta Control. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Control. Mostrar todas las entradas
jueves, 1 de marzo de 2018
jueves, 26 de enero de 2017
Control fbcolor by postapase
Interfaz gráfica de la clase (form)
' gambas class file
'by Postapase 26 enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control fbcolor (foreground, background color)
Event CambioTrazo
Event CambioFondo
Event EnterTrazo
Event EnterFondo
Event Reseteo
Event EnterReseteo
Public Sub cbtnTrazo_Change()
Raise CambioTrazo
End
Public Sub cbtnFondo_Change()
Raise CambioFondo
End
Public Sub tbtnReseteo_Click()
Raise Reseteo
End
Public Sub cbtnTrazo_Enter()
Raise EnterTrazo
End
Public Sub cbtnFondo_Enter()
Raise EnterFondo
End
Public Sub tbtnReseteo_Enter()
Raise EnterReseteo
End
'by Postapase 26 enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control fbcolor (foreground, background color)
Event CambioTrazo
Event CambioFondo
Event EnterTrazo
Event EnterFondo
Event Reseteo
Event EnterReseteo
Public Sub cbtnTrazo_Change()
Raise CambioTrazo
End
Public Sub cbtnFondo_Change()
Raise CambioFondo
End
Public Sub tbtnReseteo_Click()
Raise Reseteo
End
Public Sub cbtnTrazo_Enter()
Raise EnterTrazo
End
Public Sub cbtnFondo_Enter()
Raise EnterFondo
End
Public Sub tbtnReseteo_Enter()
Raise EnterReseteo
End
Clase fbcolor
' gambas class file
'by Postapase 26 enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control fbcolor (foreground y background color)
Export
Inherits UserControl
Public Const _Properties As String = "*,Trazo{Color},Fondo{Color},TrazoPredeterminado{Color},FondoPredeterminado{Color}"
Public Const _DefaultEvent As String = "Modificacion"
Public Const _DefaultSize As String = "18,4"
Public Const _Group As String = "Chooser"
Event Reseteo
Event Modificacion
Property Trazo As Integer
Property Fondo As Integer
Property TrazoPredeterminado As Integer
Property FondoPredeterminado As Integer
Private $ffbcolor As Ffbcolor
Private $Trazo As Integer
Private $Fondo As Integer
Private $TrazoPredeterminado As Integer
Private $FondoPredeterminado As Integer
Public Sub _new()
$ffbcolor = New Ffbcolor(Me) As "Ev"
Me.Proxy = $ffbcolor
Reinicio()
End
Public Sub Ev_CambioTrazo()
$Trazo = $ffbcolor.cbtnTrazo.Value
Raise Modificacion
End
Public Sub Ev_CambioFondo()
$Fondo = $ffbcolor.cbtnFondo.Value
Raise Modificacion
End
Public Sub Ev_Reseteo()
Reinicio()
Raise Reseteo
End
Public Sub Reinicio()
$Fondo = $FondoPredeterminado
$Trazo = $TrazoPredeterminado
$ffbcolor.cbtnFondo.Value = $Fondo
$ffbcolor.cbtnTrazo.Value = $Trazo
End
Public Sub Ev_EnterTrazo()
$ffbcolor.cbtnTrazo.Tooltip = "Color de Trazo (clic para cambiar)"
End
Public Sub Ev_EnterFondo()
$ffbcolor.cbtnFondo.Tooltip = "Color de Fondo (clic para cambiar)"
End
Public Sub Ev_EnterReseteo()
$ffbcolor.tbtnReseteo.Tooltip = "Poner colores predeterminados"
End
Private Function Trazo_Read() As Integer
Return $Trazo
End
Private Sub Trazo_Write(Value As Integer)
$Trazo = Value
$ffbcolor.cbtnTrazo.Value = $Trazo
Raise Modificacion
End
Private Function Fondo_Read() As Integer
Return $Fondo
End
Private Sub Fondo_Write(Value As Integer)
$Fondo = Value
$ffbcolor.cbtnFondo.Value = $Fondo
Raise Modificacion
End
Private Function TrazoPredeterminado_Read() As Integer
Return $TrazoPredeterminado
End
Private Sub TrazoPredeterminado_Write(Value As Integer)
$TrazoPredeterminado = Value
Raise Modificacion
End
Private Function FondoPredeterminado_Read() As Integer
Return $FondoPredeterminado
End
Private Sub FondoPredeterminado_Write(Value As Integer)
$FondoPredeterminado = Value
Raise Modificacion
End
'by Postapase 26 enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control fbcolor (foreground y background color)
Export
Inherits UserControl
Public Const _Properties As String = "*,Trazo{Color},Fondo{Color},TrazoPredeterminado{Color},FondoPredeterminado{Color}"
Public Const _DefaultEvent As String = "Modificacion"
Public Const _DefaultSize As String = "18,4"
Public Const _Group As String = "Chooser"
Event Reseteo
Event Modificacion
Property Trazo As Integer
Property Fondo As Integer
Property TrazoPredeterminado As Integer
Property FondoPredeterminado As Integer
Private $ffbcolor As Ffbcolor
Private $Trazo As Integer
Private $Fondo As Integer
Private $TrazoPredeterminado As Integer
Private $FondoPredeterminado As Integer
Public Sub _new()
$ffbcolor = New Ffbcolor(Me) As "Ev"
Me.Proxy = $ffbcolor
Reinicio()
End
Public Sub Ev_CambioTrazo()
$Trazo = $ffbcolor.cbtnTrazo.Value
Raise Modificacion
End
Public Sub Ev_CambioFondo()
$Fondo = $ffbcolor.cbtnFondo.Value
Raise Modificacion
End
Public Sub Ev_Reseteo()
Reinicio()
Raise Reseteo
End
Public Sub Reinicio()
$Fondo = $FondoPredeterminado
$Trazo = $TrazoPredeterminado
$ffbcolor.cbtnFondo.Value = $Fondo
$ffbcolor.cbtnTrazo.Value = $Trazo
End
Public Sub Ev_EnterTrazo()
$ffbcolor.cbtnTrazo.Tooltip = "Color de Trazo (clic para cambiar)"
End
Public Sub Ev_EnterFondo()
$ffbcolor.cbtnFondo.Tooltip = "Color de Fondo (clic para cambiar)"
End
Public Sub Ev_EnterReseteo()
$ffbcolor.tbtnReseteo.Tooltip = "Poner colores predeterminados"
End
Private Function Trazo_Read() As Integer
Return $Trazo
End
Private Sub Trazo_Write(Value As Integer)
$Trazo = Value
$ffbcolor.cbtnTrazo.Value = $Trazo
Raise Modificacion
End
Private Function Fondo_Read() As Integer
Return $Fondo
End
Private Sub Fondo_Write(Value As Integer)
$Fondo = Value
$ffbcolor.cbtnFondo.Value = $Fondo
Raise Modificacion
End
Private Function TrazoPredeterminado_Read() As Integer
Return $TrazoPredeterminado
End
Private Sub TrazoPredeterminado_Write(Value As Integer)
$TrazoPredeterminado = Value
Raise Modificacion
End
Private Function FondoPredeterminado_Read() As Integer
Return $FondoPredeterminado
End
Private Sub FondoPredeterminado_Write(Value As Integer)
$FondoPredeterminado = Value
Raise Modificacion
End
Dropbox fbcolor-0.1.1.tar.gz
jueves, 19 de enero de 2017
Control FontName by postapase
Control pensado para seleccionar tipo de fuente rapidamente y comodamente, con la opción de poner fuente predeterminada con un solo clic.
parte gráfica del control (ffontname) formulario
' gambas class file
'by postapase 18 de enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control FontName
Event Reset
Event Seleccion
Event Enter
Public Sub Form_Open()
End
Public Sub btnFontDefault_Click()
Raise Reset
End
Public Sub cbxNombreFuentes_Click()
Raise Seleccion
End
Public Sub btnFontDefault_Enter()
Raise Enter
End
'by postapase 18 de enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control FontName
Event Reset
Event Seleccion
Event Enter
Public Sub Form_Open()
End
Public Sub btnFontDefault_Click()
Raise Reset
End
Public Sub cbxNombreFuentes_Click()
Raise Seleccion
End
Public Sub btnFontDefault_Enter()
Raise Enter
End
clase fontname
' gambas class file
'by postapase 18 de enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control FontName
Export
Inherits UserControl
Public Const _Properties As String = "*,Predeterminada,Seleccionada,Index"
Public Const _DefaultEvent As String = "Seleccion"
Public Const _DefaultSize As String = "32,4"
Public Const _Group As String = "Chooser"
Event Seleccion
Event Reseteo ''Selecciona la fuente predeterminada de la aplicación
Property Predeterminada As String
Property Seleccionada As String
Property Index As Integer
Private $xfontname As Ffontname
Private $Predeterminada As String
Private $Seleccionada As String
Private $Index As Integer
Private $ListaFuentes As New String[]
Public Sub _new()
$xfontname = New Ffontname(Me) As "Ev"
$Predeterminada = Application.Font.Name
$Seleccionada = $Predeterminada
Me.Proxy = $xfontname.cbxNombreFuentes
ActualizarFuentes()
End
Public Sub Ev_Reset()
Reinicio()
Raise Reseteo
End
Public Sub Ev_Seleccion()
$Seleccionada = $xfontname.cbxNombreFuentes.Current.Text
$Index = $xfontname.cbxNombreFuentes.Index
Raise Seleccion
End
Public Sub EV_Enter()
$xfontname.btnFontDefault.Tooltip = "Seleccionar fuente predeterminada [ " & $Predeterminada & " ]"
End
Public Sub ActualizarFuentes()
Dim NombreFuente As String
For Each NombreFuente In Fonts
$ListaFuentes.Add(NombreFuente)
Next
$xfontname.cbxNombreFuentes.List = $ListaFuentes
$xfontname.cbxNombreFuentes.Add($Predeterminada, 0)
End
Private Function Predeterminada_Read() As String
Return $Predeterminada
End
Private Sub Predeterminada_Write(Value As String)
$Predeterminada = Value
End
Private Function Seleccionada_Read() As String
Return $Seleccionada
End
Private Sub Seleccionada_Write(Value As String)
$Seleccionada = Value
End
Private Function Index_Read() As Integer
Return $Index
End
Private Sub Index_Write(Value As Integer)
$Index = Value
$xfontname.cbxNombreFuentes.Index = $Index
End
Public Sub Reinicio()
$xfontname.cbxNombreFuentes.Index = 0
$Index = 0
En
'by postapase 18 de enero 2017
'http://novatocodegambas.blogspot.com.uy/
'control FontName
Export
Inherits UserControl
Public Const _Properties As String = "*,Predeterminada,Seleccionada,Index"
Public Const _DefaultEvent As String = "Seleccion"
Public Const _DefaultSize As String = "32,4"
Public Const _Group As String = "Chooser"
Event Seleccion
Event Reseteo ''Selecciona la fuente predeterminada de la aplicación
Property Predeterminada As String
Property Seleccionada As String
Property Index As Integer
Private $xfontname As Ffontname
Private $Predeterminada As String
Private $Seleccionada As String
Private $Index As Integer
Private $ListaFuentes As New String[]
Public Sub _new()
$xfontname = New Ffontname(Me) As "Ev"
$Predeterminada = Application.Font.Name
$Seleccionada = $Predeterminada
Me.Proxy = $xfontname.cbxNombreFuentes
ActualizarFuentes()
End
Public Sub Ev_Reset()
Reinicio()
Raise Reseteo
End
Public Sub Ev_Seleccion()
$Seleccionada = $xfontname.cbxNombreFuentes.Current.Text
$Index = $xfontname.cbxNombreFuentes.Index
Raise Seleccion
End
Public Sub EV_Enter()
$xfontname.btnFontDefault.Tooltip = "Seleccionar fuente predeterminada [ " & $Predeterminada & " ]"
End
Public Sub ActualizarFuentes()
Dim NombreFuente As String
For Each NombreFuente In Fonts
$ListaFuentes.Add(NombreFuente)
Next
$xfontname.cbxNombreFuentes.List = $ListaFuentes
$xfontname.cbxNombreFuentes.Add($Predeterminada, 0)
End
Private Function Predeterminada_Read() As String
Return $Predeterminada
End
Private Sub Predeterminada_Write(Value As String)
$Predeterminada = Value
End
Private Function Seleccionada_Read() As String
Return $Seleccionada
End
Private Sub Seleccionada_Write(Value As String)
$Seleccionada = Value
End
Private Function Index_Read() As Integer
Return $Index
End
Private Sub Index_Write(Value As Integer)
$Index = Value
$xfontname.cbxNombreFuentes.Index = $Index
End
Public Sub Reinicio()
$xfontname.cbxNombreFuentes.Index = 0
$Index = 0
En
Saludos y espero sus opiniones.
Necesario estar registrado en https://www.gambas-es.org/
Descargar
Dropbox: fontname-0.1.2.tar.gz
Etiquetas:
_DefaultEvent,
_DefaultSize,
_Group,
_Properties,
Clase,
Const,
Control,
Ejemplo,
Eventos,
Export,
For Each...Next,
Inherits,
Me.Proxy,
New,
Property
miércoles, 18 de enero de 2017
FontName control supersimplificado
Este pequeño control surge de tener una lista completa de todos los nombres de fuentes disponibles comodamente en un combobox.
Pero a veces, podríamos necesitar ese combobox en muchos formularios.
Entonces es ahí donde hacer una clase tiene sentido,su poder o ventaja (ahorro de código) pues sera una tarea repetitiva.
Inherits ComboBox
Public Const _DefaultSize As String = "32,4"
Public Const _Group As String = "Chooser"
Private $ListaFuentes As New String[]
Public Sub _new()
Me.ReadOnly = True
Me.List = ObtenerFuentes()
End
Public Sub ObtenerFuentes() As String[]
Dim NombreFuente As String
For Each NombreFuente In Fonts
$ListaFuentes.Add(NombreFuente)
Next
Return $ListaFuentes
End
El nombre de la fuente seleccionada la obtenemos con:
FontName1.Current.Text
La lista de nombres de fuentes estan en la propiedad list de FontName:
FontName1.List
Descargar control
Etiquetas:
Clase,
Control,
Export,
For Each...Next,
Inherits
Suscribirse a:
Entradas (Atom)




