Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Opening a file as Readonly (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Keeping editable cell selected in ListBox with another window on top
Next thread: Cloning objects inside of objects


RB Database   -   tom.russell transport.alstom.com
  Opening a file as Readonly   -   Lennox Jacob
   Re: Opening a file as Readonly   -   Christian Schmitz
    Re: Opening a file as Readonly   -   Lennox Jacob
     Re: Opening a file as Readonly   -   Michael Rebar
      Re: Opening a file as Readonly   -   Lennox Jacob
       Re: Opening a file as Readonly   -   Michael Rebar
        Re: Opening a file as Readonly   -   Lennox Jacob
         Re: Opening a file as Readonly   -   Christian Schmitz

Opening a file as Readonly
Date: 12.02.06 16:12 (Sun, 12 Feb 2006 07:12:09 -0800 (PST))
From: Lennox Jacob
Hello,
How can I save a file to be readonly when it is opened.

Do I have to put
Control1.Readonly = true
for each and every control or is there a single line of code that can be used?

I tried w.OpenAsReadOnly
where w is the window to be opened but that did not work.

Thanks.

Lennox.

---------------------------------

What are the most popular cars? Find out at Yahoo! Autos
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Opening a file as Readonly
Date: 12.02.06 18:05 (Sun, 12 Feb 2006 18:05:27 +0100)
From: Christian Schmitz
Lennox Jacob <<email address removed>> wrote:

> Hello,
> How can I save a file to be readonly when it is opened.

How do you save it?

mfg
Christian

Re: Opening a file as Readonly
Date: 12.02.06 18:19 (Sun, 12 Feb 2006 09:19:08 -0800 (PST))
From: Lennox Jacob
I save it like this

Dim file As FolderItem
Dim fileStream As TextOutputStream

If Document = Nil then
#If TargetWin32 //if on Windows
file=GetSaveFolderItem("PrintEx",(FirstName.Text))
'file=GetSaveFolderItem("PrintEx",(FirstName.Text + " " )) Win32 don't like this
#else
file=GetSaveFolderItem("text",(FirstName.Text + " " ))
#Endif

If file <> Nil then //if the user clicked Save
Titleðle.Name //window Title gets document name
Documentðle //window property gets folderitem
End if
End if

If Document <> Nil then
fileStreamðle.AppendToTextFile
fileStream.WriteLine EditField1.text
fileStream.WriteLine EditField2.text

.
.
.
.
fileStream.WriteLine EditField200.text
fileStream.Close
TextHasChangedúlse
self.refresh
End if

if file = nil then return

fileStreamðle.CreateTextFile
fileStream.WriteLine EditField1.text
fileStream.WriteLine EditField2.text
fileStreamðle.AppendToTextFile
fileStream.WriteLine EditField1.text
fileStream.WriteLine EditField2.text

.
.
.
.
fileStream.WriteLine EditField200.text
fileStream.Close
TextHasChangedúlse

Christian Schmitz <<email address removed>> wrote: Lennox Jacob wrote:

> Hello,
> How can I save a file to be readonly when it is opened.

How do you save it?

mfg
Christian

--
Arou

Re: Opening a file as Readonly
Date: 12.02.06 19:03 (Sun, 12 Feb 2006 10:03:47 -0800)
From: Michael Rebar
On 2/12/06 9:19 AM, "Lennox Jacob" <<email address removed>> wrote:

> I save it like this
>
> Dim file As FolderItem
> Dim fileStream As TextOutputStream
>
> If Document = Nil then
> #If TargetWin32 //if on Windows
> file=GetSaveFolderItem("PrintEx",(FirstName.Text))
> 'file=GetSaveFolderItem("PrintEx",(FirstName.Text + " " )) Win32 don't
> like this
> #else
> file=GetSaveFolderItem("text",(FirstName.Text + " " ))
> #Endif
>
> If file <> Nil then //if the user clicked Save
> Titleðle.Name //window Title gets document name
> Documentðle //window property gets folderitem
> End if
> End if
>
> If Document <> Nil then
> fileStreamðle.AppendToTextFile
> fileStream.WriteLine EditField1.text
> fileStream.WriteLine EditField2.text
>
> .
> .
> .
> .
> fileStream.WriteLine EditField200.text
> fileStream.Close
> TextHasChangedúlse
> self.refresh
> End if
>
> if file = nil then return
>
> fileStreamðle.CreateTextFile
> fileStream.WriteLine EditField1.text
> fileStream.WriteLine EditField2.text
> fileStreamðle.AppendToTextFile
> fileStream.WriteLine EditField1.text
> fileStream.WriteLine EditField2.text
>
> .
> .
> .
> .
> fileStream.WriteLine EditField200.text
> fileStream.Close
> TextHasChangedúlse

After your filestream.Close

Add... file.Locked = True

Michael

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Opening a file as Readonly
Date: 12.02.06 20:12 (Sun, 12 Feb 2006 11:12:02 -0800 (PST))
From: Lennox Jacob
Thanks Michael,
But could that be done without the user having access to unlock it via the Get Info?
Lennox.

Michael Rebar <<email address removed>> wrote:

Add... file.Locked = True

Michael

_______________________________________________
Unsubscribe or switch delivery mode:

Search the archives of this list here:



---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Opening a file as Readonly
Date: 12.02.06 20:49 (Sun, 12 Feb 2006 11:49:10 -0800)
From: Michael Rebar
On 2/12/06 11:12 AM, "Lennox Jacob" <<email address removed>> wrote:

> Thanks Michael,
> But could that be done without the user having access to unlock it via the Get
> Info?
> Lennox.
>
> Michael Rebar <<email address removed>> wrote:
>
> Add... file.Locked = True
>
> Michael

Hmm...technically, yes, but you'd need greater privs than the user. Someone
would have to grant you those rights on the machine.

What are you trying to accomplish?

Michael

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Opening a file as Readonly
Date: 12.02.06 21:15 (Sun, 12 Feb 2006 12:15:44 -0800 (PST))
From: Lennox Jacob

OK Michael,
I am writing a program which will generate patient records, so that once the file has been saved, the user should not be able to reopen the file and alter it. Granted they can still use SaveAs, alter it then save it again but the creation date and modified date would not be the original... unless they reverse the clock...
Lennox.

Hmm...technically, yes, but you'd need greater privs than the user. Someone
would have to grant you those rights on the machine.

What are you trying to accomplish?

Michael

_______________________________________________
Unsubscribe or switch delivery mode:

Search the archives of this list here:



---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Opening a file as Readonly
Date: 13.02.06 22:43 (Mon, 13 Feb 2006 22:43:44 +0100)
From: Christian Schmitz
Lennox Jacob <<email address removed>> wrote:

> OK Michael,
> I am writing a program which will generate patient records, so that once
> the file has been saved, the user should not be able to reopen the file
> and alter it. Granted they can still use SaveAs, alter it then save it
> again but the creation date and modified date would not be the original...
> unless they reverse the clock...

Encrypt the file with a password the application knows, but no the
user!?

Mfg
Christian