MessageRequester Return Values

Just starting out? Need help? Post your questions and find answers here.
User avatar
C87
Enthusiast
Enthusiast
Posts: 176
Joined: Mon Jul 17, 2017 7:22 am
Location: Cotswolds England

MessageRequester Return Values

Post by C87 »

Needing the numeric return values for MessageRequester() I was unable to locate them in HELP or online.
( no result for a search in Titles for MessageRequester Return Values or MessageRequester Variables )

Below I list out the return values that someone new to PureB may find helpful.

#PB_MessageRequester_Yes
gives the buttons: [Cancel] [Try Again] [Continue] and the return values 2, 10 & 11

#PB_MessageRequester_YesNoCancel
Gives the buttons : [Yes] [No] [Cancel] and the return values 6,7 & 2

#PB_MessageRequester_YesNo
Gives the buttons: [Yes] [No] and the return values 6 & 7

#PB_MessageRequester_Cancel
Gives the buttons: [Abort] [Retry] [Ignore] and the return values 3, 4 & 5

Button Value
Clicked Returned
~~~~ ~~~~~~
[Cancel]    = 2
[Abort ] =   3
[Retry ] =   4
[Ignore] =   5
[Yes ]  =     6
[No ]  =  7
[Try Again]  = 10
[Continue]   = 11
If it's falling over......just remember the computer is never wrong!
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MessageRequester Return Values

Post by mk-soft »

Here are the valid calls of MessageRequester.

The call from the requester with the flag #PB_MessageRequester_Yes is not valid and leads only randomly to a result.

Code: Select all

Procedure.s MsgResult(Result)
  Protected r1.s
  Select Result
    Case #PB_MessageRequester_Yes    : r1 = "the 'yes' button was pressed"
    Case #PB_MessageRequester_No     : r1 = "the 'no' button was pressed"
    Case #PB_MessageRequester_Cancel : r1 = "the 'Cancel' button was pressed"
    Case #IDRETRY : r1 = "the 'retry' button was pressed"
    Case #IDABORT : r1 = "the 'abort' button was pressed"
    Case #IDIGNORE : r1 = "the 'ignore' button was pressed"
      
    Default
      r1 = "the Result " + Result + " button was pressed"
  EndSelect
  ProcedureReturn r1
EndProcedure

; msg = MessageRequester("Info", "Questions Ok", #PB_MessageRequester_Ok)
; Debug MsgResult(msg)
; 
; msg = MessageRequester("Info", "Questions YesNo", #PB_MessageRequester_YesNo)
; Debug MsgResult(msg)
; msg = MessageRequester("Info", "Questions YesNo", #PB_MessageRequester_YesNo)
; Debug MsgResult(msg)
; 
; msg = MessageRequester("Info", "Questions YesNoCancel", #PB_MessageRequester_YesNoCancel)
; Debug MsgResult(msg)
; msg = MessageRequester("Info", "Questions YesNoCancel", #PB_MessageRequester_YesNoCancel)
; Debug MsgResult(msg)
; msg = MessageRequester("Info", "Questions YesNoCancel", #PB_MessageRequester_YesNoCancel)
; Debug MsgResult(msg)

; Only Windows
msg = MessageRequester("Info", "Questions RetryCancel", #MB_RETRYCANCEL)
Debug MsgResult(msg)

msg = MessageRequester("Info", "Questions AbortRetryIgnore", #MB_ABORTRETRYIGNORE)
Debug MsgResult(msg)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
C87
Enthusiast
Enthusiast
Posts: 176
Joined: Mon Jul 17, 2017 7:22 am
Location: Cotswolds England

Re: MessageRequester Return Values

Post by C87 »

The call from the requester with the flag #PB_MessageRequester_Yes is not valid and leads only randomly to a result.
  • #PB_MessageRequester_Yes
    I found to be consistent in its return values in all the tests I made, with Cancel=2, Try Again=10 and Continue=11.

    Your comprehensive expansion using PureB variables may well be the preferred syntax but personally I prefer the numeric return variables. Particularly as they are in general, standard and use less code. Additionally, from 2=Cancel through to 7=No, those numbers seem fairly universal in other languages. Probably the [Yes], [No] is the most commonly used and I just find it so easy to just If/EndIf for <Yes>, 6 after the MessageRequester(). Plus it is what I've done for years with Message Prompt Return PopUps, hence my original post.
Last edited by C87 on Wed Feb 13, 2019 10:21 am, edited 1 time in total.
If it's falling over......just remember the computer is never wrong!
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: MessageRequester Return Values

Post by Marc56us »

And since the beginning, there has always been a constant missing for the exclamation point ( ? = 32) but the numerical value works

Code: Select all

MessageRequester("", Str(#PB_MessageRequester_Error),    #PB_MessageRequester_Error)
MessageRequester("", "The 32 is missing. (The question mark) but numeric value works", 32)
MessageRequester("", Str(#PB_MessageRequester_Warning),  #PB_MessageRequester_Warning)
MessageRequester("", Str(#PB_MessageRequester_Info),     #PB_MessageRequester_Info)

MessageRequester("", "No icon for ?", #PB_MessageRequester_YesNo)
:wink:
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: MessageRequester Return Values

Post by ozzie »

For question mark (?) you can use the constant #MB_ICONQUESTION.
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MessageRequester Return Values

Post by infratec »

C87 wrote:... PureB variables may well be the preferred syntax but personally I prefer the numeric return variables. Particularly as they are in general, standard and use less code. Additionally, from 2=Cancel through to 7=No, those numbers seem fairly universal in other languages.
Are your values also standard in Linux and OSX :?:

Using PB constants is always the better way.
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MessageRequester Return Values

Post by mk-soft »

This also applies to Windows constants declared in PB. It can also change sometimes something and then you look for a wolf to find the error.
Except that the code doesn't get bigger when using constants, but only the code will read better than just any numbers.
That's what constants are meant for...

But everyone should do as he wants
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
C87
Enthusiast
Enthusiast
Posts: 176
Joined: Mon Jul 17, 2017 7:22 am
Location: Cotswolds England

Re: MessageRequester Return Values

Post by C87 »

infratec asked:Are your values also standard in Linux and OSX
Ah, infratec got me there!.....I'm a Microsoft only guy, since 1983 actually.From MS-DOS to Windows with some CP/M & MP/M along the way.

Once tried Linux Mint but unimpressed & never owned, or even used an Apple computer or phone. :D
If it's falling over......just remember the computer is never wrong!
Post Reply