|
selectionchanged
|
|
Full name
|
pfc_w_filterextended.tab_1.selectionchanged
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event selectionchanged()
|
Name
|
Datatype
|
lb_radiobuttons
|
boolean
|
li_selectedrow
|
integer
|
ll_column
|
long
|
ll_editstyle
|
long
|
ll_end
|
long
|
ll_height
|
long
|
ll_pos
|
long
|
ll_start
|
long
|
ll_temp
|
long
|
lnv_string
|
n_cst_string
|
ls_col
|
string
|
ls_dbname
|
string
|
ls_editstyle
|
string
|
ls_errbuffer
|
string
|
ls_presentation
|
string
|
ls_replacesyntax
|
string
|
ls_sql
|
string
|
ls_syntax
|
string
|
ls_table
|
string
|
WHITE
|
string
|
event selectionchanged;//////////////////////////////////////////////////////////////////////////////
//
// Event: selectionchanged
//
// Description:
// Populate values DW for current column
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.03 Radiobutton and checkbox edit styles should only display data values
// 5.0.03 Do not display dropdown arrows, spin controls
//
//////////////////////////////////////////////////////////////////////////////
//
// 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"
boolean lb_radiobuttons
integer li_selectedrow
long ll_pos
long ll_temp
long ll_editstyle
long ll_start
long ll_end
long ll_height
long ll_column
string ls_col
string ls_presentation
string ls_syntax
string ls_errbuffer
string ls_dbname
string ls_table
string ls_sql
string ls_editstyle
string ls_replacesyntax
n_cst_string lnv_string
// Check for values tabpage
if newindex <> 4 then
return
end if
// Check for valid trans object before values can be populated
if not IsValid (inv_filterattrib.idw_dw.itr_object) or IsNull (inv_filterattrib.idw_dw.itr_object) then
return
end if
if not inv_filterattrib.idw_dw.itr_object.of_IsConnected() then
return
end if
// Populate values based on current column
li_selectedrow = this.tabpg_columns.dw_columns.GetSelectedRow (0)
if li_selectedrow > 0 then
ls_col = this.tabpg_columns.dw_columns.object.columnname[li_selectedrow]
if ls_col <> is_currentcolumn then
// Table and column
ls_dbname = this.tabpg_columns.dw_columns.object.db_name[li_selectedrow]
ll_pos = Pos (ls_dbname, ".")
ls_table = Left (ls_dbname, ll_pos - 1)
if ls_table = "" or ls_dbname = "" then
this.tabpg_values.dw_values.dataobject = ""
is_currentcolumn = ""
return
end if
// SQL
ls_sql = "select distinct " + ls_dbname + " from " + ls_table
// 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_filterattrib.idw_dw.itr_object.SyntaxFromSQL (ls_sql, ls_presentation, ls_errbuffer)
// Do not allow checkbox and radiobuttons edit styles (replace with edit editstyle)
ls_replacesyntax = " edit.limit=0 edit.autoselect=no edit.autohscroll=yes edit.autovscroll=no edit.focusrectangle=no "
ll_editstyle = Pos (ls_syntax, "checkbox.on=")
if ll_editstyle = 0 then
ll_editstyle = Pos (ls_syntax, "radiobuttons.columns=")
lb_radiobuttons = true
end if
if ll_editstyle > 0 then
ll_temp = Pos (ls_syntax, "width=")
if ll_temp > 0 then
// For radiobuttons - first modify the height of the column
if lb_radiobuttons then
ll_height = lnv_string.of_LastPos (ls_syntax, "height", ll_temp)
if ll_height > 0 then
ls_syntax = Left (ls_syntax, ll_height - 1) + ' height="61" ' + Mid (ls_syntax, ll_temp)
// Now modify the detail height
ll_height = Pos (ls_syntax, "detail(height=")
ll_column = Pos (ls_syntax, "column", ll_height)
if ll_height > 0 and ll_column > 0 then
ls_syntax = Left (ls_syntax, ll_height - 1) + ' detail(height=75) ' + Mid (ls_syntax, ll_column)
end if
ll_temp = Pos (ls_syntax, "width=")
end if
end if
// Now change radiobutton & checkbox edit styles to edit edit styles
ll_temp = Pos (ls_syntax, " ", ll_temp)
if ll_temp > 0 then
ll_start = ll_temp - 1
ll_temp = Pos (ls_syntax, "alignment=", ll_start)
if ll_temp > 0 then
ll_end = ll_temp - 1
ls_syntax = Left (ls_syntax, ll_start) + ls_replacesyntax + Mid (ls_syntax, ll_end)
end if
end if
end if
end if
if Len (ls_syntax) > 0 then
if this.tabpg_values.dw_values.Create (ls_syntax, ls_errbuffer) = 1 then
ls_editstyle = this.tabpg_values.dw_values.Describe ("#1.edit.style")
// DDDW & DDLB edit styles should not always display arrow for dropdown
if ls_editstyle = "dddw" or ls_editstyle = "ddlb" then
this.tabpg_values.dw_values.Modify ("#1." + ls_editstyle + ".UseAsBorder=no")
end if
// Editmasks should not show spin control
if ls_editstyle = "editmask" then
this.tabpg_values.dw_values.Modify ("#1.editmask.spin=no")
end if
this.tabpg_values.dw_values.SetSort ("#1 A")
this.tabpg_values.dw_values.Modify ("#1.protect=1")
this.tabpg_values.dw_values.SetTransObject (inv_filterattrib.idw_dw.itr_object)
this.tabpg_values.dw_values.Retrieve()
is_currentcolumn = ls_col
end if
else
this.tabpg_values.dw_values.dataobject = ""
is_currentcolumn = ""
end if
end if
else
this.tabpg_values.dw_values.dataobject = ""
is_currentcolumn = ""
end if
end event
Name
|
Owner
|
datawindow.create |
datawindow
|
datawindow.describe |
datawindow
|
datawindow.getselectedrow |
datawindow
|
datawindow.modify |
datawindow
|
datawindow.retrieve |
datawindow
|
datawindow.setsort |
datawindow
|
datawindow.settransobject |
datawindow
|
transaction.syntaxfromsql |
transaction
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.mid |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
pfc_n_cst_string.of_lastpos |
pfc_n_cst_string
|
pfc_n_tr.of_IsConnected |
pfc_n_tr
|