Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How to configure the Show Message Box buttons

If you have a question or need help, this is the place to be.
Post Reply
internaltheory79
Posts: 3
Joined: Thu Oct 16, 2014 12:10 am

How to configure the Show Message Box buttons

Post by internaltheory79 »

Hello,

What I am looking to do is set up the OK and Cancel buttons for the action Show Message Box. Is there a way to set up the OK button to do something.

Here is what I am trying to do:
What I would like to is when I hit the ok button I want to open a folder.
I'd really like to learn how to configure the other buttons as well but the ok and cancel button explinations would be awesome.

Eventghost Version: 0.4.1.r.1722
Windows 10
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to configure the Show Message Box buttons

Post by kgschlosser »

you need to be opening the message box from a script or a plugin

so what you would do is this.

Code: Select all


# different styles available
# wx.ICON_EXCLAMATION
# wx.ICON_HAND
# wx.ICON_ERROR
# wx.ICON_QUESTION
# wx.ICON_INFORMATION

# these can be added to the styles above with a | as a seperator
# wx.YES_NO
# wx.OK

# this style can be added if the wx.YES_NO is used
# wx.NO_DEFAULT

# these styles can be added to any combination of the above 
# wx.STAY_ON_TOP
# wx.CANCEL

dlg = eg.MessageDialog(
    parent=eg.document.frame,
    message='This is a Test Message',
    caption='This shows in the dialog title bar',
    style=wx.YES_NO |  wx.ICON_QUESTION,
    pos=(100, 200) # this is for where you want the dialog to show up on the screen
)

if dlg.ShowModal() == wx.ID_YES:
    CODE YOU WANT TO RUN IF THE YES BUTTON IS PRESSED
else:
    CODE YOU WANT TO RUN IF THE NO BUTTON IS PRESSED
dlg.Destroy()

this is all pseudo code and I have not tested it but it looks right. could have a typo somewhere tho
If you like the work I have been doing then feel free to Image
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: How to configure the Show Message Box buttons

Post by Sem;colon »

@ kgschlosser: I think he refers to

Code: Select all

eg.plugins.EventGhost.ShowMessageBox()
Hello internaltheory79,

if you press one of the buttons, EventGhost generates an event automatically, you should see it in the log if you press a button.
You can use this event to execute whatever action you want (e.g. open a folder)
If you like my work, Image me a drink :wink:
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to configure the Show Message Box buttons

Post by kgschlosser »

OK I have never used that before

thanks Semi
If you like the work I have been doing then feel free to Image
Post Reply