RPR ShowMessageBox

From CockosWiki

(Redirected from RPR MB)
Jump to: navigation, search

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR ShowMessageBox
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR ShowMessageBox

Contents

ShowMessageBox()

int MB(const char* msg, const char* title, int type) quicker to type...
int ShowMessageBox(const char* msg, const char* title, int type)

Displays a standard dialogue box and returns a value which depends on the button the user chose to click.

Parameters

int type -- Dialogue Box Type 
 0=OK,
 1=OKCANCEL,
 2=ABORTRETRYIGNORE,
 3=YESNOCANCEL,
 4=YESNO,
 5=RETRYCANCEL
const char* msg -- Message
 This is the message the dialogue box displays
const char* title -- Dialogue Box Title
 This is the title of the dialogue box

Returns

An integer with one of the following values:

 1=OK,
 2=CANCEL,
 3=ABORT,
 4=RETRY,
 5=IGNORE,
 6=YES,
 7=NO

Examples

C++

 


Perl

#
# ShowMessageBox.pl
#
 
use strict;
use warnings;
 
use constant MSGBOX_JUST_OK =>0;
use constant MSGBOX_OKCANCEL =>1;
use constant MSGBOX_ABORTRETRYIGNORE => 2;
use constant MSGBOX_YESNOCANCEL => 3;
use constant MSGBOX_YESNO => 4;
use constant MSGBOX_RETRYCANCEL => 5;
 
use constant MSGBOX_OK => 1;
use constant MSGBOX_CANCEL => 2;
use constant MSGBOX_ABORT => 3;
use constant MSGBOX_RETRY => 4;
use constant MSGBOX_IGNORE => 5;
use constant MSGBOX_YES => 6;
use constant MSGBOX_NO => 7;
 
my $advice = '';
 
my $return_value = RPR_ShowMessageBox("Make your choice...", "ShowMessageBox", MSGBOX_YESNO);
 
if($return_value == MSGBOX_YES){
  $advice = 'You clicked Yes';
} elsif ($return_value == MSGBOX_NO){
  $advice = 'You clicked Yes';
} else {
  $advice = 'Not quite sure what happened there...';
}
 
RPR_ShowMessageBox($advice, "ShowMessageBox", MSGBOX_JUST_OK);


Python

#
# ShowMessageBox.py
#
 
# type:
#
# 0=OK,
# 1=OKCANCEL,
# 2=ABORTRETRYIGNORE,
# 3=YESNOCANCEL,
# 4=YESNO,
# 5=RETRYCANCEL
 
type = 4
title = "msgbox title"
msg = "msgbox message"
 
result = RPR_MB( msg, title, type )
 
# result:
# 
# 1=OK,
# 2=CANCEL,
# 3=ABORT,
# 4=RETRY,
# 5=IGNORE,
# 6=YES,
# 7=NO
 
RPR_ShowConsoleMsg( str(result) )

See Also

Stuff

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR ShowMessageBox
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR ShowMessageBox

Personal tools