Constants - CBK Constants

Top  Previous  Next

They sound so scary and ugly (CBK !), but they are nothing more than just a Multimedia & System info constants that can be displayed in text objects, like all multimedia players do !

Ha ! Who would guess it ;-)

 

CBK type of constant is a property of MMB's Text Object. So let's go there and see what can we find, change, learn:

 

CBKTextObject

 

Next to the "Label" property of text object, there's an arrow button. Click on it opens a menu with list of CBK constants that can be used in your project. They're separated into 6 categories, depending on their info coverage. After setting CBK constant, text object you assigned it to will in runtime mode (when application runs) display info from that constant.

 

Explanations of all CBK's coming up.

 

Audio CBK constants

CBK name

Explanation

Example

CBK_Total

Displays total (duration) time of currently loaded audio file. Format of displayed time is mm:ss (minutes:seconds)

21:12

CBK_Total Sec

Displays total (duration) time of currently loaded audio file.

Time is displayed in seconds.

360

CBK_Time

Displays current time (position) of loaded audio file.

Format of displayed time is mm:ss (minutes:seconds)

11:08

CBK_Time Sec

Displays current time (position) of loaded audio file.

Time is displayed in seconds.

110

CBK_AudioType

Returns type of loaded Audio file.

MPEG 1 Layer 3

CBK_AudioBit

Returns bitrate of loaded audio file. Bitrate format: kbit/s

128kbps

CBK_AudioFreq

Returns sampling frequency of loaded audio file. Frequency is expressed in kHz (n x 1000Hz)

44.1kHz

CBK_AudioName

Returns name of loaded audio file, without path and extension.

Barry White - Baby Blues

CBK_Channels

Returns audio file channel mode.

Can be either Mono or Stereo.

Stereo

CBK_ID3Song

Displays title of Audio file retrieved from ID3 tag.

Baby Blues

CBK_ID3Artist

Displays artist of Audio file retrieved from ID3 tag.

Barry White

CBK_ID3Album

Displays album of Audio file retrieved from ID3 tag.

The Ultimate Collection

CBK_ID3Year

Displays year of Audio file retrieved from ID3 tag.

2000.

CBK_ID3Genre

Displays genre of Audio file retrieved from ID3 tag.

Soul

CBK_NumTracks

Returns number of Audio CD tracks.

12

 

Song List CBK constants

CBK name

Explanation

Example

CBK_CurItemList

Displays item currently selected in the song list.

Delirium - After All

CBK_NumInList

Counts and displays number of items in song list.

31

CBK_TotalList

Counts and displays total duration of all items in song list.

Format of displayed time is mm:ss (minutes:seconds).

You will have to use SongListTime() function to compute CBK_TotalList.

135:28

CBK_TotalListSec

Counts and displays total duration of all items in song list.

Time is displayed in seconds.

You will have to use SongListTime() function to compute CBK_TotalListSec.

1130

 

Video CBK constants

CBK name

Explanation

Example

CBK_VName

Returns name of playing video file, without path and extension.

TheMatrix

CBK_VTotal

Displays total (duration) time of currently playing video file. Format of displayed time is mm:ss (minutes:seconds)

180:00

CBK_VTotalSec

Displays total (duration) time of currently playing video file.

Time is displayed in seconds.

10800

CBK_VTime

Displays current time (position) of playing video file.

Format of displayed time is mm:ss (minutes:seconds)

94:32

CBK_VTimeSec

Displays current time (position) of playing video file.

Time is displayed in seconds.

48000

CBK_VTotalFrames

Returns number of frames of playing video file.

394024

CBK_VFrame

Displays current frame (position) of playing video file.

249253

 

Date & Time CBK constants

CBK name

Explanation

Example

CBK_Year

Displays current year.

2004

CBK_Month

Displays current year's month using text format.

July

CBK_Month Num

Displays current year's month using integer (number) format in range 1 - 12.

7

CBK_Day

Displays day of current week using text format.

Tuesday

CBK_DayNum

Displays day of current week using integer (number) format.

Range 1-7 represents days:

Sunday = 1
Monday = 2
Tuesday = 3
Wednesday = 4
Thursday = 5
Friday = 6
Saturday = 7

3

CBK_DateNum

Displays current month's day using integer (number) format in range

1 - 31.

22

CBK_DateShort

Displays current date using short Windows format DD/MM/YY (day:month: year).

21/03/2002

CBK_DateLong

Displays current date using long Windows format Month Day, YYYY

