of_setfont


pfcmain.pbl   >   pfc_u_progressbar   >   of_setfont   

Full name pfc_u_progressbar.of_setfont
Access protected
Extend of string
Return value string
Prototype protected function string of_setfont(string,integer,integer,fontfamily,fontpitch,boolean,boolean,boolean)

Name Datatype
No Data

Name Datatype
li_Count Integer
li_NumObjects Integer
li_Undo Integer
ls_FontCharSet String
ls_FontFace String
ls_FontFamily String
ls_FontPitch String
ls_FontSize String
ls_FontWeight String
ls_Italic String
ls_Modify String
ls_name String
ls_Objects String[]
ls_OldFamily String
ls_OldItalic String
ls_OldPitch String
ls_OldUnderline String
ls_OldWeight String
ls_Return String
ls_Underline String
ls_Undo String

protected function string of_setfont (string as_fontface, integer ai_fontsize, integer ai_fontcharset, fontfamily aff_fontfamily, fontpitch afp_fontpitch, boolean ab_bold, boolean ab_italic, boolean ab_underline);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_SetFont
//
//	Access:		protected
//
//	Arguments:
//	as_FontFace				The font to use (i.e. "MS Sans Serif")
//	ai_FontSize				The point size of the font.
//	ai_FontCharSet			The Character set to use for the Font  (0 - ANSI)
//	aff_FontFamily			The font family (AnyFont!, Roman!, Swiss!, Modern!, 
//									Script!, Decorative!)
//	afp_FontPitch				The pitch of the font (Default!, Fixed!, Variable!)
//	ab_Bold						True - Bold, False - Normal.
//	ab_Italic					True - Yes, False - No.
//	ab_Underline				True - Yes, False - No.
//
//	Returns:		String
//		The output of the Modify command (the error text or "") 
//
//	Description:	Change the font of an object in the datawindow.
//	copied from pfc_n_cst_dwsrv_report to make this object pfc independent
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_FontFace, ls_Modify, ls_Objects[], ls_Undo, ls_FontSize, &
					ls_FontFamily, ls_OldFamily, ls_FontPitch, ls_OldPitch, ls_FontWeight, &
					ls_OldWeight, ls_Italic, ls_OldItalic, ls_Underline, ls_OldUnderline, &
					ls_FontCharSet, ls_name, ls_Return
Integer			li_NumObjects, li_Count, li_Undo

// Determine the DataWindow Modify parameters
Choose Case aff_FontFamily
	Case AnyFont!
		ls_FontFamily = "0"
	Case Roman!
		ls_FontFamily = "1"
	Case Swiss!
		ls_FontFamily = "2"
	Case Modern!
		ls_FontFamily = "3"
	Case Script!
		ls_FontFamily = "4"
	Case Decorative!
		ls_FontFamily = "5"
End Choose

Choose Case afp_FontPitch
	Case Default!
		ls_FontPitch = "0"
	Case Fixed!
		ls_FontPitch = "1"
	Case Variable!
		ls_FontPitch = "2"
End Choose

If ab_Bold Then
	ls_FontWeight = "700"
Else
	ls_FontWeight = "400"
End If

If ab_Italic Then
	ls_Italic = "1"
Else
	ls_Italic = "0"
End If

If ab_Underline Then
	ls_Underline = "1"
Else
	ls_Underline = "0"
End If

// Change font size
ls_FontSize = dw_progress.object.pct.Font.Height
If Not IsNull(ai_FontSize) And ai_FontSize <> integer(ls_FontSize) Then
	ls_Modify = " pct.Font.Height='-" + String(ai_FontSize) + "'"
End if

// Change font CharSet
ls_FontCharSet = dw_progress.object.pct.Font.CharSet
If Not IsNull(ai_FontCharSet) And ai_FontCharSet <> integer(ls_FontCharSet) Then
	ls_Modify = " pct.Font.CharSet='" + String(ai_FontCharSet) + "'"
End if

// Change font face
If Not IsNull(as_FontFace) Then
	ls_FontFace = dw_progress.object.pct.Font.Face
	If as_FontFace <> ls_FontFace Then
		ls_Modify =  ls_Modify + " pct.Font.Face='" + as_FontFace + "'"
	End if
End if

// Change font family
If Not IsNull(aff_FontFamily) Then
	ls_OldFamily = dw_progress.object.pct.Font.Family
	If ls_FontFamily <> ls_OldFamily Then
		ls_Modify =  ls_Modify + " pct.Font.Family='" + ls_FontFamily + "'"
	End if
End if

// Change font pitch
If Not IsNull(afp_FontPitch) Then
	ls_OldPitch = dw_progress.object.pct.Font.Pitch
	If ls_FontPitch <> ls_OldPitch Then
		ls_Modify =  ls_Modify + " pct.Font.Pitch='" + ls_FontPitch + "'"
	End if
End if

	// Change font weight
If Not IsNull(ab_Bold) Then
	ls_OldWeight = dw_progress.object.pct.Font.Weight
	If ls_FontWeight <> ls_OldWeight Then
		ls_Modify = ls_Modify + " pct.Font.Weight='" + ls_FontWeight + "'"
	End if
End if

// Change italic
If Not IsNull(ab_Italic) Then
	If dw_progress.object.pct.Font.Italic <> "1" Then
		ls_OldItalic = "0"
	Else
		ls_OldItalic = "1"
	End If
	If ls_Italic <> ls_OldItalic Then
		ls_Modify = ls_Modify + " pct.Font.Italic='" + ls_Italic + "'"
	End if
End if

// Change underline
If Not IsNull(ab_Underline) Then
	If dw_progress.object.pct.Font.Underline <> "1" Then
		ls_OldUnderline = "0"
	Else
		ls_OldUnderline = "1"
	End If
	If ls_Underline <> ls_OldUnderline Then
		ls_Modify = ls_Modify + " pct.Font.Underline='" + ls_Underline + "'"
	End if
End if

ls_Return = dw_progress.Modify(ls_Modify)

Return ls_Return

end function

     
Name Owner
pfc_u_progressbar.of_setfontbold pfc_u_progressbar
pfc_u_progressbar.of_setfontitalic pfc_u_progressbar
pfc_u_progressbar.of_setfontunderline pfc_u_progressbar
pfc_u_progressbar.of_setfontface pfc_u_progressbar
pfc_u_progressbar.of_setfontfamily pfc_u_progressbar
pfc_u_progressbar.of_setfontpitch pfc_u_progressbar
pfc_u_progressbar.of_setfontsize pfc_u_progressbar
pfc_u_progressbar.of_setfontcharset pfc_u_progressbar

     
Name Owner
datawindow.modify datawindow
systemfunctions.integer systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.string systemfunctions

     
Full name
pfc_u_progressbar

     
Name Scope
No Data