Lock on source

In Xojo it is possible to set a lock on a control.
This prevents the control from being moved, deleted, etc.

Many times I want to prevent created classes, methods, etc from unintentional changes.
It is possible to encrypt the class, but that makes the source unreadable.

My idea is that adding the possibility to lock a class, method, etc. will be a nice way of preventing unintentional changes and at the same time keeps the source readable.

How do you think about this idea?
Do you think that locking classes, methods, etc. should be added to Xojo?


Good idea Paul, that would be a very usefull addition to the Xojo IDE.

Not to discount your request, but version control will do this for you. In your changed file list, if you notice something changed which you didn’t want, you can do something about it, such as reverting that one file.

You are right @Thom McGrath , but since we also have an option to lock controls on a form in order not to move them accidentally, it would be handy to have this option in the navigator too.
Second, when you change some code accidentally and check in afterwards several times since you did not notice the change at all, it can be hard to find the point where it went wrong for the first time. Just a simple feature in the IDE could prevent this misery for you.

Right. I didn’t mean to suggest the request has no merit, just offering some assistance in the meantime.

I fell insecure when I am in XOjo IDE too.

And not everyone uses a version control system.

They should

Couldn’t agree more. Besides addressing the issue above, it removes the insecurity we get sometimes when making bold changes to the code. Before I start on a big code change I just make sure I have all code changes checked into Source Control. Then I can go at the project harder, knowing no matter had badly it goes, I am one click away from rewinding a file or all files back to that point. Yes, backing up your project to another location can accomplish that as well, but it is SO much easier to do in Source Control. And finally, with source control it is very easy to DIFF your current version with any previous version to see where you might have introduced some problem, even weeks before.

With all the free options for Source Control, I have no idea why anyone would not use it. Takes 5 seconds to setup a repository. I use a local Source Control (TortoiseHG on Windows) and my backup service keeps it backed up. But many use online versions such as GitHub.

We are using version control.
But as mentioned by Joost, it is possible to make an unintentional change that isn’t noticed immediately.
Once the mistake is noticed, it can take a lot of searching in older versions to reverse the unintentional change.
That’s why we came up with the idea to make locking of classes, methods, etc. possible.

I was sure you were, just throwing my 2 cents in for people that are afraid to make the jump. Your suggestion is a good one.


select the class file in the finder
set it to be LOCKED
it should open in the IDE as read only

Hah neat.

I’m and advocate of “use what already exists” where it does exactly what you want :stuck_out_tongue:

though I’d still say use version control EVEN if you are a lone developer
Merv’s right about “if I have version control I can make enormous changes and know I can always go back to the last good state”
You can be much bolder since there’s always a safety net

[quote=294044:@Norman Palardy]select the class file in the finder
set it to be LOCKED
it should open in the IDE as read only[/quote]
Ok, that’s a possibility.

This is only posible when a project is saved as Xojo Project and not when saved as Xojo binary project and Xojo XML project.

When a class is locked in OS X/MacOS, I still can save it in Windows
When I set the class to Readonly in Windows, I still can save it in Windows.
I need to adjust the rights to disable adjustments. That’s not a friendly way to do in Windows.
I have done that by disabling the right to Write for all users.
Opened the project and I still can save changes in the class (?!?!?! Why?).
The point is that, when developing on multiple platforms, the lock needs to be set on every platform separately.

I can’t see in the IDE when a class is locked.
Changes can also be made, but an error is shown (in OS X/macOS) when I try to save the project.
(Unable to save file. Error code:-45)
Now I still have to figure out in which Class(es) the unintentional change was made.

Having the possibility to lock a class, method, etc. in the IDE makes it interchangeable between OS X/macOS, Windows and Linux.
By showing a little padlock at the locked classes, methods, etc. makes the it clear to developers which classes, methods, etc. are locked.

[quote=294075:@Paul Sondervan]1.This is only posible when a project is saved as Xojo Project and not when saved as Xojo binary project and Xojo XML project.
Which means you can or should be using version control which I’d encourage event for a developer working on his own

Use version control - that’s clearly stated and very true.
But the request was for a IDE feature, to make visible what’s locked and what not. Since there are rumors about a new IDE design, this feature might be put on the ‘nice to have’ list.

Thats called a feature request (for both)
Add them to the pile