|
open
|
|
Full name
|
pfc_w_selection.open
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event open()
|
Name
|
Datatype
|
ll_height
|
long
|
ll_rowcount
|
long
|
ll_width
|
long
|
ls_errbuffer
|
string
|
ls_presentation
|
string
|
ls_syntax
|
string
|
WHITE
|
string
|
event open;call super::open;//////////////////////////////////////////////////////////////////////////////
//
// Event: open
//
// Description: Initialize window based on passed-in object
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
constant string WHITE = "16777215"
long ll_rowcount
long ll_width
long ll_height
string ls_errbuffer
string ls_syntax
string ls_presentation
SetPointer (hourglass!)
ib_disableclosequery = true
inv_selectionattrib = message.powerobjectparm
this.title = inv_selectionattrib.is_title
// Set the dataobject
if Lower (Left (inv_selectionattrib.is_dataobject, 7)) = "release" then
// If DW syntax was passed
dw_1.Create (inv_selectionattrib.is_dataobject, ls_errbuffer)
else
if Lower (Left (inv_selectionattrib.is_dataobject, 6)) = "select" then
// If a SQL select was passed
if IsValid (inv_selectionattrib.itr_object) then
if inv_selectionattrib.itr_object.of_IsConnected() then
// Default presentation
ls_presentation = "DataWindow (color=" + WHITE + ") " + &
"Column (background.mode=1 border=0 color=0 edit.displayonly='yes' edit.focusrectangle='no' " + &
"font.face='MS Sans Serif' font.height='-8' font.weight=400 font.family=2 font.pitch=2 font.charset=0) " + &
"Text (alignment=0 border=0 color=0 background.mode=1 " + &
"font.face='MS Sans Serif' font.height='-8' font.weight=400 font.family=2 font.pitch=2 font.charset=0) " + &
"Style (Header_Bottom_Margin=0 Header_Top_Margin=0 Report='yes')"
// Build syntax from sql and create DW
ls_syntax = inv_selectionattrib.itr_object.SyntaxFromSQL (inv_selectionattrib.is_dataobject, &
ls_presentation, ls_errbuffer)
if Len (ls_syntax) > 0 then
if dw_1.Create (ls_syntax, ls_errbuffer) = 1 then
dw_1.SetSort ("#1 A")
end if
end if
end if
end if
else
dw_1.dataobject = inv_selectionattrib.is_dataobject
end if
end if
dw_1.of_SetBase (true)
dw_1.inv_base.of_Modify ("protect", "1", "column", "*", true)
// Determine whether to set a transaction object for the datawindow
if IsValid (inv_selectionattrib.itr_object) then
dw_1.of_SetTransObject (inv_selectionattrib.itr_object)
end if
// Retrieve the DataWindow if trans object is supplied
if IsValid (inv_selectionattrib.itr_object) then
dw_1.Retrieve (inv_selectionattrib.ia_argument[1], inv_selectionattrib.ia_argument[2], &
inv_selectionattrib.ia_argument[3], inv_selectionattrib.ia_argument[4], &
inv_selectionattrib.ia_argument[5], inv_selectionattrib.ia_argument[6], &
inv_selectionattrib.ia_argument[7], inv_selectionattrib.ia_argument[8], &
inv_selectionattrib.ia_argument[9], inv_selectionattrib.ia_argument[10], &
inv_selectionattrib.ia_argument[11], inv_selectionattrib.ia_argument[12], &
inv_selectionattrib.ia_argument[13], inv_selectionattrib.ia_argument[14], &
inv_selectionattrib.ia_argument[15], inv_selectionattrib.ia_argument[16], &
inv_selectionattrib.ia_argument[17], inv_selectionattrib.ia_argument[18], &
inv_selectionattrib.ia_argument[19], inv_selectionattrib.ia_argument[20])
// Populate the DataWindow from the data passed in if supplied
elseif UpperBound (inv_selectionattrib.ipo_data) > 0 then
dw_1.object.data = inv_selectionattrib.ipo_data
end if
ll_rowcount = dw_1.RowCount()
if ll_rowcount > 0 then
// Register controls for resize window service
of_SetResize (true)
inv_resize.of_Register (dw_1, inv_resize.SCALERIGHTBOTTOM)
inv_resize.of_Register (cb_ok, inv_resize.FIXEDRIGHTBOTTOM)
inv_resize.of_Register (cb_cancel, inv_resize.FIXEDRIGHTBOTTOM)
// Resize DW according to DW object passed in
ll_width = dw_1.inv_base.of_GetWidth()
ll_width = Min (ii_dwmaxwidth, ll_width)
if ll_width = ii_dwmaxwidth then
dw_1.hscrollbar = true
end if
ll_width = Max (ii_dwminwidth, ll_width)
ll_height = dw_1.inv_base.of_GetHeight()
ll_height = Min (ii_dwmaxheight, ll_height)
ll_height = Max (ii_dwminheight, ll_height)
Resize (this.width + (ll_width - dw_1.width), this.height + (ll_height - dw_1.height))
else
cb_ok.enabled = false
end if
end event