Keyboard Shortcuts: work no matter which panel has focus

Started by Jingo, September 24, 2018, 03:16:00 PM

Previous topic - Next topic

Jingo

Hi Mario - I'm a big fan of keyboard shortcuts.  I tend to use the Ctrl-Alt-S shortcut a lot to write the metadata back to images when I am done working on a particular set.  However, this shortcut requires the file window to be in focus before it can work.. is there a reason for this?  IM already knows which images are selected - so, say if I just finished applying keywords in the keyword panel (and that is my last step in the process) and now want to do a write back - shouldn't the shortcut just work on the selected idlist regardless of the focused panel?  Right now, I need to make the file window in focus before the shortcut will work...

It would be helpful to have this (and others) work this way.. and I welcome your thoughts!  Thx - Andy.

Mario

Not necessarily. Windows sends the key press event to the active window (the 'focused' window) and IMatch then propagates that up the parent chain until a window/panel processes the shortcut - or not.

When I'm in the keyboard panel and it is active I can press Ctrl+Alt+S and the file window writes back pending metadata of all selected files...
But if an edit control is active, this does not work because these controls are managed by Windows. First click on the Save button or something to push the focus away from the input field.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Oh.. I see what you mean... ok.. I'll just continue doing what I've been doing to get focus back to the file window (or remove focus from the edit field).  Thx Mario!

JohnZeman

You're a scripter Andy, why not just write a simple script to do this and run it from a user panel like I do?


Mario

Most "File Window..." keyboard shortcuts work from any panel. And if not, with <F9>,<F9> you can always put the focus on the file window.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: JohnZeman on September 24, 2018, 06:20:58 PM
You're a scripter Andy, why not just write a simple script to do this and run it from a user panel like I do?



I hear ya John.... and I probably should look into something when I have some time but doesn't your script still require you to focus on the app panel and then click a button?  I just figured a "global" operation should work as a shortcut no matter what window is focused.  If I make changes to the metadata panel (such as add a rating) and apply those changes to the photos, CTRL-ALT-S works.  If I'm in the keywords panel, add a keyword and apply the changes - CTRL-ALT-S does not unless I focus back to the file window. 

Mario

As I said above, the write-back shortcut works in the Keyword panel or MD panel or elsewhere. I do that all the time. Ctrl+Alt+S.
Which panel and which control within that panel has the input focus (and thus receives all keyboard messages from Windows) when it does not work? Which control/window did you clicked last when you use Cltr+Alt+S? Maybe there is an exception somewhere, I dunno.

I just tried and it even works when the input field in the Keyword panel is active!
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

JohnZeman

Quote from: Jingo on September 25, 2018, 01:17:23 PM
I hear ya John.... and I probably should look into something when I have some time but doesn't your script still require you to focus on the app panel and then click a button?  I just figured a "global" operation should work as a shortcut no matter what window is focused.  If I make changes to the metadata panel (such as add a rating) and apply those changes to the photos, CTRL-ALT-S works.  If I'm in the keywords panel, add a keyword and apply the changes - CTRL-ALT-S does not unless I focus back to the file window.

Andy the user panel has to be visible, that's all.  Once I click a button in that panel it'll have the focus and the app runs and does what the button label says regardless of what view I'm in or how many files are selected.

Jingo

Here is quick video to demonstrate.... after I hit the "checkmark" to apply the new keyword - I hit Ctrl+Alt+S and the write-back does not happen.

Not sure if it matters - but the keywords panel is on a 2nd monitor - the GIF combines it into one screen of course.
 

Jingo

Quote from: JohnZeman on September 25, 2018, 02:52:30 PM
Quote from: Jingo on September 25, 2018, 01:17:23 PM
I hear ya John.... and I probably should look into something when I have some time but doesn't your script still require you to focus on the app panel and then click a button?  I just figured a "global" operation should work as a shortcut no matter what window is focused.  If I make changes to the metadata panel (such as add a rating) and apply those changes to the photos, CTRL-ALT-S works.  If I'm in the keywords panel, add a keyword and apply the changes - CTRL-ALT-S does not unless I focus back to the file window.

Andy the user panel has to be visible, that's all.  Once I click a button in that panel it'll have the focus and the app runs and does what the button label says regardless of what view I'm in or how many files are selected.

Yes - but.. let's say you follow the workflow I outlined in the GIF above - select an image, add a keyword... I would still need to then click into the user panel to run your script which is the same I can do now to the file browser.  In the end - this is not a major issue because I can simply just save the write-back for the end of the workflow and do it all at once.. was really more curious than anything else why it wasn't working.  BTW - your script (like ALL your scripts) looks intriguing and I wouldn't mind taking a look at the code if you wouldn't mind sharing.  Many thx! - Andy.

Mario

Works here (one monitor!). Just tried. But I use docked panels.
If you float the panel and thus make it an independent window, you break it out of the native event processing and some things cannot work anymore.
This is not something IMatch can solve, this is a mix of behaviors caused by the UI toolkit (3rd party) and Windows event processing.

I suggest docking the keyword panel for an optimal workflow.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on September 25, 2018, 03:08:45 PM
Works here (one monitor!). Just tried. But I use docked panels.
If you float the panel and thus make it an independent window, you break it out of the native event processing and some things cannot work anymore.
This is not something IMatch can solve, this is a mix of behaviors caused by the UI toolkit (3rd party) and Windows event processing.

I suggest docking the keyword panel for an optimal workflow.

Aha.. yes.. docking fixes it.  BUT - then I can't use the keywords panel on the 2nd monitor...  Hmm... perhaps it is time to get one of the 4k 34" displays...  :P   Thx Mario!!!

