I have a cross platform application, OS X and Windows, that requests a jpeg pic from a camera and places received pic in a listbox. I control the column width and row height to enable a certain pic size 160x120, 320x240, or 640x480
The Listbox name is listStreams and is on myMainWindow
A socket is opened and a url is sent to the camera. Inside the Camera Socket the ‘AuthenticationRequired’ even addresses the Name and Password
Then in the PageReceived event - code identifies which camera and selects the appropriate cell in the Listbox to place the pic in. The Listbox is 1 column with many rows.
There are several difference between OS X and Windows:
First - I have a Bug Case 49415 - Xojo.Net.HTTPSocket 401 error - Windows Only that was ‘Fixed & Verified’ and was looking for this to be in the recent XOJO release. This appears to not have occurred as AuthenticationRequired still fails and subsequent requests where @ThomMcGrath helped and clearly identified the problem still occurs.
A Timer refreshes all camera pics that have been identified one cell at a time.
Beyond that on:
OS X [quote]the pic is sized correctly in the entire cell with an updated pic controlled by the Timer. A myMainWindow.listStreams.Refresh() call at the end of the ‘PageReceived’ event in the Camera Socket works fine in that all pics are visible in the Listbox and are sized correctly to fill the cell.[/quote]
Windows [quote]the pic is not sized to the bounds of the cell correctly - a bit smaller - and myMainWindow.listStreams.Refresh() call at the end of the ‘PageReceived’ event in the Camera Socket leaves the Listbox blank. Then if the user clicks anywhere on the Listbox before the next Timer event the entire Listbox is displayed. The Listbox is blank after next Timer event and to see pics you need to again click anywhere in the Listbox[/quote]
So on Windows I am wondering how can I ensure pics are sized to the cell correctly and also how do you refresh a Listbox in Windows with new pic information and have it displayed?
How closely together are your Listbox and socket tied?
I might have the socket download the image, and store it in a property, and Invalidate the Listbox rather than Refresh. Invalidate tells Xojo to redraw “when it gets the chance” whereas Refresh is more of a “drop everything and DRAW IT NOW”.
How are you displaying the image in the Listbox? The two basic methods I’m thinking of should’t be resizing the image. The docs state that RowPicture does not resize the row to accommodate the picture. And when using CellBackgroundPaint you are responsible for the image, so if the image is being resized, it’s your code.
It may be beneficial for your use to create a ContainerControl based control with the image display and details laid out like you have in the list box, but make the Container handle everything about updating the image and maintaining the data displayed. Then, create a scrolling list of your self-managing containers.
On OS X the pic displays correctly in that it is displayed edge to edge of the Listbox Cell
On Windows the pic is smaller in that it is not edge to edge of the Listbox Cell[/quote]
Could it be that row height is in points and the picture is in pixels?
@Tim Parnell - Intersting suggestion. Not certain how to proceed on that but it seems that it may be a solution. Let me share what I am trying to accomplish.
I need to be able to display an RTSP stream from a camera and I need to be able to have multiple streams. Currently I place a small view of each camera in a listbox on the right side and in the left a larger viewing area. All this is placed on a single window.
On the right I currently am using a Listbox to view a pic updated every 5 seconds from each camera (I want to change this to a small rasp stream).
On the left where I view the RTSP stream I have a Window whose Super is now a Container Control. This enables me to place the RTSP stream inside the application window.
When you double click on the pic an RTSP request goes out to that camera and a stream is setup. That stream is displayed using VLC Plugins. Presently this is only working on OS X and is not really a ‘solid’ solution.
Conceptually this might be a solution just not certain how to proceed.