Giter VIP home page Giter VIP logo

Comments (4)

Matheus-Garbelini avatar Matheus-Garbelini commented on May 18, 2024 1

hi, @aiekick I understood what internally the script does and now fixed in a proper way.
(Indeed my previous fix didn't make sense. It only worked because it forced your code to reset the FileNameBuffer at a later stage).
Turns out that you use the following lines to reset the default filename:

// Reset default file name
ResetBuffer(FileNameBuffer);
AppendToBuffer(FileNameBuffer, MAX_FILE_DIALOG_NAME_BUFFER, dlg_defaultFileName);

The issue is that the lines above are only called at specific places, which never resets the default filename when vDefaultFileName changes.
I fixed by adding the above lines just before the SetPath from OpenDialog functions.
However, because I understand you would still like to keep the previous file name or path changed by the user on the dialog file input, coding something like the following could work with proper adjustments:

void ImGuiFileDialog::OpenDialog(...){
...
  if (dlg_defaultFileName.compare(vDefaultFileName) != 0){
    // Whenever the caller has a different `vDefaultFileName`, reset the `FileNameBuffer`
    ResetBuffer(FileNameBuffer);
    AppendToBuffer(FileNameBuffer, MAX_FILE_DIALOG_NAME_BUFFER, dlg_defaultFileName);
  }
  ...
  SetPath(vPath);
}

Let me know if the explanation above makes sense.
Regards and thanks for this great library.

from imguifiledialog.

aiekick avatar aiekick commented on May 18, 2024 1

Hi,
yes it make sense.
fixed in 6cb0564

from imguifiledialog.

Matheus-Garbelini avatar Matheus-Garbelini commented on May 18, 2024 1

@aiekick sorry for the delay. Thanks a lot, this library was really useful.

from imguifiledialog.

aiekick avatar aiekick commented on May 18, 2024

interesting, thanks. i will check that tonight.

btw i dont understand your fix, because m_CurrentPath is replaced by vPath just after.

from imguifiledialog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.