Updated method for refreshing WebListBox

In my app, I have a WebListBox which shows accounts and descriptions. To edit an item in the list, I click a button and a WebDialogBox opens which is populated with the proper data. But when I change the data and update the database (MySQL) the WebListBox showing the selected account/line is not refreshed.

I have looked through comments here and found discussions from a couple years ago but they do not seem to be updated as some of the properties are no longer available…like listbox.Cell(,) for example.

You can probably envision what I am trying to do. It’s pretty basic. I am thinking that someone has accomplished this already so, any help would be greatly appreciated!

Oh, you can probably guess… adding and deleting accounts is next on my to-do list so any thoughts on making WebListBox lines appear and disappear would be great!

Thanks!

Paul

(Xojo 2023r2 - Win 11)

Are you saying that updating the WebListbox cell is not displaying or are you expecting it to automatically update? The later does not happen, you must update the cell yourself.

I am trying to update the WebListBox cells myself but, they are not refreshing. I have the current row index stored (currow) and that seems to be accurate.

This is what I am executing in code:

WebPage11.ListBox1.CellTextAt(currow,2) = TextField2.Text

No error, just not updating/refreshing in the list.

Thanks for clarifying. That sounds like a bug, but I am not seeing the behavior you describe using a simple project: Test Project

Yeah… it should be that simple. Let me marinade on this for just a bit.

Thanks, Tim! :slight_smile:

Hey TIm,

Here was my problem. I was pulling initial values from the database rowset, showing the edit screen, replacing the database values with what was on screen and updating the weblistbox with the rowset value again … well, you know that just isn’t going to work. :smile:

Thanks again! The example you provided was clear and helpful. :slight_smile:

I am trying to do almost the same thing and is not working for me. I am displaying a Weblistbox and when I doubleclick on a row, I am deleting that row from a SQLlite database. I then empty the weblistbox and reload but I don’t see the change on the screen until I get out of that page and go back to it or manually refresh the page. Any way to refresh that page after I delete the row?

not the answer to your question, but IMHO double clic to delete something is not very user friendly… and can make mistakes easy too.
you should clic to multi select the items, then a button to delete, and a confirm message before deleting.

@Jean-Yves_Pochez Sorry, I am displaying a confirmation to make sure.

Hi Allen,

So how are you handling the removal of the actual database table record? I used DELETE FROM… and executed the proper SQL in my project. There are other ways, but this might be an issue.

Paul

Can you create a sample project that shows the problem?

I got it. I had to close the RowSet and reopen it, otherwise, it was just redisplaying the original RowSet

If I can only figure out how to prevent the Weblistbox from not displaying the contents after a while. I thought it was because it was running as a service on a windows 10 machine but even if I just run the executable, the weblistbox stops working after a while where I have to close the server app and recall it.

Yes! The whole Rowset is it’s own dataset. Good for you!

@Paul_Murray1 Thanks Paul. Have you had a situation where the Weblistbox doesn’t display? Like this?
image

Are you using Xojo 2023r2? or older?

I remember reading something about this for Weblistbox/Windows on Issues, but I can’t find the case. Maybe I read it here in the forum.

Yes, I am using 2023r2

Hey Allen… Sorry, I haven’t had that issue so I can’t say what might be the cause without a wild random guess. :thinking:

@Paul_Murray1 Thanks

Hi Guys,
I just want to throw this at you to see if anyone have had that problem with the Weblistbox where they stop loading the data. When it happens, I need to restart the service.
Before restarting service:
image

After Restarting the service:
image

Thanks