This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: 15 Nov 22, 11:47 Last Post By: davidekholm Threads: [ Previous | Next ]
RobM

Posts: 3,815
Registered: 4-Aug-2006
MonitoredWorkQueue window positioning
Posted: 13 Nov 22, 22:41
 
  Click to reply to this thread Reply
Attachment Work queue.mp4 (2.2 MB)
Can the MonitoredWorkQueue setMessage window be positioned slightly off centre?

I have a tool running (window positioned dead centre) and the work queue 'progress message window' is placed dead centre of the screen. Another window opens underneath (dead centre) and completely hidden by it. If you know the hidden window is there you can abort the work queue to get to the hidden window and click on its buttons. But if you don't know it just looks like the process is taking forever or something has gone wrong.

Attached is a small movie showing what happens.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: MonitoredWorkQueue window positioning
Posted: 14 Nov 22, 17:58   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Can the MonitoredWorkQueue setMessage window be positioned slightly off centre?

I have a tool running (window positioned dead centre) and the work queue 'progress message window' is placed dead centre of the screen. Another window opens underneath (dead centre) and completely hidden by it. If you know the hidden window is there you can abort the work queue to get to the hidden window and click on its buttons. But if you don't know it just looks like the process is taking forever or something has gone wrong.

Attached is a small movie showing what happens.


The behavior is for the dialogue to show centered in relation to the parent component, so the only current way to position it differently is to pass another UI component as parent. You can for instance pass window.mainSettingsPanel instead of window.

For the next release (available as a core update now) you can also override protected void dialogOpening() and access the "dialog" member variable (now protected instead of private). Via this variable you can call setLocation for instance.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: MonitoredWorkQueue window positioning
Posted: 14 Nov 22, 18:58   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Let me elaborate a bit:

Instead of just creating a MonitoredWorkQueue, you can do:
MonitoredWorkQueue<AlbumObject> queue = new MonitoredWorkQueue(window, "Blah") {
    @Override
    protected void dialogOpening() {
        dialog.setLocationRelativeTo(window.mainSettingsPanel);
    }
};
To ease things further, I've also added the "lambda" way of achieving the same thing via the onDialogOpening call. Now you can call:
queue.onDialogOpening(d -> d.setLocationRelativeTo(window.mainSettingsPanel));
I also updated the "companion class" Work to allow the onDialogOpening call, so you can run code like this (Groovy):
Work.on(rootFolder.descendants)
.onDialogOpening(d -> d.setLocationRelativeTo(window.mainSettingsPanel))
.forEach(ao) -> {
	println ao
	Thread.sleep(100)
}
If you just want to give the dialogue a nudge to the right, you can do:
// Code input area
Work.on(rootFolder.descendants)
.onDialogOpening(d -> d.setLocation(d.x+20, d.y+20))
.forEach(ao) -> {
	println ao
	Thread.sleep(100)
}
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: MonitoredWorkQueue window positioning
Posted: 14 Nov 22, 20:10   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Wow. Much much more than I hoped for, thanks. The one that works best for me is the last one, setting the window's location.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: MonitoredWorkQueue window positioning
Posted: 15 Nov 22, 11:47   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
You're welcome Rob :-)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums