of_setcolor


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_report   >   of_setcolor   

Full name pfc_n_cst_dwsrv_report.of_setcolor
Access public
Extend of string
Return value string
Prototype public function string of_setcolor(long,long,string,string,boolean)

Name Datatype
No Data

Name Datatype
li_Count Integer
li_NumObjects Integer
li_Undo Integer
lnv_String n_cst_string
ls_BackMode String
ls_color String
ls_Modify String
ls_Objects String[]
ls_Return String
ls_Type String
ls_Undo String

public function string of_setcolor (long al_color, long al_backcolor, string as_name, string as_band, boolean ab_execute);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SetColor
//
//	Access:  public
//
//	Arguments:
//	al_Color						The new color.  If Null is passed, it will not be changed.
//	al_BackColor				The new background color.  If Null is passed, it will not
//									be changed.
//	as_Name					The name of the object to change, "*" will cause all
//									objects in the band to be changed.
//	as_Band					The band in which to change the objecs, "*" will call
//									the entire datawindow to be changed.  This argument is
//									ignored if a name is passed in as_Name.
//	ab_Execute				True - execute the Modify command,
//									False - build the command but do not execute it
//
//	Returns:		String
//					The output of the Modify command (the error text or "") if True
//					was passed for ab_Execute; the text of the Modify command
//					to add the object if False was passed.
//
//	Description:	Change the color and background color (if applicable) of an object 
//						in the datawindow.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
// 7.0 Fix to allow for expressions in the color attribute
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 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_Modify, ls_Objects[], ls_Undo, ls_Type, ls_BackMode, ls_Return, ls_color
Integer			li_NumObjects, li_Count, li_Undo
n_cst_string	lnv_String

If as_Name = "*" Then
	// All visible objects in the as_Band band are to be changed
	li_NumObjects = of_GetObjects(ls_Objects, "*", as_Band, True)

	li_Undo = ii_UndoLevel

	For li_Count = 1 To li_NumObjects
		// Call this function for each object
		ls_Modify = ls_Modify + of_SetColor(al_Color, al_BackColor, ls_Objects[li_Count], "", False)
	Next

	// Combine each object's undo statement into one
	li_Undo ++
	For li_Count = (li_Undo + 1) To ii_UndoLevel
		is_Undo[li_Undo] = is_Undo[li_Undo] + " " + is_Undo[li_Count]
	Next
	ii_UndoLevel = li_Undo

Else
	ls_Type = idw_Requestor.Describe(as_Name + ".Type")
	ls_BackMode = idw_Requestor.Describe(as_Name + ".Background.Mode")

	Choose Case ls_Type
		Case "line"
			ls_color = idw_Requestor.Describe(as_Name + ".Background.Color")
			If Not IsNull(al_BackColor) And Long ( ls_color ) <> al_BackColor Then
				ls_Modify = ls_Modify + " " + as_Name + ".Background.Color='" + String(al_BackColor) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Background.Color='" + ls_Color + "'"
				If al_BackColor <> 536870912 And ls_BackMode = "1" Then
					// Background mode is transparent, must not be to change the background color

					ls_Modify = ls_Modify + " " + as_Name + ".Background.Mode='2'"
					ls_Undo = ls_Undo + " " + as_Name + ".Background.Mode='1'"
				End if
			End if
			ls_Color = idw_Requestor.Describe(as_Name + ".Pen.Color")
			If Not IsNull(al_Color) And Long ( ls_color ) <> al_Color Then
				ls_Modify = ls_Modify + " " + as_Name + ".Pen.Color='" + String(al_Color) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Pen.Color='" + ls_Color + "'"
			End if
			
		Case "elipse", "rectangle", "roundrectangle"
			ls_Color = idw_Requestor.Describe(as_Name + ".Background.Color")
			If Not IsNull(al_BackColor) And Long ( ls_color ) <> al_BackColor Then
				ls_Modify = ls_Modify + " " + as_Name + ".Background.Color='" + String(al_BackColor) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Background.Color='" + ls_Color + "'"
				If al_BackColor <> 536870912 And ls_BackMode = "1" Then
					// Background mode is transparent, must not be to change the background color
					ls_Modify = ls_Modify + " " + as_Name + ".Background.Mode='2'"
					ls_Undo = ls_Undo + " " + as_Name + ".Background.Mode='1'"
				End if
			End if
			ls_Color = idw_Requestor.Describe(as_Name + ".Brush.Color")
			If Not IsNull(al_Color) And Long ( ls_color ) <> al_Color Then
				ls_Modify = ls_Modify + " " + as_Name + ".Brush.Color='" + String(al_Color) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Brush.Color='" + ls_Color + "'"
			End if
			
		Case "column", "compute", "text"
			ls_Color = idw_Requestor.Describe(as_Name + ".Background.Color")
			If Not IsNull(al_BackColor) And Long ( ls_color ) <> al_BackColor Then
				ls_Modify = ls_Modify + " " + as_Name + ".Background.Color='" + String(al_BackColor) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Background.Color='" + ls_Color + "'"
				If al_BackColor <> 536870912 And ls_BackMode = "1" Then
					// Background mode is transparent, must not be to change the background color
					ls_Modify = ls_Modify + " " + as_Name + ".Background.Mode='2'"
					ls_Undo = ls_Undo + " " + as_Name + ".Background.Mode='1'"
				End if
			End if
			ls_Color = idw_Requestor.Describe(as_Name + ".Color")
			If Not IsNull(al_Color) And Long ( ls_color ) <> al_Color Then
				ls_Modify = ls_Modify + " " + as_Name + ".Color='" + String(al_Color) + "'"
				ls_Undo = ls_Undo + " " + as_Name + ".Color='" + ls_Color + "'"
			End if
	End Choose

	ls_Undo = lnv_string.of_GlobalReplace (ls_Undo, "~"", "")
	ii_UndoLevel ++
	is_Undo[ii_UndoLevel] = ls_Undo
End if

If ab_Execute Then
	ls_Return = idw_Requestor.Modify(ls_Modify)
Else
	ls_Return = ls_Modify
End if

Return ls_Return

end function

     
Name Owner
pfc_n_cst_dwsrv_report.of_prepprint pfc_n_cst_dwsrv_report
pfc_n_cst_dwsrv_report.of_SetColor pfc_n_cst_dwsrv_report
pfc_n_cst_dwsrv_report.of_SetColor pfc_n_cst_dwsrv_report
pfc_n_cst_dwsrv_report.of_SetColor pfc_n_cst_dwsrv_report
pfc_n_cst_dwsrv_report.of_setcolor pfc_n_cst_dwsrv_report

     
Name Owner
datawindow.describe datawindow
datawindow.modify datawindow
systemfunctions.isnull systemfunctions
systemfunctions.long systemfunctions
systemfunctions.string systemfunctions
pfc_n_cst_string.of_globalreplace pfc_n_cst_string
pfc_n_cst_dwsrv.of_getobjects pfc_n_cst_dwsrv
pfc_n_cst_dwsrv_report.of_setcolor pfc_n_cst_dwsrv_report

     
Full name
No Data

     
Name Scope
No Data