Why are new files I've created not showing their listboxes when reopened?

Feedback Case Number:

I’ve seemingly successfully refactored my project to API.2

My files open fine, showing 565 rows of data so far this year, and switching them to others properly shows their data.

When I create a new file, I enter an initial item successfully. Save while closing, reopen the file, and both listboxes show absolutely nothing, as though they are not appearing though they always have on files I’ve used for months.

How do I get these to appear in the new files I’m creating?

Thanks for any pointers to fix this. A lot of time and work went into this to see new files failing like this. May be I’m SOL and out of business with this. If this is not fixable, I’ve wasted a lot of time refactoring to API.2.

I’m happy with the accomplishment and existing customers are not having a ton of bug issues, but new customers will if i can’t learn why these listboxes are not showing on new files.

I checked my previous build (API.1) using current 2025.2 and new file with a single entry show fine when the file is reopened. Create the same with my refactored project, listboxes are not showing. Still, when I open my current year’s file, no bugs, everything visible and working.

Please help if you know about this. Thanks in advance for your generosity. Twenty four years developing and producing this work, for it to fall like this is disgraceful. There IS a solve, yes?

Without seeing your code, its hard to see what youre doing.
My gut instinct is that you are being conned by iCloud or Onedrive, but post some code, lets see the rabbit?

You have posted the same question two times, see Why are listboxes not showing rows of content? - General - Xojo Programming Forum

It’ hard for community members to help you if you have two threads with the sam question, some may post on thread 1 and ontehrs may post on thread 2.

If the problem is in the openFile method I wrote, that’s 588 lines of code. Not a rabbit.

The related saveFile method is equally as large.

The problem does not occur if my build is using API,1 listboxes. When I opened the new file created with my previous API.1 build, the sidebar listbox contents appeared appropriately, as did the entry in the check register listbox. When opening this file, I assume built with API.1 objects, using my API.2 build, it opens fine, even though the API.2 build is using API.2 listboxes.

On another note, one of my customers used a quote character in previous build. The file choked and threw an error opening with the API.2 build. Opened with the previous version to remove the quote character and the file opened fine. This may be related to SQLLite somehow. I was surprised to see it work with the API.1 build. Wish this little gem had not shown because many customers using my software may want to use the quote character to express “inches”.

Can I delete the one in the General area? I do not intend to post there anymore right now I have an Apple deadline and felt I need eyes to see whether anyone can respond to this and the quote character issue. Thx for all you’re doin’.

You can’t delete a thread, but as the creator you may close i8t. I can’t tell how since that can only be done by you - I don’t have that option displayed.

Lets call for help. @Alyssa_Foley , how can Charles close the other thread he created - the link is posted by me in another post here.

Thanks !

Thank You, Gilles.

First, I recommend breaking such a behemoth of a method into smaller methods. Then show us the part of your code where the error likely occurs, and we’ll be happy to help. But please don’t post 500+ lines of code.:slight_smile:

1 Like

Without code of some kind, its going to be hard to assist.
A listbox, whether API1 or API2, is not something that does file handling.
The problem is not the listbox, as long as you have an .addrow , the list will show what you feed it.

Around that .addrow line will be a loop.
You mentioned SQLLite, so although the title of this post says ‘new files…’ , I’m guessing what you mean is ‘new records in a database file I just created/populated’?

So breaking this down:

1/ What code do you use to create the new database file , and where do you save it?

You mention a user caused trouble by inserting a quote character. This is a common problem, and the correct solution is to use parameterised queries.
(See: SQL Injection )
So
2/ Can we see the line that does the adding of a row into the newly created database?

If it fails to pull back any data in API2, do you do any database error checking around your queries?
A SQL query could return no rows, or it could be a nil recordset.
so

3/ What error handling do you have in place, and do you have any db.error checks?

1 Like

May you can add breakpoints at the lines, where you add rows to the listbox and analyze why these a. are not reached at all or b. if there is a problem with the items you want to add.

Oh, and the number one cause of ‘I saved records and cant see them now’ is that the database file you read from is not the one you wrote to.

1 Like

Replying to Sascha, Jeff, and Thomas; collectively.

I’ve stepped through the code for three days now. It’s not the code. I was very diligent in refactoring. Everything from scratch, and the code brought each object at a time and immediately debugged before moving to the next.

I explain later that NONE OF THE DATA IS MISSING OR MISPLACED. Powers that be said their IDE was built to work with both APIs. Jeff, the data is there, it’s like the text color matches the background color, and I checked that also.

To make things worse, the problem appears global across the app, affecting all listboxes. These “reporting” listboxes are not displaying the data they glean from RAM. The data is present, accurately so, as I initiated a clean TEXT export (even though the information was not visible, only the telltale scroll bar button), and that imported fine, but the saved file was like the others, nothing visible.

