of_getparentposition


pfcapsrv.pbl   >   pfc_n_cst_dropdown   >   of_getparentposition   

Full name pfc_n_cst_dropdown.of_getparentposition
Access public
Extend of integer
Return value integer
Prototype public function integer of_getparentposition(dragobject,ref integer,ref integer)

Name Datatype
No Data

Name Datatype
li_border Integer
li_parentx Integer
li_parenty Integer
li_x Integer
li_y Integer
lpo_parent PowerObject
ltab_parent Tab
luo_parent UserObject

public function integer of_getparentposition (dragobject adrg_object, ref integer ai_x, ref integer ai_y);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_GetParentPosition
//
//	Access:  		public
//
//	Arguments:
//	adrg_object			The dragobject whose parent position is needed.
//	al_x(by reference) The x coordinate for the parent.
//	al_y(by reference) The y coordinate for the parent.
//
//	Returns:  		Integer
//						1 if it succeeds and -1 if an error occurs.
//
//	Description:	Calculates the parent position in relationship to the window.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

PowerObject	lpo_parent
UserObject	luo_parent
Tab			ltab_parent
Integer		li_parentx, li_parenty
Integer		li_x, li_y
Integer		li_border

// Validate required reference.
If IsNull(adrg_object) or Not IsValid(adrg_object) Then
	Return -1
End If

// Loop getting the parent of the object until it is of type window!
lpo_parent = adrg_object.GetParent()
do while IsValid (lpo_parent)
	If lpo_parent.TypeOf() = window! Then
		Exit
	End If
	li_border = 0
	CHOOSE CASE TypeOf(lpo_parent)
		CASE UserObject!
			luo_parent = lpo_parent
			li_parentx = luo_parent.X 
			li_parenty = luo_parent.Y 
			// Determine the Left/Upper Border.
			If luo_parent.Border Then
				CHOOSE CASE luo_parent.BorderStyle
					CASE StyleBox!
						li_border = of_GetSystemSetting(STYLE_BOX)
					CASE StyleShadowBox!
						li_border = of_GetSystemSetting(STYLE_SHADOWBOX)
					CASE StyleLowered!
						li_border = of_GetSystemSetting(STYLE_LOWERED)
					CASE StyleRaised!		
						li_border = of_GetSystemSetting(STYLE_RAISED)
				END CHOOSE				
			End If			
		CASE Tab!
			ltab_parent = lpo_parent
			li_parentx = ltab_parent.X 
			li_parenty = ltab_parent.Y 
			li_border = of_GetSystemSetting(TAB_BORDER)
	END CHOOSE
	li_x += li_parentx + li_border
	li_y += li_parenty + li_border
	lpo_parent = lpo_parent.GetParent()
loop

if not IsValid (lpo_parent) then
	Return -1
end If

ai_x = li_x
ai_y = li_y
Return 1


end function

     
Name Owner
pfc_n_cst_dropdown.of_position pfc_n_cst_dropdown

     
Name Owner
powerobject.getparent powerobject
powerobject.typeof powerobject
powerobject.typeof powerobject
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
pfc_n_cst_dropdown.of_getsystemsetting pfc_n_cst_dropdown

     
Full name
No Data

     
Name Scope
No Data