Many questions about Xojo

Hello,

I’m programming with Xojo for a couple of months now, and I would consider myself not a beginner anymore. During the time, from the beginning with Xojo until today, I discovered that more sophisticated questions pop up while I code my software.

Not only questions about programming, but also questions concerning the Xojo IDE itself and especially Xojo-specific programming concepts.

It would be a great help, if someone could answer my questions. I don’t expect very long answers to each question. A short hint, a reference link or short explanation is totally enough.

  1. Does a portable Xojo compiler as CLI binary file exist? Where can I find it?
  2. If there is no compiler binary, can I compile Xojo source code out of my own application?
  3. If question 1 and 2 are answered negative, how can I compile source code out of my own application?
  4. How can I protect my software against reverse engineering or decompiling?
  5. There are many ways to implement a licensing system, which one do you recommend? And which one do you consider as safest?
  6. Is there an IDE extension similar to Copilot from GitHub for Xojo?
  7. Where can I find IDE extensions for Xojo?
  8. Programs that I compile for Windows usually come with a lot of separate .DLL files. Is there a way to put all the .DLL files somehow in an executable file?
  9. In which case would I use remote debug hosts and for what?
  10. When would I use a Timer or Threads? Can you give me an example? And what is a Semaphore?
  11. When would I use a Worker? Could you give me an example use case?
  12. For what can I use the class XojoScript? What is the use case?
  13. What are delegates? For what can I use them?
  14. Can you give me an use case for IPCSocket?
  15. When do I use MemoryBlocks? Can you give me a use case?
  16. How can I programatically take a screenshot?
  17. What is Insert → Report? And for what can I use it?
  18. What are Do’s and Dont’s in Xojo?

Thank you :slightly_smiling_face:

1 Like

There is no separate compiler, Xojo is a bundle and they have no intention to change that.

No, you need the IDE

Using another tool :upside_down_face:

Using encription and obfuscation in your code are the most used

Online licensing, generating a unique Hardware ID.

NO

The IDE is way to limited and closed to make those. The closest thing is https://documentation.xojo.com/topics/build_automation/ide_scripting/introduction.html

You can with 3rd party software, but this make your app slow to launch and other problems. It is better is you make an installer, for example with inno setup

To debug an app in a different desktop from the one you are developping. this is helpfull for example when compiling for a different OS

3 Likes

My app works for macOS (intel and ARM), Win7/Win10, Linux Mint, and Raspberry Pi.

In the case of Windows and Linux, I run these inside VMs on my Mac. I reach those VMs using remote debugging. Same for the Pi, except I use real hardware there.

My app (an email client) has lots of threads and timers in it, so the user can look at mail and do other things while email downloads.

You are ignoring Xojoscript. This isn’t completely true - yes it’s not possible to compile a new application from within one you create, but you can load and run Xojo code with Xojoscript

The easiest way for compiling is to use the IDE Communicator. The project is in the examples. I use it to make apps, helper apps and a dmg or pkg for 4 different app versions.

I have been using LimeLM LimeLM: Licensing, online activation, floating license protection for software

It supports Xojo, and works for my desktop apps

Problem with current coding is, you can no longer alter the GUI elements from within a thread directly.
That is, Textfield.text=“Write this” no longer works from inside a thread.
Instead of, the Thread needs to alter a variable, app.ToWriteThisString = “Write this”,
and the Timer reads this variable recurrent. Within the Timer, the code is
Textfield.Text=app.ToWriteThisString

1 Like

You have to use timers/threads to make a modern interface. Progress bars are needed for tasks that take longer. For which you need a thread which makes nice spaghetti code. Sending emails for instance also needs a thread.

With a thread you can use ThreadSafeMBS methods from MBS to make a bit less spaghetti. Just don’t use a global variable if you don’t use the ThreadSafeMBS methods.

Note it’s not Xojo’s fault, as altering the GUI from threads isn’t supported by operating systems.
It used to be that it would work on certain cases, but that was just coincidences.
And I’ve seen odd behaviours. like entire white windows, because of trying to do UI things from threads; debugging that wasn’t straightforward.

And this is not the way to do it.

@Beatrix_Willius Please explain more. What exactly is this?

Ok, but how? I asked this question before and nobody wanted to respond to that question. Is it illegal to secure your OWN code from RE/cracking?

Well, there are LOTS of threads in this forum about that. try the Search function with things like obfuscation, encription, hack, decompile erc. Then if you have a specific question, create another thread for that.

With IDE scripting it’s possible to copy files, add codesign etc. The IDE communicator can open, build and save multiple apps. I can change values like the Bundle ID, the architecture, the version.

Here is the start of my IDE communicator script:

dim MaxVersion as String = "0"
if MaxVersion = "" then MaxVersion = "0"

dim MajorVersion as string = "6"
dim MinorVersion as String = "2"
dim BugVersion as String = "0"
dim BetaVersion as String = "b1"

dim theCommand, theResult as string
dim userHome as String = DoShellCommand("echo $HOME")
userHome = Trim(ShellEncode(userHome))

dim Architecture as integer = 16
'9 universal
'16 intel
'24 arm

dim basePath as string = userHome + "/Documents/Development/Mail\ Archiver/"

'delete old apps and dmg
theCommand = "osascript " + basePath + "code\ current/ide\ communicator/delete\ old\ builds.scpt"
theResult = DoShellCommand(theCommand)

'scheduler: : only for normal, pro and pro admin
if MaxVersion = "0" or MaxVersion = "1" or MaxVersion = "3" then
	openfile(basePath + "code\ current/max\ scheduler.xojo_xml_project")
	ConstantValue("App.kMaxVersion") = MaxVersion
	if ConstantValue("App.kMaxVersion") = "0" then
		PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverx-helper"
		PropertyValue("App.MacOSXAppName") = "Mail Archiver X Scheduler"
	elseif ConstantValue("App.kMaxVersion") = "1" then
		PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverxpro-helper"
		PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro Scheduler"
	elseif ConstantValue("App.kMaxVersion") = "3" then
		PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverxproadmin-helper"
		PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro Admin Scheduler"
	else
		print ConstantValue("App.kMaxVersion")
	end if
	makeVersion(MajorVersion, MinorVersion, BugVersion, BetaVersion)
	if BuildApp(Architecture) = "" then
		return
	else
		DoCommand "SaveFile"
		DoCommand("CloseWindow")
	end if
end if
1 Like

You can check Arbed as alternative editor for Xojo projects. it can obfuscate code.

There are various utilities to zip your app and make a self running zip as exe file. So your app expands itself to temp folder and runs from there.

PS: Too many questions in one posting. Better make a dozen topics asking for 1 or 2 questions.

1 Like

Hi Alexander, to see examples on the use of Timer, Thread and Worker, search the forum topic “Looking for unique number of Base X” and download the attached examples.
Greetings

1 Like

You’re right, meanwhile, there is a different way to do stuff like this.
But I forgot, so to read up on this topic again, could you please point me to?

Try:

https://documentation.xojo.com/api/language/thread.html#thread-userinterfaceupdate

1 Like

For anyone who wants to know when you should/could use threads.

For example:

  • Asynchronous operations
  • Operations that can be parallelized
  • Continual running background operations
1 Like

Ah, thanks. :slight_smile: