|
of_AddLine
|
|
Full name
|
pfc_n_cst_dssrv_report.of_AddLine
|
Access
|
protected
|
Extend of
|
string
|
Return value
|
string
|
Prototype
|
protected function string of_AddLine(string,linestyle,integer,vtextalign,integer,integer,integer,integer,long,long,boolean)
|
Name
|
Datatype
|
li_CurrentHeight
|
Integer
|
ls_Modify
|
String
|
ls_Return
|
String
|
ls_Style
|
String
|
ls_Undo
|
String
|
ls_X1
|
String
|
ls_X2
|
String
|
ls_Y1
|
String
|
ls_Y2
|
String
|
protected function string of_AddLine (string as_band, linestyle als_style, integer ai_width, vtextalign avta_valign, integer ai_x1, integer ai_y1, integer ai_x2, integer ai_y2, long al_color, long al_backcolor, boolean ab_execute);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_AddLine
//
// Access: protected
//
// Arguments:
// as_Band The band to add the line to.
// als_Style The pen style of the line (Continuous!, Dash!, DashDot!,
// DashDotDot!, Dot!).
// ai_Width The pen width of the line.
// ai_X1 The X1 point of the line.
// ai_Y1 The Y1 point of the line.
// ai_X2 The X2 point of the line, if 0 is passed it will
// be set to the width of the datawindow.
// ai_Y2 The Y2 point of the line.
// al_Color The color of the line.
// al_BackColor The background color of the line.
// 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: Add a line to any band of a datawindow. This protected function
// does all the work. Overloaded public functions should be called.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.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_Return, ls_Modify, ls_Undo, ls_X1, ls_X2, ls_Y1, ls_Y2, ls_Style
Integer li_CurrentHeight
// Set function defaults for parameters not passed
If ai_Width = 0 Then ai_Width = 4
// Set DataWindow Modify values
Choose Case als_Style
Case Dash!
ls_Style = "1"
Case Dot!
ls_Style = "2"
Case DashDot!
ls_Style = "3"
Case DashDotDot!
ls_Style = "4"
Case Else
ls_Style = "0"
End Choose
// Determine whether to shift existing objects
If Not IsNull(avta_VAlign) Then
// Get original band height and Datawindow color
li_CurrentHeight = Integer(ids_requestor.Describe("Datawindow." + as_Band + ".Height"))
If avta_VAlign <> VCenter! Then
// Adding or inserting the line
// If inserting, then shift original band down
If avta_VAlign = Top! Then
ls_Modify = ls_Modify + of_ShiftBand(as_Band, 0, (ai_Width + 4), False)
ls_Undo = is_Undo[ii_UndoLevel]
ii_UndoLevel --
Else
// Set new band height
ls_Modify = "Datawindow." + as_Band + ".Height=" + String(li_CurrentHeight + ai_Width + 4)
ls_Undo = "Datawindow." + as_Band + ".Height=" + String(li_CurrentHeight)
End if
End if
// Determine line points
ls_X1 = "1"
// Determine the width of the datawindow
ls_X2 = String(of_GetWidth())
If avta_VAlign = Top! Then
ls_Y1 = String((ai_Width / 2) + 2)
ElseIf avta_VAlign = Bottom! Then
ls_Y1 = String(li_CurrentHeight + ((ai_Width / 2) + 2))
Else
ls_Y1 = String((li_CurrentHeight / 2) - ((ai_Width / 2) + 2))
End if
ls_Y2 = ls_Y1
Else
// Determine line points
ls_X1 = String(ai_X1)
If ai_X2 = 0 Then
// Determine the width of the datawindow
ls_X2 = String(of_GetWidth())
Else
ls_X2 = String(ai_X2)
End if
ls_Y1 = String(ai_Y1)
ls_Y2 = String(ai_Y2)
End If
// Build modify statement
ls_Modify = ls_Modify + " create line(band=" + as_Band + &
" x1='" + ls_X1 + "'" + &
" y1='" + ls_Y1 + "'" + &
" x2='" + ls_X2 + "'" + &
" y2='" + ls_Y2 + "'" + &
" pen.style='" + ls_Style + "'" + &
" pen.width='" + String(ai_Width) + "'" + &
" name=add_obj_" + String(ii_ObjectNum) + &
" pen.color='" + String(al_Color) + "'"
If IsNull(al_BackColor) Then
ls_Modify = ls_Modify + " background.mode='1' background.color='536870912')"
Else
ls_Modify = ls_Modify + " background.color='" + String(al_BackColor) + "')"
End If
ii_UndoLevel ++
is_Undo[ii_UndoLevel] = ls_Undo + " destroy add_obj_" + String(ii_ObjectNum)
ii_ObjectNum ++
If ab_Execute Then
ls_Return = ids_requestor.Modify(ls_Modify)
Else
ls_Return = ls_Modify
End if
Return ls_Return
end function