July 23, 2004

CBK_TimeHMS

Displays current system time using H:M:S (hours:minutes: seconds) format and AM/PM time division.

01:06:12 PM

CBK_Time24

Displays current system time using HH:MM:SS (hours:minutes: seconds), 24-hour format.

13:06:12

CBK_Hour

Displays current time hour in range 0 - 23.

13

CBK_Minute

Displays current time minute in range 0 - 59.

06

CBK_Second

Displays current time second in range 0 - 59.

12

 

General CBK constants

CBK name

Explanation

Example

CBK_AppFileName

Returns the filename of actual project in format "name"."exe"

test.exe

CBK_PageName

Displays label of currently opened project page.

Intro Page

CBK_Error

Returns (eventual) errors sent by FMOD audio engine or Video Object.

FMOD errors are returned using integer values. See list here.

180:00

CBK_Volume

Returns current master volume in percentage (0-100).

60

CBK_URLpath

Displays current URL from MMB's HTML Object (if it's available).

http://www.go.com

CBK_OpenFile

After using MMB's Open File dialogbox, this CBK displays selected file name without path.

TurnAround.mpg

CBK_OpenDir

After using MMB's Open File dialogbox, this CBK displays path of selected file.

c:\videos\

CBK_ReturnVal

Run command sends return values from the running application (if return codes were implemented in application) to this CBK object.

1

CBK_SelColor

Returns RGB value from MMB's Color Picker dialogbox. Color picking uses RGB (Red, Green, Blue) system containing 3 components.

 

Each component can have one of 256 levels. Greater value of component increases color intensity. If you specify value 0, color component will not be used. Value 255 uses maximum color intensity.

Result of Color Picker is a comma-separated array of string values, each representing one RGB component (first: red, second: green, third: blue) in value range 0-255.

 

To retrieve color value, simply assign contents of CBK_SelColor to a string variable:

color$=CBK_SelColor

R,G,B

Result

128,5,64

 

 

R,G,B

Result

0,255,255

 

CBK_Font

Returns the string array containing Font parameters selected in FontPicker() function.

Arial|REGULAR|10|238|STRIKEOUT|

CBK_MsgEx

Returns the value of pressed button in MessageEx dialog.

Success: Returns the ID of the button pressed.

Failure: Returns -1 if the message box timed out.

Button Pressed Return Value

OK = 1

CANCEL = 2

ABORT = 3

RETRY = 4

IGNORE = 5

YES = 6

NO = 7

TRY AGAIN ** = 10

CONTINUE ** = 11

** Only valid on Windows 2000/XP and above.

 

Script CBK constants

CBK name

Explanation

Example

CBK_AudioEOF

If you set label of script object either on current project page or Master Top Layer to match this CBK constant, that script will be launched when audio file (ogg) playback ends. MMB will first look for this script object on current page and then on Master Top Layer.

View Example

CBK_Menu

If you modify label of object group to start with CBK_Menu, that group will be hidden every time user clicks outside that object group.

This helps you in making pop-up menus, disappearing when user clicks away. On user's click on the screen, all CBK_Menu labeled objects will be hidden except the menu under mouse cursor.

For example check masterpages.mbd that comes in MMB package.

View Example

CBK_EXIT

Use this to catch the Close button on the title bar or the Escape key.

Note: The object or group MUST be in the Master Top layer.

 

If you set label of object either on Master Top Layer to match this CBK constant, pressing of Escape key on keyboard will not (by default) close your application.

Instead, script under CBK_Exit labeled object will be run, enabling you to create "Do you want to exit ?" message boxes or whatever you want to do when user wants to exit application.

On Master Top Layer create rectangle.
Insert the text:  «Do you want to exit?», and two buttons: «OK» and «Cancel».
Now group all 4 objects.
Rename The Group to CBK_EXIT.
Expand the group in the object list so you can access the items in it.
On Button OK:  Trigger the Exit action.
On button Cancel: Hide the CBK_EXIT group.
Now hide the whole CBK_EXIT group.

Tip: From the Wizard tool (on tool bar) select Capture Exit and ESC key, and then select the type from submenu - this will insert the object for you.

View Example

CBK_CMDLINE

If you set label of Script object either on Master Page/Master Top Layer to match this CBK constant, each time you start your MMB application with some command line parameters, this Script object will be invoked and you will be able to process the passed command line parameters via this script object (e.g. start playback of Audio file passed by command line parameter or process each of the passed parameters individually).

View Example