|
of_register
|
|
Full name
|
pfc_n_cst_dwsrv_resize.of_register
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_register(string,boolean,integer,integer,integer,integer)
|
Name
|
Datatype
|
lb_movex
|
boolean
|
lb_movey
|
boolean
|
lb_scaleheight
|
boolean
|
lb_scalewidth
|
boolean
|
li_cnt
|
integer
|
li_height
|
integer
|
li_rc
|
integer
|
li_slot_available
|
integer
|
li_upperbound
|
integer
|
li_width
|
integer
|
li_x
|
integer
|
li_y
|
integer
|
ls_describeexp
|
string
|
ls_describeret
|
string
|
ls_type
|
string
|
protected function integer of_register (string as_control, boolean ab_scale, integer ai_movex, integer ai_movey, integer ai_scalewidth, integer ai_scaleheight);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_Register
//
// Access: protected
//
// Arguments:
// as_control The object being registered.
// ab_scale If the object should be registered as a Scale type.
// ai_movex The percentage to move the object along the x axis.
// ai_movey The percentage to move the object along the y axis.
// ai_scalewidth The percentage to scale the object along the x axis.
// ai_scaleheight The percentage to scale the object along the y axis.
//
// Returns: integer
// 1 if it succeeds and -1 if an error occurs.
//
// Description:
// Register a control which needs to either be moved or resized when the parent
// object is resized. The action taken on this control depends on the four
// attributes: ai_movex, ai ai_movey, ai_scalewidth, ai_scaleheight.
//
// Note:
// The service object needs to be initialized (of_SetOrigSize()) prior to
// any registering (this function) of objects.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial 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.
//
//////////////////////////////////////////////////////////////////////////////
integer li_rc
integer li_x, li_y, li_width, li_height
integer li_upperbound
integer li_cnt
integer li_slot_available
boolean lb_movex=False, lb_movey=False
boolean lb_scalewidth=False, lb_scaleheight=False
string ls_describeret, ls_describeexp
string ls_type
// Validate the reference.
If IsNull(idw_requestor) or Not IsValid(idw_requestor) Then
Return -1
End If
//Check parameters
If IsNull(as_control) or Len(Trim(as_control))=0 or &
IsNull(ab_scale) or &
IsNull(ai_movex) or ai_movex<0 or ai_movex>100 or &
IsNull(ai_movey) or ai_movey<0 or ai_movey>100 or &
IsNull(ai_scalewidth) or ai_scalewidth<0 or ai_scalewidth>100 or &
IsNull(ai_scaleheight) or ai_scaleheight<0 or ai_scaleheight>100 Then
Return -1
End If
// Validate the object.
ls_describeret = idw_requestor.Describe(as_control+'.Attributes')
If IsNull(ls_describeret) or ls_describeret='!' or ls_describeret='?' Then
Return -1
End If
//Translate parameteters.
If ab_scale Then
ai_movex = 0
ai_movey = 0
ai_scalewidth = 0
ai_scaleheight = 0
End If
lb_movex = (ai_movex > 0)
lb_movey = (ai_movey > 0)
lb_scalewidth = (ai_scalewidth > 0)
lb_scaleheight = (ai_scaleheight > 0)
//Confirm that the user object has already been initialized
If il_parentprevheight=-1 And il_parentprevwidth=-1 Then
Return -1
End If
//Get the previous Bound
li_upperbound = UpperBound (inv_registered[])
//Determine if there is an open slot available other than a
//new entry on the array
li_slot_available = 0
For li_cnt = 1 to li_upperbound
If IsNull(inv_registered[li_cnt].s_control) Or &
Len(Trim(inv_registered[li_cnt].s_control))=0 Then
If li_slot_available = 0 Then
//Get the first slot found
li_slot_available = li_cnt
End If
Else
//Check if control has already been registered
If inv_registered[li_cnt].s_control = as_control Then
Return -1
End If
End If
Next
//If an available slot was not found then create a new entry
If li_slot_available = 0 Then
li_slot_available = li_upperbound + 1
End If
///////////////////////////////////////////////////////////////////////////////////////
//Get the current object information/coordinates
///////////////////////////////////////////////////////////////////////////////////////
li_rc = of_GetObjectInformation (as_control, ls_type, li_x, li_y, li_width, li_height)
If li_rc < 0 then Return -1
///////////////////////////////////////////////////////////////////////////////////////
//Register the new object
///////////////////////////////////////////////////////////////////////////////////////
//Register the actual object
inv_registered[li_slot_available].s_control = as_control
inv_registered[li_slot_available].s_typeof = ls_type
//Set the behavior attributes
inv_registered[li_slot_available].b_movex = lb_movex
inv_registered[li_slot_available].i_movex = ai_movex
inv_registered[li_slot_available].b_movey = lb_movey
inv_registered[li_slot_available].i_movey = ai_movey
inv_registered[li_slot_available].b_scalewidth = lb_scalewidth
inv_registered[li_slot_available].i_scalewidth = ai_scalewidth
inv_registered[li_slot_available].b_scaleheight = lb_scaleheight
inv_registered[li_slot_available].i_scaleheight = ai_scaleheight
inv_registered[li_slot_available].b_scale = ab_scale
//Set the initial position/size attributes
inv_registered[li_slot_available].r_x = li_x
inv_registered[li_slot_available].r_y = li_y
inv_registered[li_slot_available].r_width = li_width
inv_registered[li_slot_available].r_height = li_height
Return 1
end function
Name
|
Owner
|
datawindow.describe |
datawindow
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_n_cst_dwsrv_resize.of_getobjectinformation |
pfc_n_cst_dwsrv_resize
|