Width Property

From Lianjapedia
Jump to: navigation, search

The width of the object in pixels. Read/write. The object width is dependent on the width available in the parent container. The fixedwidth property can be used to specify an absolute width.

nWidth = ob.width
ob.width = nWidth

nWidth

Numeric signifying the width in pixels.

Example

//
// Lianja custom section for page "page1" section "section1"
//
namespace custom1
public container1, textbox1, textbox2, sizebutton
define class page1_section1 as section
enddefine
 
define class size_button as CommandButton
	proc click
		// Shrink container size
		container1.fixedwidth = 400
		// Textbox1 stays at fixedwidth
		textbox1.value = "Width = " + etos(int(textbox1.width))
		// Textbox2 does not go below its minimum width
		textbox2.value = "Width = " + etos(int(textbox2.width))
		// Sizebutton resizes to fill the rest of the available container width
		sizebutton.caption = "Width = " + etos(int(sizebutton.width))
	endproc
enddefine
 
proc page1_section1 
	page1_section1 = createobject("page1_section1")
 
	page1_section1.addobject("container1","container")
	container1.backcolor = "slategray"
	// Arrange objects horizontally in container
	container1.layout = 1
 
	container1.addobject("textbox1", "Textbox")
	textbox1.value = "Fixed width 120"
	textbox1.fixedwidth = 120
 
	container1.addobject("textbox2", "Textbox")
	textbox2.value = "Min width 200"
	textbox2.minwidth = 200
 
	container1.addobject("sizebutton","size_button")
	sizebutton.caption = "Click"
 
return page1_section1