locked
File and Folder Navigation RRS feed

  • General discussion

  • ' ************************************************************
    '**                   FILE & FOLDER NAVIGATOR V121                         **
    '**                                                                                                              **
    '**  by Manlio Lucchese 2015                                                              **
    '************************************************************

    Controls.ButtonClicked = control_event
    GraphicsWindow.KeyDown = carry
    '
    prog_dir = Program.Directory
    ico_image2 = ImageList.LoadImage (prog_dir + "\file&folder_img.png")
    '
    ask_file_path_actual = "" '  Variabile di ritorno percorso
    ask_file_doc = ""         '  Variabile di ritorno File
    ask_file_level_dir = 1
    '
    ask_file_Point_X = 0
    ask_file_Point_Y = 0
    '
    VISUALIZZA_FIN()
    '
    LIST()
    '
    Sub control_event
      '
      If Controls.LastClickedButton = askFile_Dir_up Then
        If ask_file_level_dir = 1 Then
          goto ask_file_esci1
        EndIf
        ask_file_level_dir = ask_file_level_dir -1
        ask_file_path_actual = Stack.PopValue ("ask_file_percorso_prec")
        ask_file_esci1:
        LIST()
      EndIf
    EndSub
    '
    '
    '**********************************  VISUALIZZAZIONE LISTE  ******************************************************
    '
    Sub LIST
      '
      Controls.SetTextBoxText (ask_file_C_percorso,ask_file_path_actual)
      '
      ask_file_lista_subdirectory()
      Controls.SetTextBoxText (ask_file_c_subdirectory,ask_file_list)
      '
      ask_file_lista_files()
      Controls.SetTextBoxText (ask_file_c_files,ask_file_list)
      '
      Controls.SetTextBoxText (askfile_dir,"")
      Controls.SetTextBoxText (askfile_drive,"")
    EndSub
    '
    Sub ask_file_lista_subdirectory
      ask_file_list = File.GetDirectories (ask_file_path_actual)
      ask_file_testo_corretto()  
    EndSub
    '
    Sub ask_file_lista_files
      ask_file_list = File.GetFiles (ask_file_path_actual)
      ask_file_testo_corretto()
    EndSub
    '*****************************************************************************************************************
    '
    '
    '*****************************************   TESTO CORRETTO ****************************************************
    Sub ask_file_testo_corretto
      ask_file_k = 1
      ask_file_left = ""
      ask_file_right = ""
      lun_ask_file_list = Text.GetLength (ask_file_list)
      For ask_file_a = 1 To lun_ask_file_list
        If Text.GetSubText (ask_file_list,ask_file_a,2) = "\\" then
          ask_file_left = Text.GetSubText (ask_file_list,ask_file_k,ask_file_a-1)
          ask_file_right = Text.GetSubTextToEnd (ask_file_list,ask_file_a+2)
          ask_file_list = ask_file_left + "\" + ask_file_right
        EndIf
      EndFor
      ask_file_CR = Text.GetCharacter (13) + Text.GetCharacter (10)
      ask_file_k = 1
      ask_file_left = ""
      ask_file_right = ""
      For ask_file_a = 1 To lun_ask_file_list
        If Text.GetSubText (ask_file_list,ask_file_a,1) = ";" then
          ask_file_left = Text.GetSubText (ask_file_list,ask_file_k,ask_file_a-1)
          ask_file_right = Text.GetSubTextToEnd (ask_file_list,ask_file_a+1)
          ask_file_list = ask_file_left + ask_file_CR + ask_file_right
        EndIf
      EndFor
      '
    EndSub
    '***************************************************************************************************
    '
    '
    ' **************************************** CARRY ******************************************************
    Sub carry
      c = GraphicsWindow.LastKey
      If c = "Return" Then
        txt_box_last = Controls.LastTypedTextBox
      EndIf
      carry_event()
    EndSub
    '
    Sub carry_event
      If txt_box_last = askfile_drive Then
        ask_file_path_actual = Text.GetSubText(Controls.GetTextBoxText (askFile_drive),1,1) +":\"
        txt_box_last = ""
        LIST()
      EndIf
      '
      If txt_box_last = askfile_dir Then
        ask_file_level_dir = ask_file_level_dir + 1
        Stack.PushValue ("ask_file_percorso_prec" , ask_file_path_actual)
        If Text.EndsWith (ask_file_path_actual , "\") = "True" then
          ask_file_path_actual = ask_file_path_actual + Controls.GetTextBoxText(askFile_Dir)
          Goto ask_file_esci2
        Endif
        ask_file_path_actual = ask_file_path_actual + "\" + Controls.GetTextBoxText(askFile_Dir)
        ask_file_esci2:
        txt_box_last = ""
        LIST()
      EndIf
      '
    EndSub

    '****************************************************************************************************
    '
    '
    ' ********************************** IMPOSTA VISUALIZZAZIONE  FINESTRA ************************
    '
    Sub VISUALIZZA_FIN
      '
      GraphicsWindow.Title = "FILE & FOLDER NAVIGATOR"
      GraphicsWindow.Width = 800
      GraphicsWindow.Height = 400
      GraphicsWindow.BackgroundColor = "lemonchiffon"
      GraphicsWindow.FontSize = 14
      GraphicsWindow.FontName = "courier new"
      GraphicsWindow.BrushColor = "blue"
      '
      askFile_drive = Controls.AddTextBox (ask_file_Point_X + 66,ask_file_Point_Y + 80)
      GraphicsWindow.DrawText ( ask_file_Point_X + 5,ask_file_Point_Y + 85,"Drive >")
      '
      askFile_Dir = Controls.AddTextBox (ask_file_Point_X + 330, ask_file_Point_Y + 80)
      GraphicsWindow.DrawText ( ask_file_Point_X + 235,ask_file_Point_Y + 85,"Directory >")
      '
      GraphicsWindow.BrushColor = "black"
      askFile_Dir_up = Controls.AddButton("Dir UP ^",ask_file_Point_X + 510,ask_file_Point_Y + 80)
      GraphicsWindow.BrushColor = "blue"
      '
      ask_file_C_percorso = Controls.AddMultiLineTextBox (ask_file_Point_X + 5,ask_file_Point_Y + 25)
      Controls.SetSize (ask_file_C_percorso, 590,50)
      Controls.SetTextBoxText (ask_file_C_percorso,ask_file_path_actual)
      '
      ask_file_c_subdirectory = Controls.AddMultiLineTextBox (ask_file_Point_X + 5,ask_file_Point_Y + 140)
      Controls.SetSize (ask_file_c_subdirectory,390,250)
      ask_file_lista_subdirectory()
      Controls.SetTextBoxText (ask_file_c_subdirectory,ask_file_list)
      '
      ask_file_c_files = Controls.AddMultiLineTextBox (ask_file_Point_X + 400 ,ask_file_Point_Y + 140)
      Controls.SetSize (ask_file_c_files,395,250)
      ask_file_lista_files()
      Controls.SetTextBoxText (ask_file_c_files,ask_file_list)
      '
      GraphicsWindow.DrawText (ask_file_Point_X + 6,ask_file_Point_Y + 6,"Path:")
      GraphicsWindow.DrawText (ask_file_Point_X + 6, ask_file_Point_Y + 125,"        Directories:                     Files:")
      '
      GraphicsWindow.DrawText (603,22,"M.Lucchese V1.2.1(2015)")
      ic = Shapes.AddImage (ico_image2)
      Shapes.Move (ic, 650,35)
      '
    EndSub
    Monday, February 23, 2015 9:26 AM

All replies

  • Nice comprehensive program and well structured.


    Friday, February 27, 2015 7:57 PM