of_createdwobject


pfcwnsrv.pbl   >   pfc_n_cst_winsrv_statusbar   >   of_createdwobject   

Full name pfc_n_cst_winsrv_statusbar.of_createdwobject
Access public
Extend of integer
Return value integer
Prototype public function integer of_createdwobject(ref string,ref integer,ref integer)

Name Datatype
No Data

Name Datatype
lds_test n_ds
li_cnt Integer
li_currentwidth Integer
li_microhelpheight Integer
li_rc integer
li_upper Integer
li_xpoint integer
ls_dwdefinition string
ls_dwtimerinterval string
ls_errorbuffer string
ls_header string
ls_line string
ls_newobject string

public function integer of_createdwobject (ref string as_createstmt, ref integer ai_width, ref integer ai_height);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_CreateDWObject
//
//	Access:  Public
//
//	Arguments:
//	as_createstmt	By ref.  Holds the validated Create String.
//	ai_width			By ref.  Holds the desired width of the object.
//	ai_height		by ref.  Holds the desired Height of the object.
//
//	Returns:  integer
//	1 if it succeeds and -1 if an error occurs.
//
//	Description:
//	Builds and validates the String used to create the actual visual Status Bar.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	5.0   Initial version
// 5.0.01 Modified script to use the calculated li_microhelpheight when setting
//			the header height instead of an arbitratry number. 
// 6.0	Added progress bar creation pfc_progress as predefined object
// 7.0	Updated datawindow syntax for current version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

string	ls_newobject
string	ls_header
string	ls_line
string	ls_dwtimerinterval
string 	ls_dwdefinition
string	ls_errorbuffer
integer	li_rc
integer	li_xpoint
Integer	li_cnt
Integer	li_upper
Integer	li_currentwidth=0
Integer	li_microhelpheight=61
n_ds		lds_test

// Get the Micro Help Height.
li_microhelpheight = of_CalculateMicroHelpHeight()

// Create the desired DataWindow Timer Interval. 
If ib_timer Then
	// A timer event is defined. Use the appropriate value.
	ls_dwtimerinterval = 'timer_interval=' + string(il_timerinterval)
Else
	// No timer event is defined.
	ls_dwtimerinterval = 'timer_interval=0 '
End If

// Create the Header string.
ls_header = &
	'release 6; '+ &
	'datawindow(units=0 '+ &
		ls_dwtimerinterval + &
		'color=80263328 processing=0 HTMLDW=no print.documentname="" ' + &
		'print.orientation = 0 print.margin.left = 107 print.margin.right = 107 ' + & 
		'print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 ' + &
		'print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no) ' + &
	'header(height=' + string(li_microhelpheight) + ' color="536870912" ) ' + &
	'summary(height=1 color="536870912" ) ' + &
	'footer(height=1 color="536870912" ) ' + &
	'detail(height=1 color="536870912" ) ' + &
	'table(column=(type=char(20) updatewhereclause=no name=requiredcol dbname="requiredcol" ) ) '
ls_dwdefinition = ls_header

ls_line = 'line( ' + &
				'name=line_white band=header x1="1" y1="3" x2="1" y2="100" '+ &
				'pen.style="0" pen.width="4" pen.color="16777215"  background.mode="2" ' + &
				'background.color="16777215"' + &
			 ') ' + &
			 'htmltable(border="1" ) ' + &
			 'htmlgen() ' 
			 
// Add the left line.
ls_dwdefinition = ls_dwdefinition + ls_line