I have a difficult time understanding why I’ve been saving from my API.2 build, for months, with zero openFile issues. Wish, now, I’d tested new file from scratch months ago. Is the new API.2 build been saving API.2 objects? or API.1 objects?, into the file it saves? Leaning toward it saving API.2 objects, how can this be an openfile issue when it opens files saved from app versions built with API.1 objects, and files, formerly using API.1 objects, saved with the API.2 build, continue to perform just fine; but not new virgin files made from start point A.?

Thanks for everything you all are contributing. Baffles me when every listbox is blank, yet contains the data it’s supposed to contain.

It can only be your code. How do you show the data in the listbox? Do you have AddRows with a simple text or do you paint your data? As far as I remember API 2 needs some different return true or return false in some event.

Can you do a minimal test with a simple listbox?

3 Likes

I tried a single account entered into an account chart window. Saved the file. Reopened it and the account chart was “blank.” I keyed the account number I had entered, and its title appeared in the related text field. The listbox never came alive to show the single account I added to the chart.

I learned a biggie, almost by accident today, related to true/false. API.1 directed menu items to be enabled = true or enabled=false; API.2 “auto” enables them by default until your code disables them if necessary.

The rows are “colorized” but the text is (b/w) Maybe I should disable Dark Mode. I discovered nthFileld is not zero based, it starts with 1, from the Documentation.

This is code written twenty years ago, pretty much. I did create an item class for the listobxes that held the seven major listboxes related to the individual bookkeeping journals. It holds a “populateJnl” method that each of the journal listboxes call to load data into them. This method loads 80% of the transaction data into the listboxes that call it (the rs variable is the RecordSet passed to it from the open file method calling it):

Var i as Integer
Var n as double
Var oneCell as string
Var d as new date
Var x as integer
x = LedgerWindow.lineNumber
// Loop until we reach the end of the RowSet
While Not rs.AfterLastRow
AddRow “”// add a new row to the listbox

// Loop through all of the fields in the RowSet
// and add the data to the correct column in the listbox
i=LastAddedRowIndex
d = rs.ColumnAt(0).DateValue
CellTextAt(i,0) = d.ShortDate
CellTextAt(i,1) = rs.ColumnAt(1).StringValue
CellTextAt(i,2) = rs.ColumnAt(2).StringValue
CellTextAt(i,3) = rs.ColumnAt(3).StringValue
if rs.ColumnAt(4).DoubleValue > 0 then
n = rs.ColumnAt(4).DoubleValue
CellTextAt(i,4) = format(n,“###########0.00;-###########0.00”)

end if
if rs.ColumnAt(5).DoubleValue > 0 then
n = rs.ColumnAt(5).DoubleValue
cellTextAt(i,5) = format(n,“###########0.00;-###########0.00”)
end if
CellCheckBoxValueAt(i,6) = rs.ColumnAt(6).BooleanValue
CellTextAt(i,6) = rs.ColumnAt(7).StringValue
CellTextAt(i,7) = rs.ColumnAt(8).StringValue
CellTextAt(i,8) = str(d.TotalSeconds)
if rs.ColumnAt(9).StringValue <> “0” then
CellTextAt(i,9) = rs.ColumnAt(9).StringValue
end if
if rs.ColumnCount>10 then
CellTextAt(i,10) = rs.ColumnAt(10).StringValue
end if
if rs.ColumnCount>11 then
CellTextAt(i,11) = rs.ColumnAt(11).StringValue
end if
if rs.ColumnCount>12 then
CellTextAt(i,12) = rs.ColumnAt(12).StringValue
end if
if rs.ColumnCount>13 then
CellTextAt(i,13) = rs.ColumnAt(13).StringValue
end if
rs.MoveToNextRow // move to the next record
Wend
LedgerWindow.lineNumber = x

You wrote it: “DarkMode”.

If you select all rows, you can see their contents, isnt’it ?

If you left dark mode and run, your data are here and VISIBLE…

Is the content in the debugger?
Select your listbox, the. Contents then text.
If there is content then the invisibility is the color of the text.

That seems (to me too) the answer…

It’s been hard to pick out what you are actually seeing among all the posts.
‘not showing their listboxes’ doesnt mean much.
‘both listboxes show absolutely nothing’ now appears to be misleading, since it implies ‘listboxes are empty’

Later you say
‘Jeff, the data is there, it’s like the text color matches the background color’

so there are rows.

As many have now said, it could mean that dark mode is the issue.
You could try turning this option off in the IDE

and/or you could try adding this to the celltextpaint / PaintCellText event for the listboxes:

g.DrawingColor = &cff0000

If color is the issue, this will make the text show up in Red.

Call Color.IsDarkMode to determine if the device is currently running in Dark Mode

2 Likes

Jeff, the debugger never screamed about foreColor. I changed all occurrences to DrawingColor. Enabling/Disabling DarkMode has no effect. The background color is displayed, I switched to default and it showed black, set it back to white.

I need to check Listbox.visible.

How do I select all the rows of a listbox?