Sign in to follow this  
Followers 0
Holger

Enhanced GUIListview (ICONS/LIST):Testers needed

16 posts in this topic

Hi everybody :D

I enhanced a little bit the GUIListView for using with ICON/LIST/SMALLICONS.

You can find the test-exe and a sample to view what is possible here:

http://www.autoitscript.com/fileman/users/Holger/

Would be great if you could post here if there is a problem with your old scripts and so on.

In the past the REPORT-style was hard-coded :) so it could be possible that it now breaks some old code :evil:

So just please test it and let me now what do you think...

Thanks a lot and regards :D

Holger

Share this post


Link to post
Share on other sites



Looks pretty good, tried it with some of my UDF examples, only had a problem if styles were other than default, and view wasn't in the style.

When this happens the listview goes nuts.

Might think about default to Report if not specified?

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@Gary: please could you give me a small example of what you mean ( I think the creation line is enough) :)

Edit: uploaded again cause I missed an important initialization (in 2000 and XP there was no error, only under 95/98 and NT :evil: )

Regards

Edited by Holger

Share this post


Link to post
Share on other sites

Before adding $LVS_REPORT

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Current Selection", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL))
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $GUI_EVENT_PRIMARYDOWN
            $pos = GUIGetCursorInfo()
            If ($pos[4] == $listview) Then
                GUICtrlSetData($Status, "Current Index Selected: " & _GUICtrlListViewGetCurSel ($listview))
            EndIf
    EndSelect
WEnd
Exit

After

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Current Selection", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL))
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $GUI_EVENT_PRIMARYDOWN
            $pos = GUIGetCursorInfo()
            If ($pos[4] == $listview) Then
                GUICtrlSetData($Status, "Current Index Selected: " & _GUICtrlListViewGetCurSel ($listview))
            EndIf
    EndSelect
WEnd
Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Looks like LVM_GETNEXTITEM function doesn't work anymore either, tried it use GUICtrlSendMsg and DllCall, both don't work any more

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hmmm...probably this is a big problem.

LVS_ICON-style = 0x0000

So how could I check for such a style in a gui-style-value?...

It will always be true...

Ok....I will think about now - have a small idea...

BTW: it's always better to not use exstyle for this control in exstyle-parameter, better use i.e.:

$LVM_SETEXTENDEDLISTVIEWSTYLE   = 0x1036
GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

The problem results cause some Windows- and some Listview-Exstyles have the same values!

Like:

WS_EX_NOPARENTNOTIFY and LVS_EX_CHECKBOXES (0x00000004)

WS_EX_DLGMODALFRAME and LVS_EX_GRIDLINES (0x00000001)

WS_EX_CLIENTEDGE and LVS_EX_REGIONAL (0x00000200)

And with using this on exstyle will give you some strange looking listviews :)

Just for your info.

Regards

Holger

Edited by Holger

Share this post


Link to post
Share on other sites

Hmmm...probably this is a big problem.

LVS_ICON-style = 0x0000

So how could I check for such a style in a gui-style-value?...

It will always be true...

Ok....I will think about now - have a small idea...

BTW: it's always better to not use exstyle for this control in exstyle-parameter, better use i.e.:

$LVM_SETEXTENDEDLISTVIEWSTYLE    = 0x1036
GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

The problem results cause some Windows- and some Listview-Exstyles have the same values!

Like:

WS_EX_NOPARENTNOTIFY and LVS_EX_CHECKBOXES (0x00000004)

WS_EX_DLGMODALFRAME and LVS_EX_GRIDLINES (0x00000001)

WS_EX_CLIENTEDGE and LVS_EX_REGIONAL (0x00000200)

And with using this on exstyle will give you some strange looking listviews :)

Just for your info.

Regards

Holger

<{POST_SNAPBACK}>

Had noticed some strange results before, useing

GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)

and getting what is expected is much better.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Yep, thats it, I let it like it is.

But you can always switch to another style via GUICtrlSetStyle() :)

So we will have no breaking code - yeahh, just to easy - so I didn't see it :evil:

Will do some (back)changes and then put a new test-exe to the webfolder...

So long...

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

So, updated the test-exe which is still available here:

http://www.autoitscript.com/fileman/users/Holger/

At Listview-creation-time there is no change.

So if you wish to have another style you have to explicitely call GUICtrlSetStyle().

I think this is best possibility...

@gafrost: maybe this listview looks more 'normal' :)

#include <GuiConstants.au3>
#include <GuiListView.au3>

$LVM_SETEXTENDEDLISTVIEWSTYLE   = 0x1036

Opt ('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $pos
GUICreate("ListView Get Current Selection", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER));
GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $GUI_EVENT_PRIMARYDOWN
            $pos = GUIGetCursorInfo()
            If ($pos[4] == $listview) Then
                GUICtrlSetData($Status, "Current Index Selected: " & _GUICtrlListViewGetCurSel ($listview))
            EndIf
    EndSelect
WEnd
Exit

Thanks and regards

Holger

P.S: solved my painting bug - should no work like expected...

Edited by Holger

Share this post


Link to post
Share on other sites

Looks like LVM_GETNEXTITEM function doesn't work anymore either, tried it use GUICtrlSendMsg and DllCall, both don't work any more

Gary

<{POST_SNAPBACK}>

Everything else so far still seems to work, except LVM_GETNEXTITEM

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Ok, here's some stuff to look at with icon views

Global Const $LVM_FIRST = 0x1000

Global Const $LVA_ALIGNLEFT = 0x1
Global Const $LVA_ALIGNTOP = 0x2
Global Const $LVA_DEFAULT = 0x0
Global Const $LVA_SNAPTOGRID = 0x5

Global Const $LVM_ARRANGE = ($LVM_FIRST + 22)
Global Const $LVM_SETICONSPACING = ($LVM_FIRST + 53)
Global Const $LVM_SETITEMPOSITION = ($LVM_FIRST + 15)

Func _GUICtrlListViewArrange($h_listview, $arrange)
    Return GUICtrlSendMsg($h_listview, $LVM_ARRANGE, $arrange, 0)
EndFunc  ;==>_GUICtrlListViewArrange

Func _GUICtrlListViewSetIconSpacing($h_listview, $i_cx, $i_cy)
    Return GUICtrlSendMsg($h_listview, $LVM_SETICONSPACING, 0, $i_cx * 65536 + $i_cy)
EndFunc  ;==>_GUICtrlListViewSetIconSpacing

Func _GUICtrlListViewSetItemPosition($h_listview, $i_index, $i_x, $i_y)
    Return GUICtrlSendMsg($h_listview, $LVM_SETITEMPOSITION, $i_index, $i_x * 65536 + $i_y)
EndFunc  ;==>_GUICtrlListViewSetItemPosition

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

A little bit few comments..hmmm, maybe it's not really important :evil: however..

@gafrost: thanks for input again :)

I don't know what the problem is with "LVM_GETNEXTITEM".

Do you have a _non-working_ example, cause I think it should work?!

There are still some issues with re-positioning the icons, for instance with the icon spacing message.

So long...

Holger

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

A little bit few comments..hmmm, maybe it's not really important :evil: however..

@gafrost: thanks for input again :)

I don't know what the problem is with "LVM_GETNEXTITEM".

Do you have a _non-working_ example, cause I think it should work?!

There are still some issues with re-positioning the icons, for instance with the icon spacing message.

So long...

Holger

<{POST_SNAPBACK}>

Nothing wrong with the LVM_GETNEXTITEM, was my code, had to redo it, could have sworn it was working, but went all thay back to version .10 and it didn't work.

Sorry for the trouble.

Gary

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0