Open ghost opened 10 years ago
Is "CenterScreen" the same as "in the center of the screen"? If yes, then while the common case of one display can be handled mostly accurately in Tk, the becoming more common case of multiple screens on one PC is very difficult because most multiple screen systems present the set as one large rectangle of pixels. There are usually other, system specific, API's to obtain the actual individual screen sizes and positions, and Tk does not natively provide an interface to those API's. So centering on a dual monitor arrangement almost always results in the window being split in two across the boundary of the two monitors. So mostly possible, but the failure case is quite bad.
As for "CenterOwner", what does that mean?
When I open ANY application, I expect that initial window will be maximized or will has fixed size located on the center of the screen. Children windows should be centered relative to the parent window. I didn't look up to the source code, but I think that should be easy to implement (set appropriate flags while creating window).
And here we see a first difference of opinion. I never want ANY application to start maximized, nor would I want everything to start centered on the screen. Centering children over the parent also implies that the parent is not available for use while the child is open, which is also another item on my list of personal "do-not-do-this" items.
Surprisingly, something seemingly as simple as opening in maximized state is more difficult than it seems at first in a compatible, cross platform, manner (Gorilla runs on Windows, X11, and MacOS, each has slightly different ways to achieve the same, not all of which Tk provides access into).
Tk has a few flags for windows that purport to perform these settings. One, the "wm state . zoomed" flag setting, does not exist under Unix/X11. The equivalent for Unix/X11 (wm attributes . -zoomed true) on my system (Linux/X11) does not actually maximize the window, but rather makes it the full window height, but unchanged width.
Centering children over their parents is much more easily done, because Tk does provide functions for determining the parent window position and for positioning windows at arbitrary screen positions. Naturally such behavior will be another preference, because not everyone wishes to have this behavior in the apps. they utilize. Centering within a single screen is also fairly easy overall, but does break in the instance of multiple screens. It too would naturally be a preference that could be toggled on or off.
A bit of research on maximizing a window shows it to be fraught with more edge conditions than it would seem at first.
The code example presented at the top of the page here: http://wiki.tcl.tk/2233, excluding the windows only "zoomed" flag, on my system (Linux/X11) results in the window spanning both of the two monitors I have have connected (laptop panel + an a second external monitor). It also results in the bottom and right window decorations being off screen and therefore invisible as a result.
The tk "-fullscreen" option results in a single screen, full screen, window, but it is a "proper" full-screen window (i.e., a video player "full screen"), no window borders, no title bar, no close buttons, which also means that there is no way to manipulate the window size/position wise with the mouse, nor any way to close it from any of the normal window borders (because there is no window frame). To close it I have to access my Fvwm2 close option on my second screen or kill the Tk process from a terminal on my other screen. On a single screen system, this setting would have required me to switch out to a text console to kill the process.
What is the setting you have selected for the item Preferences->General->Remember sizes of dialog boxes?
If it is "off", what happens when you: 1) turn it "on", 2) maximize the main window using your normal system controls, 3) exit gorilla, 4) restart gorilla.
Does the window return in a state of effectively being "maximized"?
First Your response: I prefer maximized state for specified apps (such as Word, not for Gorilla). For small desktop apps, child windows should open in center OR remember x,y coordinations after reopen. The initial window has to be centered (choose db and mainwindow). Now Gorilla remember size of windows, but no positions.
Yes, that option currently remembers sizes only. It could be extended to also remember position, which would reposition the windows where they were when the were closed. For that aspect (positioning) Tk does provide interfaces across the three architectures, although under X11 the window manager can override the positioning if configured to do so.
Extending the "remember" feature to also optionally remember positions would allow for "open in center" to be obtained by manually positioning the relevant windows once and thereafter if nothing changes screen size wise the window should reposition to the center.
Can you test the code in the "save-dialog-positions" branch (https://github.com/zdia/gorilla/tree/save-dialog-positions) to see if: 1) any bugs appear on your system 2) the saving of window positions as well as sizes reasonably fits your request?
I can't find compiled binaries of new version...
The test version is source. To test it you would need a Tcl/Tk 8.5.X installation.
If you'd like I can roll up a kit, but you'd need to tell me which OS you are using.
It would be nice, if you create a single exe. Windows.
2014-09-01 1:54 GMT+02:00 rich123 notifications@github.com:
The test version is source. To test it you would need a Tcl/Tk 8.5.X installation.
If you'd like I can roll up a kit, but you'd need to tell me which OS you are using.
— Reply to this email directly or view it on GitHub https://github.com/zdia/gorilla/issues/132#issuecomment-54005439.
Windows executable: http://gorilla.dp100.com/gorilla.save-dialog-positions.80c21e1b769d22a8b61684887bf3a078491c346a.exe
GPG signature of the above executable: http://gorilla.dp100.com/gorilla.save-dialog-positions.80c21e1b769d22a8b61684887bf3a078491c346a.exe.sig
Were you able to test this modification? Did it sufficiently meet your needs? Did you notice any problems with it?
Sorry, I am using KeePass now.
2014-10-11 18:20 GMT+02:00 rich123 notifications@github.com:
Were you able to test this modification? Did it sufficiently meet your needs? Did you notice any problems with it?
— Reply to this email directly or view it on GitHub https://github.com/zdia/gorilla/issues/132#issuecomment-58755023.
Could mainwindow open in the CenterScreen ? Other windows should be opened in CenterOwner mode.