mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 11:59:34 +00:00
Refined behavior of Open dialog. Fixes #38.
This commit is contained in:
parent
d6665d39b3
commit
f111c885c4
1 changed files with 37 additions and 26 deletions
|
@ -530,7 +530,7 @@ SUB __UI_Click (id AS LONG)
|
||||||
'Refresh the file list control's contents
|
'Refresh the file list control's contents
|
||||||
DIM TotalFiles%
|
DIM TotalFiles%
|
||||||
IF CurrentPath$ = "" THEN CurrentPath$ = _STARTDIR$
|
IF CurrentPath$ = "" THEN CurrentPath$ = _STARTDIR$
|
||||||
Text(FileList) = idezfilelist$(CurrentPath$, 0, TotalFiles%)
|
Text(FileList) = idezfilelist$(CurrentPath$, Control(ShowOnlyFrmbinFilesCB).Value + 1, TotalFiles%)
|
||||||
Control(FileList).Max = TotalFiles%
|
Control(FileList).Max = TotalFiles%
|
||||||
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
||||||
|
|
||||||
|
@ -556,51 +556,62 @@ SUB __UI_Click (id AS LONG)
|
||||||
__UI_ForceRedraw = True
|
__UI_ForceRedraw = True
|
||||||
CASE "OPENBT"
|
CASE "OPENBT"
|
||||||
OpenFile:
|
OpenFile:
|
||||||
DIM FileToOpen$, FreeFileNum AS INTEGER
|
IF OpenDialogOpen THEN
|
||||||
FileToOpen$ = CurrentPath$ + PathSep$ + Text(FileNameTextBox)
|
DIM FileToOpen$, FreeFileNum AS INTEGER
|
||||||
IF _FILEEXISTS(FileToOpen$) THEN
|
FileToOpen$ = CurrentPath$ + PathSep$ + Text(FileNameTextBox)
|
||||||
FreeFileNum = FREEFILE
|
IF _FILEEXISTS(FileToOpen$) THEN
|
||||||
OPEN "InForm/UiEditor.dat" FOR BINARY AS #FreeFileNum
|
FreeFileNum = FREEFILE
|
||||||
'Send the data first, then the signal
|
OPEN "InForm/UiEditor.dat" FOR BINARY AS #FreeFileNum
|
||||||
b$ = MKI$(LEN(FileToOpen$)) + FileToOpen$
|
'Send the data first, then the signal
|
||||||
PUT #FreeFileNum, OffsetPropertyValue, b$
|
b$ = MKI$(LEN(FileToOpen$)) + FileToOpen$
|
||||||
CLOSE #FreeFileNum
|
PUT #FreeFileNum, OffsetPropertyValue, b$
|
||||||
|
CLOSE #FreeFileNum
|
||||||
|
|
||||||
SendSignal -4
|
SendSignal -4
|
||||||
|
|
||||||
Control(DialogBG).Left = -600: Control(DialogBG).Top = -600
|
Control(DialogBG).Left = -600: Control(DialogBG).Top = -600
|
||||||
Control(OpenFrame).Left = -600: Control(OpenFrame).Top = -600
|
Control(OpenFrame).Left = -600: Control(OpenFrame).Top = -600
|
||||||
OpenDialogOpen = False
|
Control(FileList).FirstVisibleLine = 1
|
||||||
__UI_Focus = 0
|
Control(FileList).InputViewStart = 1
|
||||||
ELSE
|
Control(FileList).Value = 0
|
||||||
Answer = MessageBox("File not found.", "", MsgBox_OkOnly + MsgBox_Critical)
|
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
||||||
|
Control(DirList).FirstVisibleLine = 1
|
||||||
|
Control(DirList).InputViewStart = 1
|
||||||
|
Control(DirList).Value = 0
|
||||||
|
Control(DirList).LastVisibleItem = 0 'Reset it so it's recalculated
|
||||||
|
OpenDialogOpen = False
|
||||||
|
__UI_Focus = 0
|
||||||
|
ELSE
|
||||||
|
Answer = MessageBox("File not found.", "", MsgBox_OkOnly + MsgBox_Critical)
|
||||||
|
Control(FileList).Value = 0
|
||||||
|
END IF
|
||||||
END IF
|
END IF
|
||||||
CASE "FILELIST"
|
CASE "FILELIST"
|
||||||
Text(FileNameTextBox) = GetItem(FileList, Control(FileList).Value)
|
Text(FileNameTextBox) = GetItem(FileList, Control(FileList).Value)
|
||||||
|
Control(DirList).Value = 0
|
||||||
IF Control(FileList).HoveringVScrollbarButton = 0 AND LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click
|
IF Control(FileList).HoveringVScrollbarButton = 0 AND LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click
|
||||||
GOTO OpenFile
|
GOTO OpenFile
|
||||||
END IF
|
END IF
|
||||||
CASE "DIRLIST"
|
CASE "DIRLIST"
|
||||||
Text(FileNameTextBox) = GetItem(DirList, Control(DirList).Value)
|
Text(FileNameTextBox) = GetItem(DirList, Control(DirList).Value)
|
||||||
|
Control(FileList).Value = 0
|
||||||
IF LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click
|
IF LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click
|
||||||
CurrentPath$ = idezchangepath(CurrentPath$, Text(FileNameTextBox))
|
CurrentPath$ = idezchangepath(CurrentPath$, Text(FileNameTextBox))
|
||||||
Caption(PathLB) = "Path: " + CurrentPath$
|
Caption(PathLB) = "Path: " + CurrentPath$
|
||||||
Text(DirList) = idezpathlist$(CurrentPath$, TotalFiles%)
|
Text(DirList) = idezpathlist$(CurrentPath$, TotalFiles%)
|
||||||
Control(DirList).Max = TotalFiles%
|
Control(DirList).Max = TotalFiles%
|
||||||
Control(DirList).LastVisibleItem = 0 'Reset it so it's recalculated
|
Control(DirList).LastVisibleItem = 0 'Reset it so it's recalculated
|
||||||
|
Control(DirList).Value = 0
|
||||||
GOTO ReloadList
|
GOTO ReloadList
|
||||||
END IF
|
END IF
|
||||||
CASE "SHOWONLYFRMBINFILESCB"
|
CASE "SHOWONLYFRMBINFILESCB"
|
||||||
ReloadList:
|
ReloadList:
|
||||||
IF Control(ShowOnlyFrmbinFilesCB).Value THEN
|
Text(FileList) = idezfilelist$(CurrentPath$, Control(ShowOnlyFrmbinFilesCB).Value + 1, TotalFiles%)
|
||||||
Text(FileList) = idezfilelist$(CurrentPath$, 0, TotalFiles%)
|
Control(FileList).Max = TotalFiles%
|
||||||
Control(FileList).Max = TotalFiles%
|
Control(FileList).FirstVisibleLine = 1
|
||||||
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
Control(FileList).InputViewStart = 1
|
||||||
ELSE
|
Control(FileList).Value = 0
|
||||||
Text(FileList) = idezfilelist$(CurrentPath$, 1, TotalFiles%)
|
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
||||||
Control(FileList).Max = TotalFiles%
|
|
||||||
Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated
|
|
||||||
END IF
|
|
||||||
CASE "EDITMENUUNDO"
|
CASE "EDITMENUUNDO"
|
||||||
b$ = MKI$(0)
|
b$ = MKI$(0)
|
||||||
SendData b$, 214
|
SendData b$, 214
|
||||||
|
|
Loading…
Reference in a new issue