Why won't my Xojo program compile on a Windows PC?

I’m a newbie at programming. My program, whose code I inherited, originally compiled correctly on both Macs and PCs. Now, it only runs on Macs, with an error message if I try to run it on a PC (I don’t regularly have access to a PC, unfortunately, so cannot check this myself except by what my PC friends tell me). I didn’t make any changes to Mac- or PC-specific calls. The FileTypes was changed, though, if that matters. Any idea what is going wrong? The program: https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project?dl=0

Have you tried to run it in debugger yourself, set to ‘break on exceptions’?
If you do that on a PC, it should stop on the error, and then you should get a good idea what the problem is.

It may use a file path or name that is not valid on PCs, for instance.

Thanks for the reply, Jeff. Unfortunately, I don’t have regular access to a PC. Also, how would I run it in debugger and set it to break on exceptions? I don’t even know what that the debugger is.

You’re getting a NilObjectException in app.EnableMenuItems.

If you add this code there is no exception:

  if ControlWindow <> Nil and ControlWindow.ListBox1 <> Nil then
    If ControlWindow.ListBox1.SelCount > 0 then
    End if
    If ControlWindow.ListBox1.SelCount < 7 then
    End if
  end if

Don’t add this code to what you already have in the event… replace what you have in the event.

Thanks so much, Johnny! How were you able to find the error? Did you use the “debugger” that Jeff talked about? If so, how do you go about using it? I will try this on a PC as soon as I’m able to. Thanks again. -Sam

I had the Xojo IDE set to break on exceptions. When I ran your app it immediately stop code execution where the problem is.
I think you can take out the ‘ControlWindow <> Nil’ part and you won’t get an exception.

If you’re new to Xojo you should read the Language Reference and Users Guide. You’ll be able to do a lot more after reading them and you’ve always got the fine help of everyone here on the forum.

Good Luck

When I had a friend just now run the program on a PC with your change in the code, she says the error message was gone, but she still wasn’t able to see the array of colored squares in the graphics window that you can see when it runs on a Mac: https://www.dropbox.com/s/96nrjap0zutmp2a/Mac%20screenshot.png?dl=0

If I take out the ‘ControlWindow <> Nil’ part, will everything resemble what it looks like on a Mac? Sorry, but I don’t have access myself to a PC.

The program: https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project?dl=0

Tell your friend to maximize the Main Window and then click ‘Start’ on the ‘ControlWindow’.

That should do it. It’s an MDI application and it’s doing all kinds of goofy stuff when the main window isn’t maximized.

If you want to support , develop and deploy this program, you will need access to a PC.
Even if you get a virtual machine to use.

The screen does draw as expected.
But the app has been set up as an MDI application: the graphics window is a child window and it wasn’t in a visible part of the MDI parent when I ran it.

There is a lot of poor coding practice in this app, and I see that the control window tells the app to update the graphics window.
Thats probably the worst part.
You will recall the advice in your other post about building an array of booleans, and having the graphics window paint is elf based on the contents of the array in the paint event?

The program needs to be redesigned.

For the moment, just untick the MDI option of the project.

Thanks, guys. I’m sorry, but where is the MDI option?

fyi I’m trying to get some professional (paid) help to redesign the program, but so far no takers.

The MDI switch is under Build Settings -> Windows.

you don’t need a PC to test the windows version.

Get VirtualBox from https://www.virtualbox.org

then go to this link https://www.modern.ie/en-us/virtualization-tools and click on VirtualBox for Mac and then download the Windows and IE you want and follow the instruction to install.