Results 1 to 10 of 42

Thread: SvPascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    simvector
    Guest
    @pstudio

    1) Here is how you would use TSvDirList
    Code:
    var
      dl: TSvDirList;
      i : Integer;
    begin
    
      dl := TSvDirList.Create;
      dl.ReadAllFiles('c:\temp\', '*.dll'); //scan for file mask including sub folders
      //dl.ReadFiles('c:\temp\', '*.dll'); //scan for file mask in specified folder only
      //dl.ReadName('c:\temp*.*'); // scan for folder names only
      for i := 0 to dl.Count-1 do
      begin
        WriteLn(dl.ItemNames[i]);
      end;
      SvFreeNilObj(dl);
    
    end;
    2) const not working inside routine. /Bug/ - Thanks.

    3) dropdown not selecting correct file sometimes. /Bug/ - Thanks.

    4) Add vertical tabs. Noted. Thanks. ATM you can press F12 to bring up a list of project files.

    5) Save File As not working. /Bug/ - Thanks

    6) Add own code folding marks. At the moment you can not. I will check to see if the Editor SDK allows me to do so. If so I will try and get this added. Thanks for the suggestion.

    Again, thanks for the feedback. Much appreciated.


    @Rodrigo Robles
    Coolness, thanks.

  2. #2
    Thanks for the example.

    One more thing. I tried writing:

    Code:
    SV.Utils.DottedFilePath(path, 8);
    Result was that the program closed without any errors or similar.

    The problems was solved by using a larger value in stead of 8.
    I can imagine various reasons why 8 is too small a number, but I would recommend to give some better error feedback than just closing the program with no warning. The log wouldn't even reveal the problem.
    Last edited by pstudio; 12-07-2011 at 07:55 PM.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3
    simvector
    Guest
    Hi... hmm.. interesting. I will have a look at this routine. It could be a bug in the routine and/or something going on with the call. But I will check it out. It does make a call the a Win32 API routine to do the work. Thanks for reporting.

  4. #4
    One last question (or two) related to file browsing I swear

    1. Is there an easy way in SvEngine or SvPascal to go up a directory when I have a path value? For instance if path := 'c:\foo\bar\' then I want path = 'c:\foo\'.
    2. Is there a way to check if a path leads to a folder or file? I thought I could use TSvUtils.MatchStrings like this "SV.Utils.MatchStrings(path, '.mp3')" to see if path lead to a mp3 file but it dodn't work.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  5. #5
    simvector
    Guest
    Haha... no worries. Your feedback is help me find and fix bugs so thank you.

    1) At the moment there is nothing. You can use the Pos routine to search for '\' which you can then use to find the last occurrence then back up to the previous.
    2) You can use FileExists, but DirectoryExists is not currently available. Note to self... "be sure to bind DirectoryExist command."
    3) MatchStrings... I think I added this to do some pattern matching for a string. So no, that will not help in this case.
    4) if you call TSvDirList.ReadFile(path, '*.mp3') will pick up all the files in this path or ReadAll to get everything including sub folders, then you can walk the list and use FileExists to see if the file is actually there.

  6. #6
    Thanks,
    FileExists worked fine for my purpose and I quickly made my own function to get the parent directory.

    Now a completely different kind of question. How do I register when my window loses focus? I've noticed that the window stops rendering and that's fine. However I'm playing music through the Bass library and music will continue to play when the app loses focus. So I need to know when the app loses and gains focus so I can manually pause and play music.

    If it makes a difference I'm inheriting from TSvPrototypeGame.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  7. #7
    simvector
    Guest
    1) no prob... glad to hear you got it all working. Coolness.

    2) You can override the TSvPrototypeGame.OnAppEvent event handler. There you can check SV.Minimized and SV.Active to test the application state.

    3) If you want the application window to continue rendering when it looses the focus, set RenderOnLostFocus to TRUE and if you ever need to control the audio playback of the default audio engine, set GlobalFocus property to TRUE and audio will continue playing when the focus is lost.
    Last edited by simvector; 13-07-2011 at 11:40 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •