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.
Eureka !
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.
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.
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.
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.
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
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 windows 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).
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).
THANKS !
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.