ManagedMessageBox() - RC1 released July 5

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

ManagedMessageBox() - RC1 released July 5

Post by netmaestro »

This is a command that gives you a standard PureBasic MessageRequester, but with some features added. You can choose the screen position, wait timeout, and button to press on expiry of the timeout. You can even change the default text on the buttons to text of your own choice. The syntax is simple:

Code: Select all

ManagedMessageBox(x, y, title$, message$, flags, waitsecs, defbutton, forcetxt$, statusmask$)


Here's a little demo to run: http://www.networkmaestro.com/test_mmb.exe

Here's the sourcecode for the demo:

Code: Select all

Declare.s GetResult(a)

;position and wait
a = ManagedMessageBox(100,100,"Position and Wait - French","Would you like to donate $100 now to Bill Gates?   ", #MB_ICONQUESTION|6, 5, 0, "Abandonner/Réessayer/Continuer", "/=")
ManagedMessageBox(0,0,"Notice","you chose "+getresult(a), 0, 1, 0, "", "/=")

; ;wait only
a = ManagedMessageBox(0,0,"Wait Only - German","How about Steve Ballmer?   ", #MB_ICONQUESTION|#MB_YESNO, 5, 1, "Ja/Nein/Abbrechen", "Choosing/in/seconds...")
ManagedMessageBox(0,0,"Notice","you chose "+getresult(a), 0, 1, 0, "", "/=")

; ;position without wait
a = ManagedMessageBox(600,200,"Position only - Spanish","George Bush? (Better take some time to think about this one)  ", #MB_ICONQUESTION|#MB_YESNOCANCEL, 0, 0, "Si/No/Cancelar", "/=")
ManagedMessageBox(0,0,"Notice","you chose "+getresult(a), 0, 1, 0, "", "/=")

End

Procedure.s GetResult(a)
  Select a
    Case 1  : a$="OK"
    Case 2  : a$="Cancel"    
    Case 3  : a$="Abort"
    Case 4  : a$="Retry"
    Case 5  : a$="Ignore"
    Case 6  : a$="Yes"
    Case 7  : a$="No"
    Case 8  : a$="Close"
    Case 9  : a$="Help"
    Case 10 : a$="Try Again"
    Case 11 : a$="Continue"
  EndSelect
  ProcedureReturn a$
EndProcedure
and finally, if you'd like to use this command in your projects, here's the library:

http://www.networkmaestro.com/ManagedMessageBox.zip

**new** http://www.networkmaestro.com/ManagedMessageBox394.zip

It's a standard PB messagerequester in every way, I'm just playing a few tricks on it. So all the information in the PB docs regarding MessageRequester() are valid for this version as well. There is one small difference, though. All ManagedMessageBox's are HWND_TOPMOST. Sticky fellows.

I gratefully accepted some event-management help from srod on this one.
Last edited by netmaestro on Wed Jul 05, 2006 4:50 pm, edited 12 times in total.
BERESHEIT
White Eagle
Enthusiast
Enthusiast
Posts: 215
Joined: Sun Jan 04, 2004 3:38 am
Location: Maryland

Post by White Eagle »

For 3.94 or 4.0?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

4.0 only for now, but if there's a demand I can make a version for 3.94, I think. It's mostly API, so it shouldn' present a problem.
BERESHEIT
White Eagle
Enthusiast
Enthusiast
Posts: 215
Joined: Sun Jan 04, 2004 3:38 am
Location: Maryland

Post by White Eagle »

There probably won't be a demand. It seems I am the only person still using 3.94 :cry:
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Cool. Since the countdown message is hardcoded in English, this might limit its usefulness for some people, so I'd suggest an optional parameter to let the programmer specify a custom string in another language.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Thanks, yes the opportunity to create your own status string is a good idea. I'll look at it tomorrow.

As is usually the case, first few downloaders should redownload now as I've fixed a couple of issues. At this point it seems pretty solid to me, but if anyone notices an unexpected or bad behaviour, please let me know.
BERESHEIT
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

hey eagle, don't worry, still doing two projects in 3.94 :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
DarkDragon
Addict
Addict
Posts: 2228
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

White Eagle wrote:There probably won't be a demand. It seems I am the only person still using 3.94 :cry:
I am still using it, because I can't use PB 4 for that now(ok I could, but it would cause too much errors).
bye,
Daniel
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

same here.

i have still 3 'big' apps in 3.94
and 3 'big' new apps in 4.0.

at work, it's 50/50.
at home it's 100% 4.0 :wink:



Well Done netmaestro ! it's useful !
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Thanks Flype, I'm a fan of your work too!

- 3.94 version completed, link added to first post
BERESHEIT
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Sorry! Fixed mistake in 3.94 version, please re-download.
BERESHEIT
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

netmaestro wrote:the opportunity to create your own status string is a good idea. I'll look at it tomorrow
As a suggestion, maybe use a substitution character for the actual number e.g. "Taking "$" in % seconds"
where $ & % are the substitutions for the button & countdown respectively. All other chars are the programmer's language-specific string to appear during the countdown.

I've noticed your related post in the off-topic section. Is it possible to the programmer specify the button states as parameters, and perhaps the nominated timeout button can be specified by a button number from left (starting with 0) to right (n, i.e. last number)? Just a suggestion.
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

I would suggest that we can change the "Giving up in X seconds" bit to something of our choosing as well.

Thanks for sharing nonetheless.
Intrigued - Registered PureBasic, lifetime updates user
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Yes, that is a good idea and the upcoming version will have a fully customizable status string.
BERESHEIT
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

A new version is available. It provides full language support and control over the button texts and the status string for wait times. Latest versions of 4.0 and 3.94 libs are available in the first post, and an updated help file is included to show how to use the new features. Any problems let me know please.

PS: My server is up today but we are experiencing heavy thunderstorms so getting a live download could be a bit hit-or-miss.
BERESHEIT
Post Reply