refresh weblistbox

I want to let my clients watch an updating listbox:

count = count + 1
if count > 27 then cc.fav.lstAddedSkills.removeRow(0)
cc.fav.lstAddedSkills. addRow str(sqlStatement)

this, I think, does update the listbox, but the updates do not show. On the desktop, listbox.refresh would do the trick, but on the web, what?

What are cc and fav? And is there any chance you’re doing this across Sessions?

I’m generally not a fan of that style of coding where you drill down like that. I’ve seen a few cases with WE where it gets developers in trouble because they have the wrong Session context.

cc (CircleCalc) is a window. fav (Favorites) is a container.

ok … what’s WE?

Is this where I need a reminder to use a thread to do the math? If so, how do I make it cause the listbox to update?

Wait, this is in the “Web” channel, labeled “WebListBox”. “WE” is Web Edition. That’s not what we’re discussing here?

Just didn’t understand abbreviating a three character word to the clearly shorter and less syllable intensive two character word.

sorry.

any ideas folks?

Just tried a very simple program with a weblistbox and a timer.

In WebListBox1.Open :

Sub Open() Dim r As New Random Dim m As Integer for i as integer = 0 to 10 ListBox1.addrow(str(r.InRange(0, 1000))) next End Sub

In Timer1.Action :

Sub Action() Dim r As New Random Dim m As Integer for i as integer = 0 to 10 ListBox1.removerow(i) ListBox1.addrow(str(r.InRange(0, 1000))) next End Sub

No need to refresh or invalidate, numbers are updated every second.

Are you sure your code runs ?

yeah … it does what I ask, but doesn’t update until finished. This is a web app by the way.

Oh, well that’s new information. Wherever you are doing all this stuff, you’re building a response to be sent to the browser and it’s taking awhile to calculate everything. You might try putting a WebTimer on the page, setting its mode to multiple and period to maybe 1000 or 2000. That should give the server periodic opportunities to send some information back to the client. Be sure to do some dummy Action on the WebTimer so a request from client to server doesn’t get optimized out.

Thank you for telling me this is a web app. I would have guessed, since you post is in the Web channel :stuck_out_tongue:

Before posting, I did test the short WE program above to make sure a web page did update each time the timer ticked. So I am positive, no need for refresh or other strange things for a page to update.

Now, you blessed us with such a ridiculously small piece of code that it means close to nothing, and still expect some kind of psychic power to guess what maybe wrong in the whole program. Then ask for a solution. Then when I try to help, all you tell me is that it does not update and provide no detail at all. It does not work that way. How do you want anybody to help if you do not make any effort to communicate ? Posting entire code and/or placing the project for download is the only way to get appropriate help. Not simply asking about ideas…

If you want to build something that works, you start with a very small program that does only one task (in my case updating the content of the weblistbox), ascertain it runs as expected, and then proceed to feed it data from other sources.

I would bet that your issue is not that the weblistbox does not update, but that your data is not updated. But how could I know if you keep your code under wraps ?

Signing off this thread :confused:

Michel I’ve seen you slamming people all over this forum. You can stop or leave.

Michael and brad. John says on his op at the end of his query “but what about web?” And it’s in the web channel. Why was it new information when he told you it was a web app?

John, you will learn to ignore brad, he has no social skills whatsoever, is rude, arrogant and unless you agree with his views slams you. Xojo allow it to slip through the net on the forum as he is well known to be like this and everyone laughs him off really. It is a shame you can’t block people but until that feature comes I would suggest ignoring brad.

Sorry :frowning:

[quote=93386:@Mike Charlesworth]Michael and brad. John says on his op at the end of his query “but what about web?” And it’s in the web channel. Why was it new information when he told you it was a web app?
[/quote]

Yo Mike, since you’re having trouble understanding the conversation, the new information late in the thread appears to be that he was doing a lot of work in an event handler to load his WebListBox. This was probably causing his trouble. The solution would make a perfect dippit for your website. Please credit John for the code.

The original 3 line snippet of code, by itself, would not exhibit the problem reported, so the obvious conclusion is that the problem lies elsewhere. As presented, one would think that that were in a timer of some kind, as that is the typical approach with WE. His later comment suggested that in fact this was part of a loop and all the listbox manipulation was happening in a single event, like a button. That is known not to work, as all the output of any one event is sent all at once to the browser. The solution provided by Michal, or some variant of it, is the way to go.