JohnZeman

Quote from: Jingo on September 25, 2018, 03:05:37 PM
BTW - your script (like ALL your scripts) looks intriguing and I wouldn't mind taking a look at the code if you wouldn't mind sharing.  Many thx! - Andy.

Some of those buttons run external apps or CMD scripts but most of the code is contained in the attached zip file.

Jingo

Thx John.. always interested in looking at scripting code... starting to get back into it again after a short hiatus... looking to get an album script written for upload/export/maintenance from within IM!

Mario

QuoteHmm... perhaps it is time to get one of the 4k 34" displays...  :P   Thx Mario!!!

I can recommend them. I only ever use a second monitor now to debug multi-monitor problems. For everything else there is plenty of space on my 4K screen. And Windows 10 supports multiple desktops you can easily switch, making working with multiple apps at 4K full-screen very easy. Of course your requirements may differ.

@John

Tip: If you want to spend a few minutes with modernizing the UI, you can do so quickly using the Boostrap 4 CSS library that is part of IMatch.
In your index.html remove links to the old Bootstrao CSS and JS and then add

<link rel="stylesheet" href="/system/bootstrap-4/css/bootstrap.min.css">
<link rel="stylesheet" href="/system/themes/bootstrap-4/slate/bootstrap.min.css" />

in the <head> and

<script src="/system/bootstrap-4/js/bootstrap.bundle.min.js"></script> after the <body>

Then you can create layouts which have one or more 'elements' (buttons, text) as follows:


        <div class="container-fluid">
            <h2>Photo Processing</h2>

            <div class="d-flex flex-row">
                <div class="p-2">
                    <h4>Database Files <span id="counter-files-in-db" class="badge badge-primary">100000</span></h4>
                </div>
                <div class="p-2">
                    <h4>Files Needing Writeback <span id="counter-files-wb" class="badge badge-primary">42</span></h4>
                </div>
            </div>

            <div class="d-flex flex-row">
                <button class="p-2 btn btn-primary">Empty Bookmarks</button>
                <button class="p-2 btn btn-primary ml-2">Verify Matching Images for Reprocessed JPHs</button>
            </div>
        </div>


The result looks like this in the App Panel:



It's super easy once you have played with it for a few minutes. I have attached the complete index.html below.
Documentation for the flex layout is here: https://getbootstrap.com/docs/4.1/utilities/flex/#with-align-items


-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

JohnZeman

Many thanks for this Mario.  I'm still getting up to speed on Bootstrap 4 and the app I posted this morning was written back when I knew very little about Bootstrap.  Recently I've switched to Bootstrap Studio for building my web sites and have been learning quite a bit about Bootstrap since then.

I'm on my lunch hour right now so I can't study the code at the moment but I'll for sure go through it carefully the next time I have a day off.

Thanks again.

Mario

I can highly recommend Bootstrap for all things IMatch App user interface.

IMatch ships with BS3 (for older apps) and BS4 (recommended) for newer apps and it's hence always installed and available.
The 'Slate' theme I ship with IMatch by default adapts BS very nicely to the general IMatch UI.

Even you need only a form or some buttons, it's a big help already.
And for more complex layouts it saves lots of headache. Even if you don't have to deal with different browser versions...IMatch Apps always run in a recent Chromium browser.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Quote from: Jingo on September 25, 2018, 03:16:48 PMBUT - then I can't use the keywords panel on the 2nd monitor...

Actually, you could. Just stretch the iMatch window across both monitors and then size the panels so that the split is between them. I have a similar approach with Photoshop where I have sized the window so it uses all of the first monitor and part of the second. The second monitor then has my tool, layers, etc panels and the primary monitor shows the image and menu.

Jingo

Quote from: Carlo Didier on September 26, 2018, 10:40:24 AM
Quote from: Jingo on September 25, 2018, 03:16:48 PMBUT - then I can't use the keywords panel on the 2nd monitor...

Actually, you could. Just stretch the iMatch window across both monitors and then size the panels so that the split is between them. I have a similar approach with Photoshop where I have sized the window so it uses all of the first monitor and part of the second. The second monitor then has my tool, layers, etc panels and the primary monitor shows the image and menu.

Hmm.. never thought of that Carlo... I went with the alternate solution - purchased a 34" widescreen which should take care of the problem.. and then some!  Will be helpful with other software where I have many panels open currently across 2 monitors like Indesign and Photoshop.  Now, I'll be able to have everything on a single monitor and still have extra items open like Firefox, MS Word or PDF files for reference on a 2nd monitor.

Carlo Didier

Quote from: Jingo on September 26, 2018, 01:00:16 PM...purchased a 34" widescreen which should take care of the problem..

Something like that is also on my wishlist ...

sinus

Quote from: JohnZeman on September 25, 2018, 03:20:41 PM
Quote from: Jingo on September 25, 2018, 03:05:37 PM
BTW - your script (like ALL your scripts) looks intriguing and I wouldn't mind taking a look at the code if you wouldn't mind sharing.  Many thx! - Andy.

Some of those buttons run external apps or CMD scripts but most of the code is contained in the attached zip file.

John, thanks a lot for this.

Your app is simply cool. Although I do not dare to use the buttons for now, but it is quick and shows in one window a lot of information, I like that.
The only thing, what I tried is the green button (Metadata-Viewer) and it works fine!

If I could script like you (and others here of course, Andy, Thorsten ....) my IMatch - world would be easier.   8)
Best wishes from Switzerland! :-)
Markus