File: FMain.class

package info (click to toggle)
gambas3 3.20.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 77,208 kB
  • sloc: ansic: 197,232; cpp: 124,273; sh: 18,999; javascript: 7,761; sql: 5,399; makefile: 2,358; perl: 1,397; xml: 490; python: 335
file content (83 lines) | stat: -rw-r--r-- 1,806 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
' Gambas class file

Private aButtons[13] As Button  ' Dim the array of controls

Public Sub Form_Open()
  Dim i As Integer

  btnClose.Tooltip = ("Quit")
  Me.Center
  For i = 1 To 12
    aButtons[i] = New Button(Me) As "Buttongroup"    ' Create a new button in the array and store it in an action group
    With aButtons[i]
      .X = (i - Int((i - 1) / 3) * 3) * 60 - 30
      .Y = Int((i - 1) / 3) * 60 + 170
      .Width = 42
      .Height = 42
      .Font.Grade = 5
      If i = 10 Then
        .Text = "*"
      Else If i = 11 Then
        .Text = "0"
      Else If i = 12 Then
        .Text = "#"
      Else
        .Text = i
      Endif
    End With
  Next
  
End


Public Sub Buttongroup_Click() ' This is an event of the action group. This event is fired if any of the buttons is clicked
  ' You see a list of available events if you type "Buttongroup_"
'   Dim w As Integer
  
  tbNumber.Text = tbNumber.Text & Last.Text  ' find out with LAST which button was clicked and hand its text over to TextBox
  
  ' w = Last.Width  ' this would return the width of the last button
  ' Print w
End

Public Sub Buttongroup_Menu()   ' Another event of the action group: Right-click on any of the buttons
  
  Message.Info(Subst(("You have clicked the button &1"), Last.Text))
  
End

Public Sub btnClose_Click()
  
  If tbNumber.Text = "" Then
    Me.Close
  Else
    tbNumber.Text = ""
  Endif

End

Public Sub Form_KeyPress()

  If Key.code = Key.Esc Then Me.Close

End

Public Sub tbNumber_Change()

  If tbNumber.Text = "" Then
    btnClose.Tooltip = ("Quit")
  Else
    btnClose.Tooltip = ("Clear")
  Endif

End

Public Sub btnDial_Click()
  
  If tbNumber.Text = "" Then
    Message.Warning(("There is no number I could dial."))
  Else
    Message.Info(("Dialing ") & tbNumber.Text)
  Endif
  
End