Friday, February 27, 2009

TouchBrowser - III

Here's the latest update of the TouchBrowser code. This time I added a gradient to the selection cursor and also added the file size and last access date. The file size needs to be pretty-printed to make reading easier.

On touch-screen devices, the list now supports a HitTest function that, by delegating to the underlying list item, reports what part of the item was clicked by the user and what action is associated with it. In this case I made the icon area sensitive to the selection action so you now navigate into a directory by clicking the icon. If you just click the file name, nothing will happen beyond scrolling the list and setting the selection cursor.



zzattack said...

It looks very nice. Maybe you could include a binary, I don't seem to be able to compile this easily with VS2008. Can't wait to test it out.

João Paulo Figueira said...

What errors did you get when compiling with VS2008? Do you have WTL 8.0 installed in your development PC?

vincent said...

When you have an error with vs2008 it generally means that :

1) Your forgot to add wtl path in system includes

2) You need to add #define _SECURE_ATL 1 in stdafx.h before to include wtl headers.

vincent said...

I may have found another issue with your code in atltouch.h.
When using the SetItemCount method because it's defined like this :

void SetItemCount(int nItems)
for(i = 0; i < nItems; ++i) m_items[i] = NULL;

... SetExtent(,GetTotalItemHeight());
So first you set to NULL all your items then you call GetTotalItemHeight() that calls GetItemHeightSum() defined like this :

int GetItemHeightSum(int nItems)
int i, h = 0;

for(i = 0; i < nItems; ++i)
h += m_items[i]->GetHeight();
return h;
This time when nItems > 0, m_items[i] is NULL so it crashes.

You should use GetAt by the way with exceptions.

I will also try to use stl instead of atl containers and send you the result.

Avinash said...

João Paulo Figueira

It Looks Too Cool I am new Win32C++
developer I Don't have a Good Knowledge about WTL My List Requirement Is Same as Your List But As You Add Icon on List I want To Add Image and i Want To Create MultiColumn List With My Own Text.
For It What Should I Do Is It Possible With Your List? How