HA$PBExportHeader$pfc_u_sle.sru $PBExportComments$PFC SingleLineEdit class forward global type pfc_u_sle from singlelineedit end type end forward global type pfc_u_sle from singlelineedit integer width = 453 integer height = 77 integer taborder = 1 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 long backcolor = 1090519039 boolean autohscroll = false borderstyle borderstyle = stylelowered! event type integer pfc_cut ( ) event type integer pfc_copy ( ) event type integer pfc_paste ( ) event type integer pfc_undo ( ) event type integer pfc_clear ( ) event type integer pfc_selectall ( ) event pfc_prermbmenu ( ref m_edit am_edit ) event rbuttonup pbm_rbuttonup event contextmenu pbm_contextmenu end type global pfc_u_sle pfc_u_sle type variables Protected: boolean ib_autoselect boolean ib_rmbmenu = true end variables forward prototypes public function integer of_getparentwindow (ref window aw_parent) protected function integer of_messagebox (string as_id, string as_title, string as_text, icon ae_icon, button ae_button, integer ai_default) end prototypes event pfc_cut;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_cut // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript Cut function) // // Description: Cut the text to the clipboard. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// Return this.Cut() end event event pfc_copy;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_copy // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript Copy function) // // Description: Copy the text to the clipboard. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// Return this.Copy() end event event pfc_paste;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_paste // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript Paste function) // // Description: Paste the text from the clipboard. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// Return this.Paste() end event event pfc_undo;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_undo // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript Undo function. // 0 if there is nothing to undo.) // // Description: Cancels the last edit, restoring the text to the content // before the last change. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// if this.CanUndo() then Return this.Undo() end if Return 0 end event event pfc_clear;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_clear // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript Clear function) // // Description: Clear Text (no clipboard) functionality // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// Return this.Clear() end event event pfc_selectall;////////////////////////////////////////////////////////////////////////////// // // Event: pfc_selectall // // (Arguments: None) // // (Returns: integer // Return value from the PowerScript SelectText function) // // Description: Select all the text. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// // Select all text Return this.SelectText (1, Len (this.text)) end event event rbuttonup;////////////////////////////////////////////////////////////////////////////// // Event: rbuttonup // Description: ////////////////////////////////////////////////////////////////////////////// // Rev. History Version // 5.0 Initial version // 8.0 Moved existing code for PopUp menu to new contextmenu event ////////////////////////////////////////////////////////////////////////////// /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ ////////////////////////////////////////////////////////////////////////////// Return 1 end event event contextmenu;////////////////////////////////////////////////////////////////////////////// // Event: contextmenu // Description: Popup menu ////////////////////////////////////////////////////////////////////////////// // Rev. History Version // 8.0 Initial version ////////////////////////////////////////////////////////////////////////////// /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ ////////////////////////////////////////////////////////////////////////////// boolean lb_frame m_edit lm_edit window lw_parent window lw_frame window lw_sheet window lw_childparent // Determine if RMB popup menu should occur if not ib_rmbmenu then return 1 end if // 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_edit = create m_edit lm_edit.of_SetParent (this) // Enable menu items if appropriate lm_edit.m_edititem.m_copy.enabled = false lm_edit.m_edititem.m_cut.enabled = false if Len (this.SelectedText()) > 0 then lm_edit.m_edititem.m_copy.enabled = true if not this.displayonly then lm_edit.m_edititem.m_cut.enabled = true end if end if if Len (ClipBoard()) > 0 and not this.displayonly then lm_edit.m_edititem.m_paste.enabled = true else lm_edit.m_edititem.m_paste.enabled = false end if if Len (this.text) > 0 then lm_edit.m_edititem.m_selectall.enabled = true else lm_edit.m_edititem.m_selectall.enabled = false end if this.event pfc_prermbmenu (lm_edit) lm_edit.m_edititem.PopMenu (lw_parent.PointerX() + 5, lw_parent.PointerY() + 10) destroy lm_edit return 1 end event public function integer of_getparentwindow (ref window aw_parent);////////////////////////////////////////////////////////////////////////////// // // Function: of_GetParentWindow // // Access: public // // Arguments: // aw_parent The Parent window for this object (passed by reference). // If a parent window is not found, aw_parent is NULL // // Returns: integer // 1 = success // -1 = error // // Description: Calculates the parent window of a window object // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// powerobject lpo_parent lpo_parent = this.GetParent() // Loop getting the parent of the object until it is of type window! do while IsValid (lpo_parent) if lpo_parent.TypeOf() <> window! then lpo_parent = lpo_parent.GetParent() else exit end if loop if IsNull(lpo_parent) Or not IsValid (lpo_parent) then setnull(aw_parent) return -1 end If aw_parent = lpo_parent return 1 end function protected function integer of_messagebox (string as_id, string as_title, string as_text, icon ae_icon, button ae_button, integer ai_default);////////////////////////////////////////////////////////////////////////////// // // Function: of_MessageBox // // Access: protected // // Arguments: // as_id An ID for the Message. // as_title Text for title bar // as_text Text for the actual message. // ae_icon The icon you want to display on the MessageBox. // ae_button Set of CommandButtons you want to display on the MessageBox. // ai_default The default button. // // Returns: integer // Return value of the MessageBox. // // Description: // Display a PowerScript MessageBox. // Allow PFC MessageBoxes to be manipulated prior to their actual display. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 6.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// Return MessageBox(as_title, as_text, ae_icon, ae_button, ai_default) end function event getfocus;////////////////////////////////////////////////////////////////////////////// // // Event: getfocus // // (Arguments: None) // // (Returns: None) // // Description: If appropriate, notify the parent window that this // control got focus. // ////////////////////////////////////////////////////////////////////////////// // // Revision History // // Version // 5.0 Initial version // ////////////////////////////////////////////////////////////////////////////// // /* * Open Source PowerBuilder Foundation Class Libraries * * Copyright (c) 2004-2005, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted in accordance with the GNU Lesser General * Public License Version 2.1, February 1999 * * http://www.gnu.org/copyleft/lesser.html * * ==================================================================== * * This software consists of voluntary contributions made by many * individuals and was originally based on software copyright (c) * 1996-2004 Sybase, Inc. http://www.sybase.com. For more * information on the Open Source PowerBuilder Foundation Class * Libraries see http://pfc.codexchange.sybase.com */ // ////////////////////////////////////////////////////////////////////////////// window lw_parent //Check for microhelp requirements. If gnv_app.of_GetMicrohelp() Then //Notify the parent. of_GetParentWindow(lw_parent) If IsValid(lw_parent) Then lw_parent.Dynamic Event pfc_ControlGotFocus (this) End If End If //If appropriate, select the entire text. if ib_autoselect then this.Post Event pfc_selectall () end if end event
File: pfc_u_sle.sru
Size: 20460
Date: Sat, 23 Mar 2013 16:23:04 +0100
Size: 20460
Date: Sat, 23 Mar 2013 16:23:04 +0100
- singlelineedit pfc_u_sle(sru)