I want to make my own file explorer that behaves as close to the normal (like in regular programs) windows file explorer.
Any advice or code would be very much apreciated!
Any advice or code would be very much apreciated!
Type dir_entry Field name$ Field is_dir End Type Graphics(800, 600) SetBuffer(BackBuffer()) path$ = browse("c:") Cls : Locate 0, 0 Print "The user selected " + path$ Flip WaitKey End Function browse$(dir$) init_dir_entries(dir$) While Not KeyHit(1) Cls : Locate 0, 0 Text 0, 0, "CURRENT DIR: " + dir$ count = 0 For de.dir_entry = Each dir_entry If de\is_dir Then Text 0, 20 + count*14, "<"+de\name+">" Else Text 0, 20 + count*14, de\name EndIf count = count + 1 If count > 50 Then Exit Next If MouseHit(1) Then line_hit = Floor((MouseY()-20) / 14) de_hit.dir_entry = find_dir_entry_by_pos(line_hit) If de_hit <> Null Then If de_hit\is_dir Then dir$ = dir$ + "" + de_hit\name init_dir_entries(dir$) Else Return dir$ + "" + de_hit\name EndIf EndIf EndIf Flip Wend End Function Function init_dir_entries(dir$) ; destroy old entries For de.dir_entry = Each dir_entry Delete de Next ; create new entries current_dir$ = dir$ dh = ReadDir(dir$) While True this_file$ = NextFile$(dh) If this_file$ = "" Then Exit de.dir_entry = New dir_entry de\name = this_file$ If FileType(current_dir$ + "" + de\name) = 2 Then de\is_dir = 1 EndIf Wend End Function Function find_dir_entry_by_pos.dir_entry(pos) de.dir_entry = First dir_entry For i = 1 To pos de = After de Next Return de End Function