Control the Cut&Paste items in m_masterTag(s): PFC


[Edit menu item from w_master, Clicked event]

graphicobject   lgo_current_object
boolean         lb_text_selected = false
boolean         lb_can_modify_control = false
datawindow      ldw_current
editmask        lem_current
singlelineedit  lsle_current
multilineedit   lmle_current
dropdownlistbox lddlb_current
string          ls_columnname, ls_temp

m_master.m_edit.m_undo.enabled = false
m_master.m_edit.m_copy.enabled = false
m_master.m_edit.m_cut.enabled = false
m_master.m_edit.m_paste.enabled = false
m_master.m_edit.m_clear.enabled = false

lgo_current_object = GetFocus()
IF IsNull( lgo_current_object ) THEN RETURN

CHOOSE CASE lgo_current_object.TypeOf()
 CASE multilineedit!
  lmle_current = lgo_current_object
  m_master.m_edit.m_undo.enabled = lmle_current.CanUndo()
  lb_text_selected = lmle_current.SelectedLength() > 0
  lb_can_modify_control = NOT lmle_current.displayonly
 CASE editmask!
  lem_current  = lgo_current_object
  m_master.m_edit.m_undo.enabled = lem_current.CanUndo()
  lb_text_selected = lem_current.SelectedLength() > 0
  lb_can_modify_control = true
 CASE singlelineedit!
  lsle_current = lgo_current_object
  m_master.m_edit.m_undo.enabled = lsle_current.CanUndo()
  lb_text_selected = lsle_current.SelectedLength() > 0
  lb_can_modify_control = NOT lsle_current.displayonly 
 CASE DataWindow!
  ldw_current  = lgo_current_object
  m_master.m_edit.m_undo.enabled = ldw_current.CanUndo()
  lb_text_selected = ldw_current.SelectedLength() > 0
  ls_columnname = ldw_current.GetColumnName ()
  IF ls_columnname <> "" THEN
    ls_temp = ldw_current.Describe( ls_columnname + &
       ".edit.style")
    CHOOSE CASE ls_temp
    CASE "edit"
      ls_temp = ldw_current.Describe( ls_columnname + &
        ".edit.displayonly")
      lb_can_modify_control = (ls_temp = "no")
    CASE "ddlb", "dddw"
     ls_temp = ldw_current.Describe( ls_columnname + &
       "." + ls_temp + ".allowedit")
     lb_can_modify_control = ls_temp = "yes"
    CASE "editmask"
     lb_can_modify_control = true
    END CHOOSE
  END IF
 CASE DropDownListBox!
  lddlb_current  = lgo_current_object
  lb_text_selected = lddlb_current.SelectedLength() > 0
  lb_can_modify_control = lddlb_current.allowedit
END CHOOSE

IF lb_text_selected = true THEN
  m_master.m_edit.m_copy.enabled = true
  m_master.m_edit.m_cut.enabled = lb_can_modify_control
  m_master.m_edit.m_clear.enabled = lb_can_modify_control
ELSE
  m_master.m_edit.m_cut.enabled = false
  m_master.m_edit.m_copy.enabled = false
  m_master.m_edit.m_clear.enabled = false
END IF

m_master.m_edit.m_paste.enabled = Len( ClipBoard() ) > 0 AND &
   lb_can_modify_control

blog comments powered by Disqus