Discussion of article "Graphical Interfaces VIII: the File Navigator Control (Chapter 3)" - page 4

 
Реter Konow:

Logic tells me that these two options are mutually exclusive. If that's not the case, I'll be happy to do so. I'm working on finishing the project. I can't say how long it will take, but it will be finished.

My project is also far from being finished. Interesting suggestions are coming from interested users, which I would like to realise. The list is growing.

Retag Konow:

Perhaps you and I will even co-operate in the future :)

Anything is possible. )

 
Tol, question: how to select not a file, but a folder where the programme files will be saved in the navigator?
 
Artyom Trishkin:
Tol, question: how to select not a file but a folder in which the programme files will be saved in the navigator?

Example:

//---

//+------------------------------------------------------------------+
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
//--- Handling of "Change path in tree list" event
   if(id==CHARTEVENT_CUSTOM+ON_CHANGE_TREE_PATH)
     {
      ::Print(__FUNCTION__," > id: ",id,"; file name: ",m_navigator.SelectedFile());
      ::Print(__FUNCTION__," > id: ",id,"; path: ",m_navigator.CurrentPath()+m_navigator.SelectedFile());
      ::Print(__FUNCTION__," > id: ",id,"; full path: ",m_navigator.CurrentFullPath()+m_navigator.SelectedFile());
      //--- If a file is selected, read it (first three lines)
      if(m_navigator.SelectedFile()!="")
        {
         //--- Form the path to the file
         string path=m_navigator.CurrentPath()+m_navigator.SelectedFile();
         //--- Get the handle of the specified file
         int filehandle=::FileOpen(path,FILE_READ|FILE_TXT|FILE_ANSI|m_navigator.DirectoryArea(),'\n');
         //--- If the handle is received, read the first three lines
         if(filehandle!=INVALID_HANDLE)
           {
            ::Print(__FUNCTION__," > File open: ",path);
            ::Print(__FUNCTION__," > Line 01: ",::FileReadString(filehandle));
            ::Print(__FUNCTION__," > Line 02: ",::FileReadString(filehandle));
            ::Print(__FUNCTION__," > Line 03: ",::FileReadString(filehandle));
           }
         //--- Close the file
         ::FileClose(filehandle);
        }
      ::Print("---");
      return;
     }
  }

//---

CProgram::OnEvent > id: 1024; file name:
CProgram::OnEvent > id: 1024; path: ChartScreenshot\
CProgram::OnEvent > id: 1024; full path: D:\#TradingTerminals\MetaTrader 5 pretest\MQL5\Files\ChartScreenshot\
 
Anatoli Kazharski:

Example:

//---

...

//---

CProgram::OnEvent > id: 1024; file name:
CProgram::OnEvent > id: 1024; path: ChartScreenshot\
CProgram::OnEvent > id: 1024; full path: D:\#TradingTerminals\MetaTrader 5 pretest\MQL5\Files\ChartScreenshot\
Thank you.
 
Anatoli Kazharski:
Tol, another question: how can I see changes in the catalogues displayed by the navigator after creating a new file from the program? So far only switching the timeframe leads to data update in the navigator. The Reset() method in CFileNavigator.mqh does not give the desired result.
 
Artyom Trishkin:
Tol, another question: how can I see changes in the catalogues displayed by the navigator after creating a new file from the program? So far only switching the timeframe leads to data update in the navigator. The Reset() method in CFileNavigator.mqh does not give the desired result.
Not implemented yet, but it is in the plans.
 
Anatoli Kazharski:
Not implemented yet, but it is in the plans.

I see. Let's wait...

One more question: subfolders in the navigator are located according to the general alphabetical list. It is not convenient:


Will there be a fix?

 
Artyom Trishkin:

Another question: subfolders in the navigator are arranged according to the general alphabetical list. This is not convenient:

...

Will there be a fix?

I agree that it is inconvenient. There will be a fix. I can't tell you the timing yet.
 
Anatoli Kazharski:
I agree that it's inconvenient. There will be a fix. I can't tell you the timing yet.
I see. Well... no rush ;)
 
Artyom Trishkin:
Right. Well... not in a hurry ;)
By the way, this is the sequence in which the list is given when reading the file system. That is, not in the order you see it in the file navigator of the operating system.