-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmDriveSelect.class
94 lines (73 loc) · 2.23 KB
/
frmDriveSelect.class
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
84
85
86
87
88
89
90
91
92
93
' Gambas class file
' ### DRIVES WINDOW ###
PRIVATE MaxDisks AS Long
PRIVATE selectedDisk AS String
PRIVATE selectedDiskIndex AS Long
PUBLIC SUB Form_Open()
DIM arrTemp AS NEW String[]
DIM n AS Byte
DIM m AS Byte
'Center form on screen:
ME.Center
ME.Caption = "Install Drive Selection"
MaxDisks = Global.DiskInfo.Count
'Setup gridDisk:
gridDisk.Columns.Count = 4
'gridDisk.Rows.Count = MaxDisks
gridDisk.Rows.Count = 32
gridDisk.Columns[0].Width = 0.4 * gridDisk.ClientWidth
gridDisk.Columns[1].Width = 0.25 * gridDisk.ClientWidth
gridDisk.Columns[2].Width = 0.2 * gridDisk.ClientWidth
gridDisk.Columns[3].Width = 0.15 * gridDisk.ClientWidth
'Center gridDisk titles alignment:
FOR n = 0 TO gridDisk.Columns.Count - 1
gridDisk[0, n].Alignment = Align.Center
NEXT
'Setup gridDisk titles:
gridDisk[0, 0].Text = "Drive"
gridDisk[0, 1].Text = "Size"
gridDisk[0, 2].Text = "Units"
gridDisk[0, 3].Text = "Sel."
'Set gridDisk cell alignment; left for text, right for numbers:
FOR m = 1 TO MaxDisks
gridDisk[m, 0].Alignment = Align.Left
gridDisk.Rows[m].Height = 20
gridDisk[m, 0].Text = Global.DiskInfo[m - 1].Device
gridDisk[m, 1].Alignment = Align.Right
gridDisk[m, 1].Text = Global.DiskInfo[m - 1].Bytes
arrTemp = Split(Functions.AutoUnits(Global.DiskInfo[m - 1].Bytes), " ", "", TRUE)
gridDisk[m, 1].Text = arrTemp[0]
gridDisk[m, 2].Alignment = Align.Left
gridDisk[m, 2].Text = arrTemp[1]
gridDisk[m, 3].Alignment = Align.Center
NEXT
END
PUBLIC SUB gridDisk_Click()
DIM arrTemp AS NEW String[]
DIM n AS Long
DIM m AS Long
IF gridDisk.Row = 0 OR gridDisk[gridDisk.Row, 2].Text = "" THEN
ELSE
FOR n = 1 TO gridDisk.Rows.Count - 1
gridDisk[n, 3].Text = ""
NEXT
gridDisk[gridDisk.Row, 3].Text = "+++"
selectedDisk = gridDisk[gridDisk.Row, 0].Text
selectedDiskIndex = gridDisk.Row
ENDIF
END
PUBLIC SUB btnOK_Click()
IF selectedDisk <> "" THEN
Global.installDrive = selectedDisk
Global.instDriveIndex = selectedDiskIndex
IF Global.DebugMode = TRUE THEN message.Info(Global.installDrive)
Global.frmExitStatus = "ok"
ME.Close(TRUE)
ELSE
Message.Info("No drive selected, please select one by clicking in the grid.")
ENDIF
END
PUBLIC SUB btnCancel_Click()
Global.frmExitStatus = "canceled"
ME.Close()
END