Author | Message | Time |
---|---|---|
Puzzle | OK. Here's the problem: After days of researching and testing I finally succeeded in making an owner-drawn listbox. When I join a channel, however, it seams that I can't get the users to be added in the order in which I get their data. If I use DoEvents in my coding it completely randomizes the order in which items are added to the listbox. On the other hand, if I don't use it, it skips users in the channel almost randomly. I've tried collecting data with error handlers but it isn't generating errors. My idea: Index each one and make sure that they are added to the listbox in the order in which they are recieved. The problem with this, though, is that I'm unsure how to implement it. I'm in class right now but can post some code when I get home later this morning. Any help would be much appreciated. Thanks in advance! | April 1, 2004, 2:14 PM |
Adron | Does your code work if you just print the list of users received to the debug window? When using DoEvents I could imagine either there being a multithreading-like issue with some global variable being overwritten, or that you have a DoEvents partway down the loop you're using to add users, and that at that time you get a new Receive event and process the users received there. When not using DoEvents it sounds like not properly taking care of the remains of the buffer after you've processed all whole packets - typically when joining a large channel packets will be split across your receive buffers, and so there'll be some bytes left at the end of the buffer that belong to the next packet. This is all assuming that your code doesn't work if you print the received users. If your code prints the users correctly to the debug window when you add that code to your current project, you need to look into tracing your contexts appropriately. In that case you are probably not drawing the right item at the right spot when you're told to draw. Just speculating, this could be because you store them somewhere that your index (context) gets lost or changed when you add more items to your list. | April 2, 2004, 10:09 AM |