Global Object and Project Functions

Top  Previous  Next

Summary

SetObjectParam("ObjectLabel, "Parameters")

this command will allow you to set/change some of common aspects of basic MMB objects in a runtime.

SetProjectParam("ProjectParameterName", "Parameters")

this command will allow you to set/change some of the project parameters in a runtime.

Both commands along with their parameters (and other 4.9.7 related commands), can be seen in action in 497_test_project.mbd samples project.

SetObjectParam("ObjectLabel, "Parameters")

Description

 

SetObjectParam("ObjectLabel, "Parameters")

Usually, you may set object attributes in a design time via object properties panel. But with this magic function you can set various aspects of some MMB objects in a runtime.

Here is the list of available parameters including their applicability to MMB objects...

Parameter

Value

Description|Usage

Applicability

MOUSEDOWNSCRIPT=

MOUSEUPSCRIPT=

 

MOUSEDOWNSCRIPT:0 or :1 =

MOUSEUPSCRIPT:0 or :1=

script code/variable$

Sets the object's Mouse UP/DOWN script.

 

The subparam :0 or :1 is for quiet/loud syntax parsing. In case of some script errors (e.g. wrong script syntax) and subparam :1 you will be notified about incorrect script via error message box.
Be careful about using quiet parsing! With quite parsing you can easily miss some syntax errors!

Circle

HotSpot, Rectangle

Text

Text Button

Bitmap

Bitmap Button

SCRIPT=

 

SCRIPT:0 or :1=

script code/variable$

Sets the Script object's script.

 

As in case of above MOUSEDOWNSCRIPT/MOUSEUPSCRIPT, the subparam :0 or :1 is for quiet/loud syntax parsing.

 

Script

BG=

TRUE/FALSE

Enables/disables EditBox background.

SetObjectParam("object","BG=TRUE")

EditBox

BGCOLOR=

R,G,B

Sets the object background color. The letters R, G and B stands for Red, Green and Blue integer values in range 0..255. Instead of separated R,G,B values can be used also a string variable containing that RGB comma separated values or CBK_SelColor returned from ColorPicker dialog.

EditBox

Primitive

TextBTN

ListBox

Line

BORDERCOLOR=

R,G,B

Sets the border color of supported objects. The R,G,B parameter settings are the same as in above BGCOLOR.

NOTE: The border color can be changed only for LINE border.

EditBox

Primitive

BORDERTYPE=

LINE

WINDOWS

SUNKEN

NONE

Sets the border type of supported objects. The currently supported parameters are the same as used in design-time mode and similar to Windows border types.

LINE - just one-pixel line around the object

WINDOWS - raised border around the object

SUNKEN - sunked border around the object

NONE - surprisingly, no border around the object ;)

EditBox

Primitive

TEXTCOLOR=

R,G,B

Sets the text color of supported objects. The R,G,B parameter settings are the same as in above BGCOLOR and BORDERCOLOR.

EditBox

Text

Paragraph

Button

ListBox

FONTNAME=

fontname string

Sets the font in supported objects with Text label. The fontname value is just the name of font, but not the filename as you may think! The name of font is just the name under which is the font registered in windows. It's the same name as you may get from the font properties (by double-clicking the font file) or which you can see in Font selection dialog.

EditBox

Text

Paragraph

Button

ListBox

FONTSTYLE=

REGULAR

ITALIC

BOLD

BOLDITALIC

Sets the font style in supported objects with Text label.

EditBox

Text

Paragraph

Button

ListBox

FONTSIZE=

number

Sets the font size in supported objects with Text label.

EditBox

Text

Paragraph

Button

ListBox

FONTEFFECT=

NONE

STRIKEOUT

UNDERLINE

STRIKEUNDER

Sets the font effect in supported objects with Text label.

EditBox

Text

Paragraph

Button

ListBox

FONTSCRIPT=

number

Sets the font script (national character set) in supported objects with Text label.

The script value can be any number from the below table..

script num.

description

0

western

1

other

2

symbol

77

MAC

128

japanese

129

korean (Wansung)

130

korean (Johab)

134

simplified chinese

136

traditional chinese

161

greek

162

turkish

163

vietnamese

177

hebrew

178

arabic

186

baltic

204

cyrillic

222

thai

238

central european

 

EditBox

Text

Paragraph

Button

ListBox

FONTALL=

CBK_FONT or String array

This "font" parameter simply sets all font parameters in a single line of code. The parameter can be either CBK_FONT obtained from FontPicker command or a string array in this format..

FONTNAME|FONTSTYLE|FONTSIZE|FONTSCRIPT|FONTEFFECT|

 

EditBox

Text

Paragraph

Button

ListBox

 

Code Examples

 

** this adds (replaces the actual object's script with..) "Message" function to "TextBTN" object (with loud script parsing)
SetObjectParam("TextBTN","MOUSEUPSCRIPT:1=Message("Hello there!","")")
 
** this adds (replaces the actual object's script with..) "Message" function, this time with using the string variable (& quite script parsing)
code$='Message("","a")'
SetObjectParam("Script","MOUSEDOWNSCRIPT:0=code$")

 

** this sets the object BG color to Red

SetObjectParam("object","BGCOLOR=255,0,0")

** this sets the object BG with color obtained from ColorPicker dialog

ColorPicker()

SetObjectParam("object","BGCOLOR=CBK_SelColor")

** An example of SetObjectParam with FONTALL param:

SetObjectParam("object","FONTALL=arial|regular|12|0|none|")

** or like this...

params$='arial|regular|12|0|none'

SetObjectParam("object","FONTALL=params$")

** or this...

SetObjectParam("object","FONTALL=CBK_FONT")

 

SetProjectParam("ProjectParameterName, "Parameters")

Description

 

SetProjectParam("ProjectParameterName, "Parameters")

This function sets some aspects (for now, mainly the Page attributes) of MMB project.

Here is the list of available parameters...

1st Parameter

2nd Parameter

Value

Description|Usage

PAGEBG

IMAGE=

path$

Sets an image on the Page BG. If the "IMAGE=" is an empty string, the Page BG image is removed.

PAGEBG

DISPLAY=

TILE

NORMAL

Sets the Page BG image tiling. At the moment, only TILE and NORMAL parameters..sorry, no STRETCH yet :)

PAGEBG

COLOR=

R,G,B

Sets the Page BG color. The same syntax as in above SetObjectParam.

PAGEBG

FROMMASTER=

TRUE/FALSE

Enable/Disable obtaining the Page BG settings from Master Page.

MASTERPAGEBG

IMAGE=

path$

Sets an image on the MasterPage BG. If the "IMAGE=" is an empty string, the MasterPage BG image is removed.

MASTERPAGEBG

DISPLAY=

TILE

NORMAL

Sets the MasterPage BG image tiling. At the moment, only TILE and NORMAL parameters..sorry, no STRETCH yet :)

MASTERPAGEBG

COLOR=

R,G,B

Set the MasterPage BG color. The same syntax as in above SetObjectParam.

FULLSCREENBG

IMAGE=

path$

Sets an image on the FullScreen BG. If the "IMAGE=" is an empty string, the FullScreen BG image is removed.

FULLSCREENBG

DISPLAY=

TILE

STRETCH

NORMAL

Sets the FullScreen BG image tiling.

FULLSCREENBG

COLOR=

R,G,B

Set the FullScreen BG color. The same syntax as in above SetObjectParam.

 

Code Examples

 

** this sets the Page BG image

SetProjectParam("PAGEBG","IMAGE=<SrcDir>\images\image.jpg")

** this stretch the image loaded on FullScreen BG

SetProjectParam("FULLSCREENBG","DISPLAY=STRETCH")

** this sets the Master Page color

ColorPicker()

SetProjectParam("MASTERPAGEBG","COLOR=CBK_SelColor")