li_upper = UpperBound (inv_dwobjects)
For li_cnt = 1 to li_upper

	// Skip blank (unregistered) entries.
	If Len(Trim(inv_dwobjects[li_cnt].s_id)) = 0 Then
		Continue
	End If

	// Define the X point for the new object.
	li_xpoint = li_currentwidth + inv_dwobjects[li_cnt].i_gapwidth
	
	CHOOSE CASE Lower(inv_dwobjects[li_cnt].s_type)
		CASE TEXT
			ls_newobject = + &
				'compute( '+ &
					'name=' + inv_dwobjects[li_cnt].s_id + ' ' + &
					'expression="~'' + string(inv_dwobjects[li_cnt].s_value) + '~'" '+ &
					'border="' + string(inv_dwobjects[li_cnt].i_bordertype) +'" ' + &
					'x="' + string(li_xpoint) + '" ' + &
					'height="'+string(li_microhelpheight)+'" ' + &	
					'width="'+ string(inv_dwobjects[li_cnt].i_width) + '" ' + &
					'background.color="12632256" ' +&	
					'band=header alignment="0"  color="33554432" y="0" '+  &
					'font.face="MS Sans Serif" font.height="-8" font.weight="400" '+ &
					'font.family="2" font.pitch="2" font.charset="0" background.mode="2" ' +&
				') '

		CASE BITMAP
			ls_newobject = + &
				'compute( '+ &
					'name=' + inv_dwobjects[li_cnt].s_id + ' ' + &
					'expression="bitmap(~'' + string(inv_dwobjects[li_cnt].s_value) + '~')" '+ &
					'border="' + string(inv_dwobjects[li_cnt].i_bordertype) +'" ' + &
					'x="' + string(li_xpoint) + '" ' + &
					'width="'+ string(inv_dwobjects[li_cnt].i_width) + '" ' + &
					'height="'+string(li_microhelpheight)+'" ' + &	
					'background.color="12632256" ' +&	
					'band=header alignment="0"  color="33554432" y="0" '+  &
					'font.face="MS Sans Serif" font.height="-8" font.weight="400" '+ &
					'font.family="2" font.pitch="2" font.charset="0" background.mode="2" ' +&
				') '
				
		CASE PREDEFINED
			If inv_dwobjects[li_cnt].s_id = 'pfc_timer' Then
				ls_newobject = + &			
					'compute( '+ &
						'name=' + inv_dwobjects[li_cnt].s_id + ' ' + &
						'expression="Today()" '+ &					
						'format="'+is_timerformat+'" ' + &
						'border="' + string(inv_dwobjects[li_cnt].i_bordertype) +'" ' + &
						'x="' + string(li_xpoint) + '" ' + &
						'width="'+ string(inv_dwobjects[li_cnt].i_width) + '" ' + &
						'height="'+string(li_microhelpheight)+'" ' + &	
						'background.color="12632256" ' +&	
						'band=header alignment="0"  color="33554432" y="0" '+  &
						'font.face="MS Sans Serif" font.height="-8" font.weight="400" '+ &
						'font.family="2" font.pitch="2" font.charset="0" background.mode="2" ' +&
					') '			
			ElseIf inv_dwobjects[li_cnt].s_id = 'pfc_progress' Then
				ls_newobject = + &			
					'rectangle( '+ &
						'name=' + inv_dwobjects[li_cnt].s_id + ' ' + &
						'x="' + string(li_xpoint + ii_baroffsetx) + '" ' + &
						'width="'+ string(inv_dwobjects[li_cnt].i_width - ii_baroffsetx) + '" ' + &
						'height="'+string(li_microhelpheight - ii_baroffsety)+'" ' + &	
						'visible="1~t0" ' + &	
						'brush.color="'+string(il_barfillcolor)+'" brush.hatch="6" ' +&	
						'pen.color="553648127" pen.style="5" pen.width="1" ' +&	
						'background.color="12632256" background.mode="2" ' +&	
						'band=header y="'+string(ii_baroffsety)+'" '+  &
					') ' + &			
					'compute( '+ &
						'name=' + inv_dwobjects[li_cnt].s_id + '_border ' + &
						'expression="" '+ &					
						'border="' + string(inv_dwobjects[li_cnt].i_bordertype) +'" ' + &
						'x="' + string(li_xpoint) + '" ' + &
						'width="'+ string(inv_dwobjects[li_cnt].i_width) + '" ' + &
						'height="'+string(li_microhelpheight)+'" ' + &
						'color="'+string(il_bartextcolor)+'" ' + &
						'background.color="12632256" ' +&	
						'band=header alignment="2" y="0" '+  &
						'font.face="MS Sans Serif" font.height="-8" font.weight="400" '+ &
						'font.family="2" font.pitch="2" font.charset="0" background.mode="1" ' +&
					') '		
					ii_barwidth  = inv_dwobjects[li_cnt].i_width - ii_baroffsetx
					ii_barheight = li_microhelpheight - ii_baroffsety
					ii_barstartx = li_xpoint + ii_baroffsetx
					ii_barstarty = ii_baroffsety
			Else
				ls_newobject = + &			
					'compute( '+ &
						'name=' + inv_dwobjects[li_cnt].s_id + ' ' + &
						'expression="" '+ &					
						'border="' + string(inv_dwobjects[li_cnt].i_bordertype) +'" ' + &
						'x="' + string(li_xpoint) + '" ' + &
						'width="'+ string(inv_dwobjects[li_cnt].i_width) + '" ' + &
						'height="'+string(li_microhelpheight)+'" ' + &					
						'background.color="12632256" ' +&	
						'band=header alignment="0"  color="33554432" y="0" '+  &
						'font.face="MS Sans Serif" font.height="-8" font.weight="400" '+ &
						'font.family="2" font.pitch="2" font.charset="0" background.mode="2" ' +&
					') '							
			End IF
	END CHOOSE

	ls_dwdefinition = ls_dwdefinition + ls_newobject

	// Update the current object width.
	li_currentwidth = li_xpoint + inv_dwobjects[li_cnt].i_width
Next 

// Create a temporary Datastore to test the DataWindow Object.
lds_test = Create n_ds

// Test the datastore.
li_rc = lds_test.Create ( ls_dwdefinition, ls_errorbuffer)
 
// Destroy the temporary DataStore.
If IsValid(lds_test) Then
	Destroy lds_test
End If

// If OK, populate the reference variables.
If li_rc = 1 Then
	as_createstmt = ls_dwdefinition
	ai_width = li_currentwidth
	ai_height = li_microhelpheight
End If
Return li_rc


 

end function

     
Name Owner
pfc_n_cst_winsrv_statusbar.of_open pfc_n_cst_winsrv_statusbar
pfc_w_statusbar.of_createvisuals pfc_w_statusbar

     
Name Owner
datastore.create datastore
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.lower systemfunctions
systemfunctions.string systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_winsrv_statusbar.of_calculatemicrohelpheight pfc_n_cst_winsrv_statusbar

     
Full name
No Data

     
Name Scope
No Data