|
rbuttonup
|
|
Full name
|
pfc_u_dw.rbuttonup
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event rbuttonup(integer,integer,long,dwobject)
|
Name
|
Datatype
|
lb_desired
|
boolean
|
lb_editstyleattrib
|
boolean
|
lb_frame
|
boolean
|
lb_readonly
|
boolean
|
li_tabsequence
|
integer
|
ll_getrow
|
long
|
lm_dw
|
m_dw
|
lnv_conversion
|
n_cst_conversion
|
ls_colname
|
string
|
ls_currcolname
|
string
|
ls_editstyle
|
string
|
ls_expression
|
string
|
ls_protect
|
string
|
ls_type
|
string
|
ls_val
|
string
|
lw_childparent
|
window
|
lw_frame
|
window
|
lw_parent
|
window
|
lw_sheet
|
window
|
event rbuttonup;//////////////////////////////////////////////////////////////////////////////
// Event: rbuttonup
// Description: Popup menu
//////////////////////////////////////////////////////////////////////////////
// Rev. History Version
// 5.0 Initial version
// 5.0.04 Modified script to avoid 64K segment problem with 16bit machine code executables
// 6.0 Added DataWindow Property to the popup menu.
// 6.0 Added check for the new RowManager.of_GetRestoreRow() switch.
// 6.0.01 Added call to pfc_prermbmenuproperty to isolate calls to shared variable.
// 6.0.01 Corrected so that dwo.protect works properly for protect expressions.
//////////////////////////////////////////////////////////////////////////////
// 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.
//////////////////////////////////////////////////////////////////////////////
boolean lb_frame
boolean lb_desired
boolean lb_readonly
boolean lb_editstyleattrib
integer li_tabsequence
long ll_getrow
string ls_editstyle
string ls_val
string ls_protect
string ls_colname
string ls_currcolname
string ls_type
string ls_expression
n_cst_conversion lnv_conversion
m_dw lm_dw
window lw_parent
window lw_frame
window lw_sheet
window lw_childparent
// Determine if RMB popup menu should occur
if not ib_RMBmenu or IsNull (dwo) then return 1
// No RMB support for OLE objects and graphs
ls_type = dwo.Type
if ls_type = "ole" or ls_type = "tableblob" or ls_type = "graph" then return 1
// No RMB support for print preview mode
if this.Object.DataWindow.Print.Preview = "yes" then return 1
// Determine parent window for PointerX, PointerY offset
this.of_GetParentWindow (lw_parent)
if IsValid (lw_parent) then
// Get the MDI frame window if available
lw_frame = lw_parent
do while IsValid (lw_frame)
if lw_frame.windowtype = MDI! or lw_frame.windowtype = MDIHelp! then
lb_frame = true
exit
else
lw_frame = lw_frame.ParentWindow()
end if
loop
if lb_frame then
// If MDI frame window is available, use it as the reference point for the
// popup menu for sheets (windows opened with OpenSheet function) or child windows
if lw_parent.windowtype = Child! then
lw_parent = lw_frame
else
lw_sheet = lw_frame.GetFirstSheet()
if IsValid (lw_sheet) then
do
// Use frame reference for popup menu if the parentwindow is a sheet
if lw_sheet = lw_parent then
lw_parent = lw_frame
exit
end if
lw_sheet = lw_frame.GetNextSheet (lw_sheet)
loop until IsNull(lw_sheet) Or not IsValid (lw_sheet)
end if
end if
else
// SDI application. All windows except for child windows will use the parent
// window of the control as the reference point for the popmenu
if lw_parent.windowtype = Child! then
lw_childparent = lw_parent.ParentWindow()
if IsValid (lw_childparent) then
lw_parent = lw_childparent
end if
end if
end if
else
return 1
end if
// Create popup menu
lm_dw = create m_dw
lm_dw.of_SetParent (this)
//////////////////////////////////////////////////////////////////////////////
// Main popup menu operations
//////////////////////////////////////////////////////////////////////////////
ll_getrow = this.GetRow()
ls_val = this.Object.DataWindow.ReadOnly
lb_readonly = lnv_conversion.of_Boolean (ls_val)
choose case ls_type
case "datawindow", "column", "compute", "text", "report", &
"bitmap", "line", "ellipse", "rectangle", "roundrectangle"
// Row operations based on readonly status
lm_dw.m_table.m_insert.Enabled = not lb_readonly
lm_dw.m_table.m_addrow.Enabled = not lb_readonly
lm_dw.m_table.m_delete.Enabled = not lb_readonly
// Menu item enablement for current row
if not lb_readonly then
lb_desired = False
if ll_getrow > 0 then lb_desired = true
lm_dw.m_table.m_delete.Enabled = lb_desired
lm_dw.m_table.m_insert.Enabled = lb_desired
end if
case else
lm_dw.m_table.m_insert.Enabled = false
lm_dw.m_table.m_delete.Enabled = false
lm_dw.m_table.m_addrow.Enabled = false
end choose
// Get column properties
ls_currcolname = this.GetColumnName()
if ls_type = "column" then
ls_editstyle = dwo.Edit.Style
ls_colname = dwo.Name
ls_protect = dwo.Protect
if not IsNumber(ls_protect) then
// Since it is not a number, it must be an expression.
ls_expression = Right(ls_protect, Len(ls_protect) - Pos(ls_protect, "~t"))
ls_expression = "Evaluate(~""+ls_expression+","+String(row)+")"
ls_protect = this.Describe(ls_expression)
end if
ls_val = dwo.TabSequence
if IsNumber (ls_val) then
li_tabsequence = Integer (ls_val)
end if
end if
//////////////////////////////////////////////////////////////////////////////
// Transfer operations. Only enable for editable column edit styles
//////////////////////////////////////////////////////////////////////////////
lm_dw.m_table.m_copy.Enabled = false
lm_dw.m_table.m_cut.Enabled = false
lm_dw.m_table.m_paste.Enabled = false
lm_dw.m_table.m_selectall.Enabled = false
// Get the column/editystyle specific editable flag.
if ls_type = "column" and not lb_readonly then
choose case ls_editstyle
case "edit"
ls_val = dwo.Edit.DisplayOnly
case "editmask"
ls_val = dwo.EditMask.Readonly
case "ddlb"
ls_val = dwo.DDLB.AllowEdit
case "dddw"
ls_val = dwo.DDDW.AllowEdit
case else
ls_val = ""
end choose
lb_editstyleattrib = lnv_conversion.of_Boolean (ls_val)
if IsNull(lb_editstyleattrib) then lb_editstyleattrib = false
end if
if ls_type = "column" and not lb_readonly then
if dwo.BitmapName = "no" and ls_editstyle <> "checkbox" and ls_editstyle <> "radiobuttons" then
if Len (this.SelectedText()) > 0 and ll_getrow = row and ls_currcolname = ls_colname then
// Copy
lm_dw.m_table.m_copy.Enabled = true
// Cut
if li_tabsequence > 0 and ls_protect = "0" then
lb_desired = false
choose case ls_editstyle
case "edit", "editmask"
lb_desired = not lb_editstyleattrib
case "ddlb", "dddw"
lb_desired = lb_editstyleattrib
end choose
lm_dw.m_table.m_cut.Enabled = lb_desired
end if
end if
if li_tabsequence > 0 and ls_protect = "0" then
// Paste
if Len (ClipBoard()) > 0 then
lb_desired = false
choose case ls_editstyle
case "edit", "editmask"
lb_desired = not lb_editstyleattrib
case "ddlb", "dddw"
lb_desired = lb_editstyleattrib
end choose
lm_dw.m_table.m_paste.Enabled = lb_desired
end if
// Select All
if Len (this.GetText()) > 0 and ll_getrow = row and ls_currcolname = ls_colname then
choose case ls_editstyle
case "ddlb", "dddw"
lb_desired = lb_editstyleattrib
case else
lb_desired = true
end choose
lm_dw.m_table.m_selectall.Enabled = lb_desired
end if
end if
end if
end if
//////////////////////////////////////////////////////////////////////////////
// Services
//////////////////////////////////////////////////////////////////////////////
// Row Manager
if IsValid (inv_RowManager) then
// Undelete capability
if inv_RowManager.of_IsRestoreRow() then
lm_dw.m_table.m_restorerow.Visible = true
if this.DeletedCount() > 0 and not lb_readonly then
lm_dw.m_table.m_restorerow.Enabled = true
else
lm_dw.m_table.m_restorerow.Enabled = false
end if
end if
else
lm_dw.m_table.m_restorerow.Visible = false
lm_dw.m_table.m_restorerow.Enabled = false
end if
// QueryMode
// Default to false
lm_dw.m_table.m_operators.Visible = false
lm_dw.m_table.m_operators.Enabled = false
lm_dw.m_table.m_values.Visible = false
lm_dw.m_table.m_values.Enabled = false
lm_dw.m_table.m_dash12.Visible = false
if IsValid (inv_QueryMode) then
if inv_QueryMode.of_GetEnabled() then
// Do not allow undelete while in querymode
lm_dw.m_table.m_restorerow.Visible = false
lm_dw.m_table.m_restorerow.Enabled = false
// Default visible to true if in querymode
lm_dw.m_table.m_values.Visible = true
lm_dw.m_table.m_operators.Visible = true
lm_dw.m_table.m_dash12.Visible = true
if ls_type = "column" and not lb_readonly then
if dwo.bitmapname = "no" and ls_editstyle <> "checkbox" and ls_editstyle <> "radiobuttons" then
if li_tabsequence > 0 and ls_protect = "0" then
lb_desired = false
choose case ls_editstyle
case "edit", "editmask"
lb_desired = not lb_editstyleattrib
case "ddlb", "dddw"
lb_desired = lb_editstyleattrib
end choose
// Enablement based on column
lm_dw.m_table.m_values.Enabled = lb_desired
lm_dw.m_table.m_operators.Enabled = lb_desired
end if
end if
end if
end if
end if
// DataWindow property entries. (isolate calls to shared variable)
this.event pfc_prermbmenuproperty (lm_dw)
// Allow for any other changes to the popup menu before it opens
this.event pfc_prermbmenu (lm_dw)
// Send rbuttonup notification to row selection service
if IsValid (inv_RowSelect) then inv_RowSelect.event pfc_rbuttonup (xpos, ypos, row, dwo)
// Popup menu
lm_dw.m_table.PopMenu (lw_parent.PointerX() + 5, lw_parent.PointerY() + 10)
destroy lm_dw
return 1
end event