Jump to content

Multi-line items in custom drawn ListView


LarsJ
 Share

Recommended Posts

No, I'm not working on these multi-line listview items right now.

But with the code here I'll never be able to help you with your problem. My listview is a custom drawn listview based on $NM_CUSTOMDRAW notifications contained in $WM_NOTIFY messages.

To solve your problem with rows of different heights, you need an owner drawn listview based on $WM_MEASUREITEM messages to define the height of the rows and $WM_DRAWITEM messages to draw the contents of the rows.

I think you should ask a question in one of the help forums. There is definitely someone who can help you. Maybe I'll look at the problem myself.

Link to comment
Share on other sites

  • 2 weeks later...
On 01/05/2018 at 11:45 AM, LarsJ said:

No, I'm not working on these multi-line listview items right now.

But with the code here I'll never be able to help you with your problem. My listview is a custom drawn listview based on $NM_CUSTOMDRAW notifications contained in $WM_NOTIFY messages.

To solve your problem with rows of different heights, you need an owner drawn listview based on $WM_MEASUREITEM messages to define the height of the rows and $WM_DRAWITEM messages to draw the contents of the rows.

I think you should ask a question in one of the help forums. There is definitely someone who can help you. Maybe I'll look at the problem myself.

Do you have any alteranative in mind just to me try to do until there? I will post there.

Edited by x_bennY
Link to comment
Share on other sites

  • 2 years later...

I spent 1 hour trying to understand the example but message handlers and other stuff seems to be too difficult for me.

Is there any simple example, where you just set listview item with string like:

Local $my_multiple_line_string = "Line1" & @CRLF & "Line2" & @CRLF & "Line3"
_GUICtrlListView_SetItemText_MultipleLines($idListView, $my_multiple_line_string)

I am also wondering why message handlers like these are  definied in the example, not in the UDF?

GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" )
GUIRegisterMsg( $WM_ACTIVATE, "WM_ACTIVATE" )

I just want simple modify my existing large script with the option to add multiple lines to the listview item control. Number of lines are random, sometimes it's 1 line but sometimes it's 5 lines or more.

Link to comment
Share on other sites

  • 2 years later...

Hello.

I took an example with two lines and trying to change it so that the LV would be filled gradually in visible mode.

Of course, there are no problems with the first lines, but the second additional lines appear only after filling in the LV.

Can anyone help me with this?

I attach a changed example to show what I want.

2) Two-line listview items - Changed.au3

Link to comment
Share on other sites

Just move Sleep(1000) to the bottom of the loop immediately before Next.

Note that while the listview is being populated, the main message loop doesn't work. It's e.g. not possible to close the GUI while the listview is filling.

But the WM_NOTIFY message handler still works, so the listview is filled in correctly.

Link to comment
Share on other sites

Hi LarsJ.

Thanks for your response.
Unfortunately, move the Sleep does not change the display order.
Perhaps I did not explain the desired enough.
I want to see the first line in the first line of the LV, then the second line of the same first line of the LV. And so in order.
Instead, now I see the first line of the first line of the LV, the first line of the second lines of the LV, etc.
All the second lines I see only after filling all the first lines.
At the same time, if in the process of filling I will press the mouse inside the LV, then I will see some of the second lines.

Hooray. Everything was decided. I remembered one trick and added at the end of the cycle

_GUICtrlListView_RedrawItems

Perhaps you want to add something, but in any case thanks.

And thanks for the original opportunity to do multi line.

Edited by Lion66
Solution
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...