Strange in App build, and I do not found a solution

Hi all,

I add a new feature in a Project and it works fine (say so, I have to fine tune it a bit) while running it in the IDE (I do not recall if it worked in the stand-alone Application.).

I was using that application and wanted (needed) to execute it and… it does not works.

Not a problem, I left the application, fire Xojo 2015r1 and generate the application.

Quit Xojo, run the application, load the file and apply the new feature: IT DOES NOT WORKS !

A bit angry (and hungry, it is due time), I trashed and empty it the application, fire Xojo IDE, build the application, do not quit Xojo, but fire the application: the feature now works.

  1. Eureka !
  2. For those of you who eventually get strange things: trash the application and build a brand new one.

PS: of course, I checked the built date of the faultive application before all this mess (I had only one copy of that application).

El Capitan (latests updates applied)
Xojo 2015r1.
The feature: it check a user selected Column from a Listbox and made a report in a special Column of this very same Listbox. I get no report at first in the Stand -Alone while in the IDE the report was done. Then, OK.

Shut down, Boot some 20 minutes (by car) later (at a different location / WiFi) and bang !

The feature is no more there !

And I do not noticed any black cat walking across the street :slight_smile:

The operating system mix the things. It’s not your (or Xojo’s) fault.


I do not want to say “Yeah !” too fast, but it works now (why ? I do not know).

I have to add a global property and a way to change the “Monday” specific color, so I hope:

a. I will understand a why, reading the code (it may be my fault, after all), :wink:
b. will not “disconnect” the feature when adding code :frowning:

I found where in the code an error lie, but I cannot understand how it is possible:

[code] // a. Get a reference to the source Listbox…
LB = wMain.LB

// b. Get the number of Rows
RowCnt = LB.ListCount - 1
If RowCnt < 0 Then
MsgBox “Error: the list have no Row to test”
End If[/code]

Tests conditions:
same file, one loaded in the running application in the IDE: OK.
then, in the stand alone application: NOT OK.

I quit the first to read the code (a simple copy/paste of the reported error message to find the offending code).

So, ijn both code, I had 580 Rows, but the code failed telling there are none :frowning:

For the curious persons who want to know what I have before the code above: only DIM lines and comments.

The project size is 27.5MB (.xojo_binary_project)

Xojo 2015r1
El Capital (all updates) boot from internal SSD
Firefox running
WiFi Activated.

can a row count be < 0 ?

I would use

If RowCnt < 1 Then


If RowCnt = 0 Then

Thank you Axel.

I changed that (I was drinking a glass of hot chocolate with the code in front of me)… I suppose it is because of the use of -1, 0 or 1: I never know what I have to use, so sometimes I goof (sic).

No change.

BTW: the related code in CellBackgroundPaint was… half backed (recall something ?) and the color was too heavy. While I was there, I took the opportunity to modify that. Now it works fine. I only have to add a Preferences to change these four background colors values (with a nice UI).

I keep rereading this post because Emile’s posts are very difficult to understand. :slight_smile:

1/ Maybe in the compiled app two events are happening in a different order.
2/ Maybe the path to the file you are loading is relative to the app, so that in debug it is found, but in the compiled app it is not.
3/ Maybe you have implicit instantiation turned on, so one window opens the file and is OK, but the listbox check is failing in a Window1 which has NOT loaded the file.

[quote=379384:@Axel Schneider]can a row count be < 0 ?

I would use

If RowCnt < 1 Then


If RowCnt = 0 Then

< 0 is correct. If ListCount is 0, RowCnt will be -1.

Thanks Tim.

Tim: probably. And if the same code works differently, it cannot be that. I changed it because I think it is better looking to test against less than 1.

Thanks Jeff.

I apologyse for that. When I wrote it, it is (in my eyes) crystal clear. When I read the answers, sometimes it seems dark as a night without moon.

Sorry, none of the 3 cases.

More explanations:

I have a MenuItem to show a window.
That window allows the user to choose a Column (from a PopupMenu) ,
A click in a OK button execute the following:

Exit if the Listbox is empty (no Row)

Check the contents of the selected column (Dates as YYYY-MM-DD),
if the date is a Monday, write a flag in a Comments column.

The code shared is at the beginning of the Method called by the OK button.
When the application runs in the IDE, that works, else it left the Method with the MsgBox above.

Is it clear now ?

I would love to say yes, but no.
I think the issue is ‘why is the listbox empty?’

By the time the OK button is clicked, it is too late.
You shouldnt offer the popup if the listbox is empty.

That line might create a new window if implicit instantiation is turned on.
Where is the code happening?
If the code is part of the window (a menu handler?) change it to say

LB = self.LB

Thanks Jeff.

You are near. Yes, sometimes I have a brand new (and empty) window.

But, I activate the process only when I have populated the wMain.LB window’s Listbox.

In theory, when I made the tests, LB is never empty.

The code is in another window here to select the Date column (whatever its Column name is ~) where the OK button execute the involved test.

I may have to use a reference I will add in a Module like mLB = self.LB in the wMain generic window, then use it in that method.

I restate: actually, when I use it, the Listbox is never empty. That said, if the Listbox is empty and the code quits with the above message, it is OK.

Yes, I will have to write the whole once more (later).

Jeff: you get the good idea.

I changed my way to get the reference of wMain.LB.
In the MenuHandler, before asking to show the window where the code above resides, I fill a Listbox property with myLB = wMain.LB.

I replaced wMain.LB above by LB = myLB.

I built the stand alone, run it and it works. I just have to get it working after a shutdown / boot / back at home.

Seems to be my fault (my bug).


If one want to really understand (I hope), go there 51722 in Feedback and watch the partial screen shot with the two windows. The popup in the front window is populated from the Listbox (foreground window) Headings.