-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to close boxes. #85
Comments
Hi Johannes To properly do a a windowed console popup, without blocking background threads runs against the design principles behind the library; specifically that the current windows work and function in-place relative div's in html. and wont in parallel with any other thread that writes to the console. for example e.g. a) read the buffer behind where you're about to open the window This would require double buffers, one for actual writes, and one for display writes. you can already call myWindow.Clear() which would "clear" any opened window with the currently set fore/background colour. Lastly; I need to make some significant breaking changes to Konsole in upcoming versions to support scrolling, and keyboard event handling, and dialogs would need to be worked into that change. i've already started with some of that work, you can see there's a new base "control" that has been introduced in the beta 7 branch, and that has suspendLayout and resumeLayout methods, that are not in current v6. The purpose of suspendLayout is to allow for me to create a powerful set of themeable controls that work with the new highspeedwriter, allowing me to fix the missing scrolling functionality in OSX/Nix. basically, v7, v8 are going to be totally new beasts and will have dialog like behaviors, but there's a lot of work for me to do to make that happen. No shortcuts that I can push into V6. It's possible I've misunderstood what you mean by "close box" but the above are my thoughts. Happy to keep discussing further. regards, |
Hi there! Thank you for the response, and totally understandable with vacation. It's open source, you shouldn't be available 24/7! :) When it comes to the issue, I think that I have just not got the |
Clear will clear printed contents of the window, but not clear the window itself if it has a border. var eraser = new Window(10, 10, 40, 5, ...);
var (left, right) = eraser.SplitLeftRight("debits", "credits");
... do some work
// now hide modal, call eraser, because eraser is the modal's parent.
eraser.Clear() The reason for the extra eraser window is because otherwise the "parent" of that window is the main console itself, and when you Clear() that, it will clear the whole window, and not just the dialog you just opened. In later Konsole release I will provide a simple blocking and non blocking modals that will make that easier to do, and still be threadsafe. Be aware that the issue with any floating window is that there is no "hidden line" removal logic, i.e. if box 1 is at absolute position 10, 10 and some other thread is writing to the main console, that threads console writes will happily write over the floating window. That is something i will address in later releases. The design philosophy for early konsole releases was to have each thread allocated very unique window areas that never overlap and the floating window is an artifact that is used to deliver that, it's not meant as a key first class citizen. The philosophy is to quickly break a screen into a few windows, and then have them run normal C# code that writes to a window that is oblivious, to avoid having to write seperate server/client console apps when testing libraries and launching them manually or automated, ...this way you can spin up multiple services, and test lots of complex code with a single console application, and see the output cleanly. Since then Konsole has been used for a lot of applications, games etc. cheers, mmm, just thinking, idiomatically the code above could simply be written as var modal = new Window(10, 10, 40, 5, ...);
var (left, right) =modal.SplitLeftRight("debits", "credits");
... do some work
// now hide modal
modal.Clear() this works because using SplitLeftRight returns 2 new windows with borders that are both children of the borderless floating window created in the Konsole Ver 7 alpha now allows you to pass in a theme to a window. New child windows inherit the theme of the parent. You will have an issue with V6 if you create a floating window with a different background color, because Clear() will empty the window ..well, actually FILL the floating window with the windows fore and back colors. V7 alpha allows you to create a modal with the parent window, and then override the theme when creating child windows, which you couldnt (currently cannot do in V6). V6 may need an additional window to clear using the real parents colors, and then a theme window that fills that window so that the splitLeftRight will have the correct colors for the dialog. Does that make sense? If this is important to do, let me know and I'll create a working spike / gist to demo how to do that if you need it. Alan |
Awesome! That will most likely do exactly what I need. Luckily, all of this type of windows that I will need in this application are during "pause" in the rest of the application (i.e., after validation but before run etc), so I will have no issues with other threads overwriting. All makes sense and I think what you wrote will be more than enough to get me going! Thank you very much for the help :) |
Ah! great!...glad to be able to help... Are you using the latest alpha v7 release, it's actually quite stable? |
@goblinfactory currently on the v6 branch, but I did take a look at the new features in v7 and it looks very promising! :) |
Is your project open so that I could look at how you're using Konsole? That would be very helpful for me in determining which features to work on, and also what examples and documentation to write to help users of the library use it idiomatically (as designed) and get the most from the library :D |
Sadly not this one. But since finding Konsole, I have been considered using it for a few other projects that I have, which are more open. Will gladly let you know when I got something to show :) I do love using and building CLI applications, so this will likely give me much fun during the evenings ;D |
ah! Understood. Great to hear you want to use it in your own projects and other new ideas. |
It would be quite nice to be able to remove a box from the render view. Say, you want to use the box as some type of alert, but when the user have confirmed, it "closes" the box.
This would basically be worthwile to add on the IConsole/IWindow interface (or a new IClosable maybe?), and could be either a dispose thing or a Close() method.
I might create a PR for this if it falls within the scope of the library, so let me know!
The text was updated successfully, but these errors were encountered: