Difference between revisions of "Backcolor Property"

From Lianjapedia
Jump to: navigation, search
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
__NOTOC__
 
An object's background color.  Read/write.
 
An object's background color.  Read/write.
  
 
<pre>
 
<pre>
ob.backcolor = cColor | nColor
+
nBackColor = ob.backcolor
 +
ob.backcolor = nColor | cColor
 
</pre>
 
</pre>
  
===cColor===
+
===nBackColor===
Color constant:
+
Backcolor is returned as a decimal number.
 +
 
 +
===nColor===
 +
Decimal number:
  
 
<code lang="recital">
 
<code lang="recital">
ob.backcolor = "magenta"
+
ob.backcolor = 16711935
ob.backcolor = "lime"
+
 
</code>
 
</code>
  
HTML style six-digit hexadecimal number for red, green, blue components:
+
Or decimal using the rgb() function:
  
 
<code lang="recital">
 
<code lang="recital">
ob.backcolor = "#FF00FF"
+
ob.backcolor = rgb(255,0,255)
ob.backcolor = "#00FF00"
+
 
</code>
 
</code>
  
===nColor===
+
Hexadecimal number:
Decimal number:
+
  
 
<code lang="recital">
 
<code lang="recital">
ob.backcolor = 16711935
+
ob.backcolor = 0xFF00FF
ob.backcolor = -16711935
+
 
</code>
 
</code>
  
Or using the rgb() function:
+
===cColor===
 +
Color constant:
  
 
<code lang="recital">
 
<code lang="recital">
ob.backcolor = rgb(255,0,255)
+
ob.backcolor = "magenta"
ob.backcolor = rgb(0,255,0)
+
 
</code>
 
</code>
  
Hexadecimal number:
+
HTML style six-digit hexadecimal number for red, green, blue components:
  
 
<code lang="recital">
 
<code lang="recital">
ob.backcolor = 0xFF00FF
+
ob.backcolor = "#FF00FF"
ob.backcolor = 0x00FF00
+
 
</code>
 
</code>
 +
 +
==Example==
 +
<code lang="recital">
 +
//
 +
// Lianja custom section for page "page1" section "section1"
 +
//
 +
namespace custom
 +
public textbox1
 +
define class page1_section1 as section
 +
enddefine
 +
 +
define class color_button as CommandButton
 +
proc click
 +
textbox1.backcolor = "green"
 +
messagebox(etos(int(textbox1.backcolor)),0,"Backcolor")
 +
endproc
 +
enddefine
 +
 +
proc page1_section1
 +
page1_section1 = createobject("page1_section1")
 +
 +
page1_section1.addobject("colorbutton","color_button")
 +
colorbutton.caption = "Go Green!"
 +
 +
page1_section1.addobject("textbox1", "Textbox")
 +
textbox1.value = "Textbox 1"
 +
textbox1.backcolor = rgb(255,0,255)
 +
 +
return page1_section1
 +
</code>
 +
 +
[[Category:Properties]]
 +
[[Category:Common Properties]]

Latest revision as of 06:26, 26 September 2011

An object's background color. Read/write.

nBackColor = ob.backcolor
ob.backcolor = nColor | cColor

nBackColor

Backcolor is returned as a decimal number.

nColor

Decimal number:

ob.backcolor = 16711935

Or decimal using the rgb() function:

ob.backcolor = rgb(255,0,255)

Hexadecimal number:

ob.backcolor = 0xFF00FF

cColor

Color constant:

ob.backcolor = "magenta"

HTML style six-digit hexadecimal number for red, green, blue components:

ob.backcolor = "#FF00FF"

Example

//
// Lianja custom section for page "page1" section "section1"
//
namespace custom
public textbox1
define class page1_section1 as section
enddefine
 
define class color_button as CommandButton
	proc click
		textbox1.backcolor = "green"
		messagebox(etos(int(textbox1.backcolor)),0,"Backcolor")
	endproc
enddefine
 
proc page1_section1 
	page1_section1 = createobject("page1_section1")
 
	page1_section1.addobject("colorbutton","color_button")
	colorbutton.caption = "Go Green!"
 
	page1_section1.addobject("textbox1", "Textbox")
	textbox1.value = "Textbox 1"
	textbox1.backcolor = rgb(255,0,255)
 
return page1_section1