How can you display rows in 'dynamic' sizes using tableview of Corona SDK - height

I am using tableview to display a list of items
e.g.
list =
[
{name='bob',
description='really long description that can be multiple rows',
image='an image from my server',
},
...
]
the above is just an example. I got my data from my server, including images of variable sizes. My question is how do I display the correct row size(height) once I got image from the server. I understand that I can wait until all data and image has been downloaded from server. Then precompute the height. But I want to be able to display the text first (as texts are more likely to be firstly downloaded), then once there is an image in it, I download it again. After the image is downloaded, I want to resize the row height. How can I do that?

Create a multi-line display.newText() of the width you expect to put in the table view. When the object is created, grab it's height and then remove the object. Use that height + some padding for the row height. There may be performance issues with this, so as an alternate, keep the text object and pass it in as a parameter when you create the row.

Related

setAutoScroll with QTreeView and custom model does not work

I have made a QTreeView to display a very large and continuous data set. Since the data set is continuous, I delete initial rows when the total number of rows is greater than a specified amount.
I have used a custom model for this purpose
The whole system is working correctly and displaying data.
But I want it to autoscroll to the bottom to display latest data. If i use scrollToBottom at row addition it completely slows down the entire view-model. But If i use m_pTreeView->setAutoScroll at the start, it has not effect.
Moreover if i click on the view, it completely slows down.
I am using Qt 4.7.1
How should I auto scroll to the bottom without compromising on performance?
And show I remove the lag/drastic performance hit when I click on the view?
the whole code is available at this repo:
https://github.com/daniyalyasin93/qt_qtreeview_hugedata/

How to increase the width of the stats name column in OpenSceneGraph?

I've added some user stats to the OSG stats handler. Unfortunately, the 'title' column does not seem to expand automatically based on the width of the added user stats names.
Is there a way I could change the width of the title column?
The issue it causes now is if the 'bar' for my user stat begins at 'zero', the bar will be drawn over the time, preventing the users from reading it.
In the image above, the vertical white hair line should come after SimFrameTime:113.67 so it can be read correctly when the bar fro the frame starts at 'zero'.
The frame tick lines position are fixed in screen space, they do not take into account the text size.
See the implementation in file osgViewer/statsHandler.cpp - the first line is drawn at "_startBlock" which is hardcoded to 150 "units" in the ortho camera space.
You can either change that value in your copy of OSG or expose the value in the StatsHandler class interface and submit a patch if you want official osg to support this feature.

How to read images in a preset folder and display it on an image area using Livecode?

How to read images in a preset folder and display it on an image area using Livecode?
I have read through many Livecode sites but could not find an example.
create a button "butn" and image area "imag"
then put this code in that button.
repeat with i =0 to the number of images in url "~/your/folder/path"
put it into image "imag"
wait 2 sec
end repeat
I should work, but i don't checked. if not, keep this logic in your mind and try it yourself.
all the best.

Cfimage and dynamically naming the "name" portion of the cfimage tag

I have a page that displays a series of available items for the public to purchase. Each of these items displays the image for the related product. My cfimage code is made to scale-to-fit the stored image.
Normally the displayed results will all show different products and their corresponding images. However, when I use the code all of my products show the same image, instead of showing the images that are linked to each product via a file path stored in the database. Is there a way to set the "name="myImage" dynamically so that each image will display and scale properly?

How to provide a custom column width calculation for CListCtrl?

I'm using a CListCtrl with my own "DrawItem" to draw some custom graphics into the first column, in front of the text. The text is moved ~20 pixels to the right for this. That part works.
If the user double-clicks the column divider in the header, Windows calculates the best column width. But of course Windows doesn't know my custom drawing. So the result is ~20 pixels too small for the first column.
How can I correct that?
Found a workaround:
I can trick MFC into thinking that the list control uses checkboxes:
pMyList->SetExtendedStyle(pMyList->GetExtendedStyle() | LVS_EX_CHECKBOXES);
The user will never ever see the system's checkboxes (because of my custom drawing), but this gives me just the space that I need.