gambas-source-code/app/examples/Image/Lighttable/FStart.class
Benoît Minisini c6a9cd69c2 [EXAMPLES]
* NEW: Add examples again. I hope correctly this time.


git-svn-id: svn://localhost/gambas/trunk@6726 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-12-12 19:58:52 +00:00

92 lines
2 KiB
Text

' Gambas class file
aRecentDirs As New String[]
iNr As Integer
iLast As Integer
atxLabel As New Object[]
Public Sub Form_Open()
Dim i, pos, lastpos As Integer
Dim sShort, sPath As String
aRecentDirs.Resize(10)
atxLabel.Resize(10)
For i = 0 To 9
aRecentDirs[i] = Settings["Recent/" & i]
If aRecentDirs[i] = "" Then Break
pos = -1
Do While pos <> 0
lastpos = pos
pos = InStr(aRecentDirs[i], "/", pos + 1)
Loop
sShort = Right$(aRecentDirs[i], Len(aRecentDirs[i]) - lastpos)
sPath = Left$(aRecentDirs[i], Len(aRecentDirs[i]) - Len(sShort))
atxLabel[i] = New TextLabel(Me) As "lblRecent"
With atxLabel[i]
.X = 406
.Y = 49 + (i * 35)
.Width = 287
.Height = 35
.Border = 4
.Font.Grade = -1
.Padding = 1
.Tag = i
.Text = "<b>" & sShort & "</b><br>" & sPath
End With
Next
Me.Center
End
Public Sub btnOK_Click()
Dim i, j As Integer
For i = 0 To 8
If aRecentDirs[i] = DirChooser1.SelectedPath Then
For j = i To 8
aRecentDirs[j] = aRecentDirs[j + 1]
Next
Break
Endif
Next
For i = 9 To 1 Step -1
aRecentDirs[i] = aRecentDirs[i - 1]
Next
aRecentDirs[0] = DirChooser1.SelectedPath
For i = 0 To 9
Settings["Recent/" & i] = aRecentDirs[i]
Next
Message.Info(aRecentDirs[0] & " wird geöffnet.")
Me.Close
End
Public Sub btnCancel_Click()
Me.Close
End
Public Sub lblRecent_Enter()
iNr = Last.Tag
If atxLabel[iNr].Background = -1 Then
atxLabel[iNr].Background = Color.LightBackground
Endif
End
Public Sub lblRecent_Leave()
If atxLabel[iNr].Background = Color.LightBackground Then
atxLabel[iNr].Background = -1
Endif
End
Public Sub lblRecent_MouseDown()
atxLabel[iLast].Background = -1
atxLabel[iLast].Foreground = -1
atxLabel[iNr].Background = Color.SelectedBackground
atxLabel[iNr].Foreground = Color.SelectedForeground
iLast = iNr
DirChooser1.SelectedPath = aRecentDirs[iNr]
End