https://foro.gambas-es.org/viewtopic.php?f=4&t=6283&p=37621#p37621
-----------------------------------
v3ctor
Viernes, 14 Abril 2017, 16:33

Re: Añadiendo Nuevas Caracteristicas A Control Fbcolor!
-----------------------------------
bueno esto funciona

cree tres constantes publicas estáticas  vTodo, vTrazo,vFondo

que determinan en la propiedad 'Ver' de tipo byte que botones se ven

y un método que muestra u oculta según el estado de Ver llamado 'ActualizarVista'



[code linenumbers=false syntax=gambas]

' 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 = "*,Ver=0,Trazo{Color},Fondo{Color},TrazoPredeterminado{Color},FondoPredeterminado{Color},TrazoToolTip,FondoToolTip,ReseteoToolTip"
Public Const _DefaultEvent As String = "Modificacion"
Public Const _DefaultSize As String = "18,4"
Public Const _Group As String = "Chooser"

Static Public Const vTodo As Byte = 0  
Static Public Const vTrazo As Byte = 1
Static Public Const vFondo As Byte = 2

Event Reseteo
Event Modificacion

Property Trazo As Integer
Property Fondo As Integer
Property TrazoPredeterminado As Integer
Property FondoPredeterminado As Integer
Property TrazoToolTip As String
Property FondoToolTip As String
Property ReseteoToolTip As String
Property Ver As Byte

Private $ffbcolor As Ffbcolor
Private $Trazo As Integer
Private $Fondo As Integer
Private $TrazoPredeterminado As Integer
Private $FondoPredeterminado As Integer
Private $TrazoToolTip As String 
Private $FondoToolTip As String
Private $ReseteoToolTip As String
Private $Ver As Byte


Public Sub _new()

  $ffbcolor = New Ffbcolor(Me) As "Ev"
  Me.Proxy = $ffbcolor
  $TrazoToolTip = "Color de Trazo (clic para cambiar)"
  $FondoToolTip = "Color de Fondo (clic para cambiar)"
  $ReseteoToolTip = "Poner colores predeterminados"
  Reinicio()
  ActualizarVista()

End

Public Sub ActualizarVista()
  
  Select Case $Ver
    Case 0 ' todo
      $ffbcolor.cbtnFondo.Visible = True
      $ffbcolor.cbtnTrazo.Visible = True
    Case 1 'Solo trazo
      $ffbcolor.cbtnFondo.Visible = False
      $ffbcolor.cbtnTrazo.Visible = True
    Case 2 'solo fondo
      $ffbcolor.cbtnFondo.Visible = True
      $ffbcolor.cbtnTrazo.Visible = False
    Case Else
      $ffbcolor.cbtnFondo.Visible = True
      $ffbcolor.cbtnTrazo.Visible = True
  End Select
  
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 = $TrazoToolTip

End

Public Sub Ev_EnterFondo()

  $ffbcolor.cbtnFondo.Tooltip = $FondoToolTip

End

Public Sub Ev_EnterReseteo()

  $ffbcolor.tbtnReseteo.Tooltip = $ReseteoToolTip

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

Private Function TrazoToolTip_Read() As String

  Return $TrazoToolTip

End

Private Sub TrazoToolTip_Write(Value As String)

  $TrazoToolTip = Value

End

Private Function FondoToolTip_Read() As String

  Return $FondoToolTip

End

Private Sub FondoToolTip_Write(Value As String)

  $FondoToolTip = Value

End

Private Function ReseteoToolTip_Read() As String

  Return $ReseteoToolTip

End

Private Sub ReseteoToolTip_Write(Value As String)

  $ReseteoToolTip = Value

End


Private Function Ver_Read() As Byte

  Return $Ver

End

Private Sub Ver_Write(Value As Byte)

  $Ver = Value
  ActualizarVista()
  
End[/code]


