4aefbacb48
* BUG: In the "Requires" tab of the project property dialog, requirements are not incorrectly converted to lower case anymore. [COMPILER] * BUG: Fix symbol tables that sometimes didn't work correctly when storing symbols having non-ASCII characters. [GB.FORM] * BUG: ButtonBox.Length property now returns the length of the ButtonBox text. That fixes the crash in the ColorChooser control. * BUG: Balloon corners are correctly drawn again. * NEW: Some cosmetic changes in the ColorChooser control. [GB.IMAGE.IMLIB] * BUG: Images now always have an alpha channel. git-svn-id: svn://localhost/gambas/trunk@2313 867c0c6c-44f3-4631-809d-bfa615b0a4ec
134 lines
2.2 KiB
Text
134 lines
2.2 KiB
Text
' Gambas class file
|
|
|
|
Export
|
|
|
|
Inherits UserControl
|
|
|
|
Public Const _Properties As String = "*,Text,Picture,ReadOnly"
|
|
Public Const _DefaultEvent As String = "Click"
|
|
|
|
Event Click
|
|
Event Change
|
|
|
|
Property Picture As Picture
|
|
Property Text As String
|
|
Property Read Length As Integer
|
|
Property ReadOnly As Boolean
|
|
|
|
Private $hPanel As Panel
|
|
Private $hBackground As TextBox
|
|
Private $hTextBox As TextBox
|
|
Private $hButton As Button
|
|
Private $hObserver As Observer
|
|
|
|
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
|
|
|
|
$hTextBox = New TextBox($hPanel)
|
|
$hTextBox.Expand = True
|
|
$hTextBox.Border = False
|
|
Object.Attach($hTextBox, Object.Parent(Me), sEventName)
|
|
|
|
$hButton = New Button($hPanel) As "Button"
|
|
$hButton.W = Desktop.Scale * 4
|
|
$hButton.Picture = Picture["img/select.png"]
|
|
|
|
$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 Picture_Read() As Picture
|
|
|
|
Return $hButton.Picture
|
|
|
|
End
|
|
|
|
Private Sub Picture_Write(Value As Picture)
|
|
|
|
If Not Value Then Value = Picture["img/select.png"]
|
|
$hButton.Picture = Value
|
|
|
|
End
|
|
|
|
Private Function Text_Read() As String
|
|
|
|
Return $hTextBox.Text
|
|
|
|
End
|
|
|
|
Private Sub Text_Write(Value As String)
|
|
|
|
$hTextBox.Text = Value
|
|
|
|
End
|
|
|
|
Public Sub Button_Click()
|
|
|
|
$hTextBox.SetFocus
|
|
Raise Click
|
|
|
|
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
|