[LIB] LV_EX - update on 2016-04-28

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [LIB] LV_EX - update on 2016-04-28

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 06 Dec 2017, 03:51

Code: [Select all] [Expand]GeSHi © Codebox Plus


Parameters:
  • Str
    The string to search for.
  • Start
    The number of the row to begin the search with or 0 to start from the beginning. The specified row is itself excluded from the search.
  • Partial
    If False (default), the function searches for an exact match. Otherwise, the function will check if the item text begins with the string to return a match.
Return values:
    Returns the number of the row if a match was found, or 0 otherwise.

Re: [LIB] LV_EX - update on 2016-04-28

Post by DanielToward13 » 05 Dec 2017, 21:57

Can you give an example of LV_EX_FindString function? I could not figure out how to use it to filter the rows. Also how to update the data after adding new rows?

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 19 Jun 2017, 06:00

You cannot assign a row to a group 'by value'. You might pull the values you want to use as group headers from the contents, add the groups, and assign the related rows by row number.

Re: [LIB] LV_EX - update on 2016-04-28

Post by Dravenizer » 19 Jun 2017, 05:01

Hello! I have a listview like this one:
Col1|Col2
1234|AAA
9655|CCC
2564|AAA
4456|BBB
4556|AAA
7889|CCC
I would liek to group them by all distinct values in col2, like this: (note i want to display the full value as group header - AAA, not just alphabeticly - A )
Col1|Col2
AAA-------------
1234|AAA
2564|AAA
4556|AAA
BBB--------------
4456|BBB
CCC-------------
9655|CCC
7889|CCC
I only saw examples of grouping by row number and not by values. Can you point me to the right approach? I am guessing i should have a mechanism that loops trough the given column, extracts all distinct values and then check if which cell belongs to which value and group accordingly? Btw a function that accepts column number as parameter and automaticly clears all groupings,and then groups the listview by all values inside a column sounds super awesome and useful.
Thanks for sharing the amazing work !

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 08 Mar 2017, 12:48

Ah, I was looking at the documentation and only looked at Objects. Didn't realize the subitems had their own pages. Thanks!

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 08 Mar 2017, 10:25

Code: [Select all]GeSHi © Codebox Plus

	LV_EX_SetItemParam(IMLV_LView, currRow, currTicket.GetAddress("sessionid"))
?

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 08 Mar 2017, 07:52

Ok, I figured it out. I had been storing the address to the string correctly but was neglecting to use StrGet to retrieve the actual string stored at that address after retrieving the item's lParam.

EDIT:
So in my instance, I am populating the ListView using an Object containing support ticket information. Is there a way to store the address of a particular field in that object? Unforunately, I used a temp variable for storing the GUID and then assigning the address of that temp variable to the lParam so it get's overwritten for each row that is added. The below didn't work

Code: [Select all]GeSHi © Codebox Plus

for ticket in oIMTickets[queue] {
currTicket := oIMTickets[queue][ticket]
currRow := LV_Add("", currTicket["processid"], currTicket["incidentname"])
LV_EX_SetItemParam(IMLV_LView, currRow, &currTicket["sessionid"])
LV_EX_SetGroup(IMLV_LView, currRow, groupNum)
}

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 08 Mar 2017, 05:06

lParam will accept pointer-sized numeric values. If you want to use it for strings, store a pointer to the string.

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 07 Mar 2017, 13:45

What kind of data can be stored in the item's lParam? I am attempting to store a GUID and am not receiving the same string back when calling LV_EX_GetItemParam(). i.e. "a7a04166-ea26-11e6-8a43-0225b501000d"

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 03 Mar 2017, 04:24

Seemingly the auto-sizing of the tiles is done only once when the tile view is activated. So you have to change the tile view settings before you activate the view.

Code: [Select all] [Expand]GeSHi © Codebox Plus

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 02 Mar 2017, 19:05

I am having issues with Tile view and the tiles displaying correctly. The only way I can find that they are getting spaced correctly is when Group View is enabled or toggled at least once. Seems that it causes the control to redraw and it then correctly spaces the tiles (size of the tile doesn't appear to change). I tried using LV_EX_RedrawRows() but it doesn't appear to help.

Simple code where I am seeing the issue:

Code: [Select all] [Expand]GeSHi © Codebox Plus



EDIT:

Another example which is a slightly modified sample from you, just me:

Code: [Select all] [Expand]GeSHi © Codebox Plus



Notice how when you first check the Tile View checkbox, the tiles are overlapping. But if you uncheck, and then check the Tile View box again, the tiles are properly oriented.

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 01 Mar 2017, 09:00

Thanks just me. I definitely can store them in an array. I just figured that the control was maintaining that information so I'd rather pull it from there than keep a second instance of tracking which rows are in which groups. Because of how I have my data structured, I am able to do this:

Code: [Select all]GeSHi © Codebox Plus

groupLength := LV_GroupGetCount(hwnd, gID, firstItem)
Loop, % groupLength
LV_GetText(ticketSessionID, firstItem + (A_Index - 1), 3)


Thanks again!

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 01 Mar 2017, 04:59

You have to assign the group to each item manually. So why don't you store the items in an array?

Code: [Select all] [Expand]GeSHi © Codebox Plus

might be of limited use, because items seem to keep their original index when added to a group.

Re: [LIB] LV_EX - update on 2016-04-28

Post by kczx3 » 28 Feb 2017, 21:02

Is there a way to get an array of the rows that are within a group by group ID? I am thinking it'd be sending LVM_GETGROUPINFO with the proper mask for cItems. Currently, I loop over all the rows in the listview and check if they are a part of the specific group. I'd prefer not to loop if possible.

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 12 Nov 2016, 05:17

Hi qqap, would you please post what you have tried?

Re: [LIB] LV_EX - update on 2016-04-28

Post by qqap » 12 Nov 2016, 02:56

LV_EX_SetColumnOrder is didn't work. plz fix it

Re: [LIB] LV_EX - update on 2016-04-28

Post by Guest078 » 18 Aug 2016, 06:22

Thanks again @just me & @lexikos!

Converting the integer to a string works flawlessly even in AHK v2 / _L :)

Re: [LIB] LV_EX - update on 2016-04-28

Post by lexikos » 16 Aug 2016, 22:30

You just need to convert the value to a string, i.e. Item := Item "".

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 15 Aug 2016, 01:30

Interesting! I don't use v2, but your issue might be caused by
v2-changes wrote:Expressions
...
Address-of: Since pure numbers and strings are now distinct types, &(var := 123) now returns the address of an int64 instead of the address of a string. ...
...

Source

Seemingly you need some extra work if you have to store a string pointer in a structure and the variable contains a pure number.

Re: [LIB] LV_EX - update on 2016-04-28

Post by Guest078 » 14 Aug 2016, 08:05

Btw, there is a small issue with AutoHotkey_H (v2):

I've changed in LVH_Insert:

Code: [Select all]GeSHi © Codebox Plus

If Rownumber Is Not Integer

with

Code: [Select all]GeSHi © Codebox Plus

If (type(RowNumber) != "integer")

to not get an error and I use this small example (and both functions at the end of it):

Code: [Select all] [Expand]GeSHi © Codebox Plus



https://s4.postimg.org/i9mgca599/testscript.png

When compiled with AutoHotkey_L (and no change), the output in the Index column shows 1, 2, ..., 5

Top