Page 1 of 1

Show Message Box

Posted: Mon Jan 11, 2016 10:17 am
by Sem;colon
Hi everyone,

There are a lot of helpful features in EventGhost, but recently I missed one:
I wanted to show a simple popup message on screen (with a button to close it).
It's not too difficult to do in python, however, a UI to customize such a Message Box would be nice, so I created one.
I integrated it in THE EventGhost plugin, as it's a very basic feature in my opinion.
messagebox.PNG

Re: Show Message Box

Posted: Mon Jan 11, 2016 11:34 am
by krambriw
Dear Sem;colon,

Nice feature!
Would it be OK to wish for a setting of a time-out? So that the message box could close itself in an unattended system?

Kind regards, Walter

Re: Show Message Box

Posted: Mon Jan 11, 2016 2:20 pm
by Pako
krambriw wrote:Would it be OK to wish for a setting of a time-out?
It certainly is possible.
I've used it in several plugins such as Nmap (try adding a "Named device" and press OK without filling).
Another option is a warning sound (Yes/No) when opening a MessageBox window.

Pako

Re: Show Message Box

Posted: Mon Jan 11, 2016 7:58 pm
by Sem;colon
Pako wrote:It certainly is possible.
I've used it in several plugins such as Nmap (try adding a "Named device" and press OK without filling).
Well, I used win32gui.MessageBox() which doesn't provide a native functionality for a time-out.
A possibility to set a timeout or have a proper action to close the MessageBox on an event would be cool, but I don't know how to do it.
If somebody knows and is willing to extend the MessageBox by this feature or any other feature or just wants to change some UI elements etc. please feel free to do so!
Pako wrote: Another option is a warning sound (Yes/No) when opening a MessageBox window.
Actually the OS plays the sound of the "icon" you choose, I don't even know how to disable that, but I like it that way.

Re: Show Message Box

Posted: Tue Jan 12, 2016 7:21 am
by Pako
Sem;colon wrote:Well, I used win32gui.MessageBox() which doesn't provide a native functionality for a time-out.
Sem;colon wrote:Actually the OS plays the sound of the "icon" you choose, I don't even know how to disable that, but I like it that way.
I think if we want to have an improved MessageBox, we can not use win32gui.MessageBox().
For example, we can use my class MessageBox (for example, from Nmap plugin).
There is a need to finish only a few things (especially configurable buttons).

Pako

Re: Show Message Box

Posted: Tue Jan 12, 2016 12:06 pm
by Sem;colon
Pako wrote:I think if we want to have an improved MessageBox, we can not use win32gui.MessageBox().
For example, we can use my class MessageBox (for example, from Nmap plugin).
I took a look into that plugin and I have to say that this class you wrote is pretty cool (beyond my python skills, I suck at writing GUI in Python)
But there are also some advantages with using the win32gui function, such as:
- Buttons are always in OS language
- If you select "Allways on top" the box runs in system context and is also visible on the lock screen <- I like that one very much :)

Re: Show Message Box

Posted: Wed Jan 13, 2016 1:26 pm
by Pako
Sem;colon wrote:But there are also some advantages with using the win32gui function, such as:
- Buttons are always in OS language
- If you select "Allways on top" the box runs in system context and is also visible on the lock screen
Yes, these two functions I can not do with wx.Dialog (I now do not take into account the possibilities of internationalization EventGhost).
So we can either accept the fact that some features can never have, or we can do it so, that we can have a choice of all the features
(but will not be able to select some functions simultaneously).
If you want, I can do it.

Pako

Re: Show Message Box

Posted: Wed Jan 13, 2016 7:50 pm
by Sem;colon
Pako wrote:we can do it so, that we can have a choice of all the features
(but will not be able to select some functions simultaneously).
If you want, I can do it.
yes, of course, I'd really appreciate that!
It took me hours to create the UI as it is now ^^┬░

Re: Show Message Box

Posted: Thu Jan 14, 2016 8:02 am
by Pako
Well, I'll start working on it.

Pako

Re: Show Message Box

Posted: Sat Jan 16, 2016 5:30 pm
by Pako
Here is the first version. You can thoroughly test it, please?

Note:
I tried it and your version of the "System modal" never really was modal.
It was only as "Always on top" (with the exception that it does not work to the lock screen). For you it worked in another way?

Pako

Re: Show Message Box

Posted: Sun Jan 17, 2016 11:57 am
by Sem;colon
Awesome!! :D
Pako wrote:I tried it and your version of the "System modal" never really was modal.
It was only as "Always on top" (with the exception that it does not work to the lock screen). For you it worked in another way?
Yes, that's the main difference I found as well, I took the name because the constant was called "MB_SYSTEMMODAL".
Pako wrote:Here is the first version. You can thoroughly test it, please?
I found one strange bug in the win32gui.MessageBox part; I noticed that you handover the EG handle if it's a "system modal" box, this seems to somehow brake something (I can't explain it).
It's all fine when I hardcode the 0 (don't know why)
Since the handle seems to have no effect anyway, I guess it's better to leave it out.

Another thing I noticed with the "Always on top" property: It's only visible on the lock screen if "Wait for the Message Box to close" is not set.
Maybe we should disable the box/Option if on or the other is selected?

On thing regarding the Tweaked MessageBox; we should consider to make the style closer to the system default, so that the Boxes look similar no matter which type is chosen. (Just an idea, i'd also be happy with as it is right now)

I attached a modified version, in this version I disabled the handle hand over for the system box and I changed the style of the Tweaked box to be like the system box.

Re: Show Message Box

Posted: Sun Jan 17, 2016 1:32 pm
by Pako
Sem;colon wrote:I found one strange bug in the win32gui.MessageBox part; I noticed that you handover the EG handle if it's a "system modal" box, this seems to somehow brake something (I can't explain it).
It's all fine when I hardcode the 0 (don't know why)
Since the handle seems to have no effect anyway, I guess it's better to leave it out.
I have not had that problem and I noticed a significant difference.
Now I know how to explain.
The difference is that the window actually behaves modally (relative to EventGhost).
But it has one condition: EventGhost window must be open.
If this is not, so MessageBox is not open (routine is terminated due to an unhandled error because eg.document.frame == None).
It would be possible to give the condition "if eg.document.frame is not None:"
but I think it is unnecessary. I agree with your solution.
Sem;colon wrote:Another thing I noticed with the "Always on top" property: It's only visible on the lock screen if "Wait for the Message Box to close" is not set.
Maybe we should disable the box/Option if on or the other is selected?
To me sometimes happens that it did not work even in another case.
So I do not believe a lot of this feature.
However, I certainly can do what you suggest.

Pako

Re: Show Message Box

Posted: Sun Jan 17, 2016 6:11 pm
by Sem;colon
Nice :D
No further ideas/bugs from my side.

Thank you!