Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Form_Open()
- Dim a As Integer
- Dim m As Integer
- Dim f As File
- Dim s As String
- Dim l As Integer
- Dim n As Integer
- InitProgram() ' Инициализация
- For a = 0 To MaxGPIO
- If Exist(PathGPIO & "gpio" & LTrim(Str(a)) & "/value") Then
- Dirs.Add(PathGPIO & "gpio" & LTrim(Str(a)) & "/", a) ' Есть файл
- Else
- Dirs.Add("", a) ' Нет файла
- Endif
- Next
- TextGPIO.Resize(Dirs.Count)
- 'Китайский код
- ButtonGPIO.Add(ButtonGPIO1, 0)
- ButtonGPIO.Add(ButtonGPIO1, 1)
- ButtonGPIO.Add(ButtonGPIO2, 2)
- ButtonGPIO.Add(ButtonGPIO3, 3)
- ButtonGPIO.Add(ButtonGPIO4, 4)
- ButtonGPIO.Add(ButtonGPIO5, 5)
- ButtonGPIO.Add(ButtonGPIO6, 6)
- ButtonGPIO.Add(ButtonGPIO7, 7)
- ButtonGPIO.Add(ButtonGPIO8, 8)
- ButtonGPIO.Add(ButtonGPIO9, 9)
- ButtonGPIO.Add(ButtonGPIO10, 10)
- ButtonGPIO.Add(ButtonGPIO11, 11)
- ButtonGPIO.Add(ButtonGPIO12, 12)
- ButtonGPIO.Add(ButtonGPIO13, 13)
- ButtonGPIO.Add(ButtonGPIO14, 14)
- ButtonGPIO.Add(ButtonGPIO15, 15)
- ButtonGPIO.Add(ButtonGPIO16, 16)
- ButtonGPIO.Add(ButtonGPIO17, 17)
- ButtonGPIO.Add(ButtonGPIO18, 18)
- ButtonGPIO.Add(ButtonGPIO19, 19)
- ButtonGPIO.Add(ButtonGPIO20, 20)
- ButtonGPIO.Add(ButtonGPIO21, 21)
- ButtonGPIO.Add(ButtonGPIO22, 22)
- ButtonGPIO.Add(ButtonGPIO23, 23)
- ButtonGPIO.Add(ButtonGPIO24, 24)
- ButtonGPIO.Add(ButtonGPIO25, 25)
- ButtonGPIO.Add(ButtonGPIO26, 26)
- ButtonGPIO.Add(ButtonGPIO27, 27)
- m = ButtonGPIO.Max
- 'Боковые надписи
- f = Open ConfigListGPIO For Input
- While Not Eof(f)
- Line Input #f, s
- l = Len(s)
- If l > 2 Then
- For a = 1 To l
- If Mid(s, a, 1) = " " Then Break
- Next
- If a <> 1 And a <> l Then
- n = Val(Mid(s, 1, a - 1)) ' номер до пробела
- TextGPIO[n] = Mid(s, a + 1)
- Endif
- Endif
- Wend
- f.Close
- LabelGPIO.Resize(Dirs.Count) 'Подписи
- For a = 1 To m
- Object.Attach(ButtonGPIO[a], Me, "ButtonGPIO") 'привязка события
- If Dirs[a] = "" Then ButtonGPIO[a].Enabled = False 'Проверка доступности
- 'Подписи
- LabelGPIO[a] = New TextLabel(Me) ' Привязка события для обработки двойного клика
- Object.Attach(LabelGPIO[a], Me, "LabelGPIO")
- LabelGPIO[a].Tag = Str(a) ' Тэг
- LabelGPIO[a].Font.Bold = True
- LabelGPIO[a].Visible = True
- LabelGPIO[a].Width = ButtonGPIO[a].Width * 1.29
- LabelGPIO[a].Height = ButtonGPIO[a].Height
- LabelGPIO[a].Text = TextGPIO[a]
- Wait
- 'LabelGPIO[a].Border = Border.Plain
- If ButtonGPIO[a].X = ButtonGPIO1.X Then
- 'В первом ряду
- LabelGPIO[a].Alignment = Align.Left
- LabelGPIO[a].X = ButtonGPIO[a].X + ButtonGPIO[a].Width
- LabelGPIO[a].Y = ButtonGPIO[a].Y
- Else
- 'Во втором ряду
- LabelGPIO[a].Alignment = Align.Right
- LabelGPIO[a].X = ButtonGPIO[a].X - LabelGPIO[a].Width
- LabelGPIO[a].Y = ButtonGPIO[a].Y
- Endif
- '
- LabelGPIO[a].AutoResize = False
- LabelGPIO[a].Font.Bold = False
- If Len(LTrim(RTrim(TextGPIO[a]))) > 0 Then
- LabelGPIO[a].Visible = True
- Else
- LabelGPIO[a].Visible = False
- Endif
- Next
- 'Показывание путей к файлам
- ConfigFileLabel.Text = ConfigFile
- TextGPIOLabel.Text = ConfigListGPIO
- DirGPIOLabel.Text = PathGPIO
- LogFileLabel.Text = LogFile
- ' Проверка возможностей чтения логических едениц
- For a = 1 To ButtonGPIO.Max
- If ReadGPIO(a) = True Then
- ReverseLinkButton[a] = True 'Кнопка должна быть интерактивной
- Endif
- Next
- PrintInLog("started")
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement