|
of_opendocument
|
|
Full name
|
pfc_u_rte.of_opendocument
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_opendocument(ref string)
|
Name
|
Datatype
|
li_save
|
integer
|
li_val
|
integer
|
ls_docname
|
string
|
ls_filename
|
string
|
ls_title
|
string
|
public function integer of_opendocument (ref string as_filename);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_OpenDocument
//
// Access: public
//
// Arguments:
// as_filename string that will hold filename user selected, also a default filename
//
// Returns: integer
// 1 = success
// 0 = User cancelled from FileOpen dialog
// -1 = error
//
// Description:
// This function prompts the user to choose a file to open, then
// it inserts the document into the RTE, clearing any previous text.
// User will be prompted to save changes to old document if necessary.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
integer li_val
integer li_save
string ls_filename
string ls_title
string ls_docname
if GetFileOpenName ("Open", as_filename, ls_filename, "", &
"Rich Text Format (RTF),*.rtf,Text Document,*.txt,All Files,*.*") = 1 then
// Check to see if old document needs to be saved
if modified then
ls_title = gnv_app.iapp_object.displayname
if IsNull (ls_title) or Len (ls_title) = 0 then
ls_title = "Save"
end if
ls_docname = is_filename
if Len (ls_docname) = 0 then
ls_docname = "Document"
end if
li_val = of_MessageBox ("pfc_savechanges", ls_title, &
"Save changes to " + ls_docname + "?", exclamation!, yesnocancel!, 1)
if li_val = 1 then
li_save = this.event pfc_save()
if li_save < 0 then
return -1
end if
else
if li_val = 3 then
return 0
end if
end if
end if
if InsertDocument (as_filename, true) = 1 then
is_filename = as_filename
return 1
else
return -1
end if
else
return 0
end if
end function
Name
|
Owner
|
richtextedit.insertdocument |
richtextedit
|
systemfunctions.getfileopenname |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
pfc_u_rte.of_messagebox |
pfc_u_rte
|
pfc_u_rte.pfc_save |
pfc_u_rte
|