News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

code samples on sorting a listview?

Started by dacid, February 01, 2010, 10:09:08 AM

Previous topic - Next topic

dacid

Seems that there is not too much out there...

dacid

Im playing with Iczelion tutorial 31... it seems to work pretty well but as this code is a little old ... would you recommend me to use it or there is better routines out here?

dacid

any info or code about auto size column headers?

PBrennick

When you create the listview (or later) youe one of the following flags, LVS_SORTASCENDING OR LVS_SORTDECENDING.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

dacid

This sorts the listview the first time you add items, doesnt it?... Im using the iczelin code adapted to my program to sort the items when you click on a header. I realized that the "arrow" that some apps shows in the header is not something that windows does automatically.. any info about this?


Gunner

Quote from: dacid on February 01, 2010, 07:37:53 PM
This sorts the listview the first time you add items, doesnt it?... Im using the iczelin code adapted to my program to sort the items when you click on a header. I realized that the "arrow" that some apps shows in the header is not something that windows does automatically.. any info about this?

You can add an icon to the column when you create it and you can modify the icon by sending the listview the message LVM_SETCOLUMN and set the LVCF_IMAGE to the new image in LVCOLUMN

You should really download the Platform SDK if you can it is a big help!
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

farrier

dacid,

Visit Donkey's Stable:

http://www.quickersoft.com/donkey/

Filled with knowledge and good code.  Everything I needed for ListViews I got from his example.  Click on "GoAsm Projects" and scroll down to ListView.  The code is in GoAsm style, but it will be easy to change to your assembler of choice.  I think it will do everything you asked for, except AutoSize the columns, and I would love to know how to do that.

Thanks again, Donkey!!

hth,

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

Gunner

Quote from: farrier on February 01, 2010, 10:21:22 PM
I think it will do everything you asked for, except AutoSize the columns, and I would love to know how to do that.

Something like this?

    ; set column 1 width
    invoke  SendMessage, hLVMain, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE
; column 2
    invoke  SendMessage, hLVMain, LVM_SETCOLUMNWIDTH, 1, LVSCW_AUTOSIZE_USEHEADER

~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

dacid

yes, it works pretty well here. thanks gunner.

thanks farrier for the link.

farrier

Gunner,

Yes!  The strange thing is that I use LVM_SETCOLUMNWIDTH many places in a few programs, but I never paid attention to the "Auto" features.  Thanks!

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

dacid

Hey, another question  :red .. Im using CreatePopupMenu and AppendMenu to create a right-click menu over the listview... Im triying the same way I do in the Window Menu:

MENUITEM "&Refresh\tF5",IDM_REFRESH

szRefresh "&Refresh\tF5",0

But it shows the "\tF5" instead of right-align the "F5" string.

jj2007


dacid

#12
thank you! 

dacid

What msg sends the listview to announce when the user select a item or multiple items?

EDIT: I fount it:  LVN_ITEMCHANGED


dacid

Can I make a Window menu (defined in .RC file) with some items disabled?


MENUITEM "&Refresh\tF5",IDM_REFRESH


Or I must disable in WM_CREATE ?