Sign in to follow this  
Followers 0
furrycow

Disable listview item select

3 posts in this topic

OK, i have an x number of items in a listview, which the program scrolls through highlighting each row seperatly before moving onto the next, but i dont want the user to be able to click in the control at all. Now, i know its poss to GUICtrlSetState() the control, but i dont want the background to "grey" out (and GUICtrlSetBkColor() doesnt work after disabling).

I was thinking i could wack a transparent png over the top of the listview, but this seems like a lot of effort for just the simple task of not letting the user click inside the control.

Any simple solutions? ive checked helpfile, a load of topics on here too, cant find anything about it :D.

Just as a quick example heres some code of what i mean...and as you can see while it is scrolling through you are able to click any of the other items..just to clarify..visually, i want it to look exactly like this, however i dont want there to be any input from the user possible. TIA.

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 398, 245, 193, 125)
$ListView1 = GUICtrlCreateListView("Item Number", 8, 8, 289, 225)
GUISetState(@SW_SHOW)

_GUICtrlListView_BeginUpdate($ListView1)
For $i=0 To 100
_GUICtrlListView_AddItem($ListView1,$i,$i)
Next
_GUICtrlListView_EndUpdate($ListView1)

For $i=0 To 100
_GUICtrlListView_SetItemSelected($ListView1, $i, True, True)

Sleep(200)
_GUICtrlListView_Scroll($ListView1, 0, 16)
Next
Sleep(2000)

Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites



Found quick solution from searching the forums:

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 398, 245, 193, 125)
$ListView1 = GUICtrlCreateListView("Item Number", 8, 8, 289, 225, $LVS_SINGLESEL)
GUISetState(@SW_SHOW)

_GUICtrlListView_BeginUpdate($ListView1)
For $i=0 To 100
$item = _GUICtrlListView_AddItem($ListView1,$i,$i)
GUICtrlSetState( $item, @SW_LOCK )
Next
_GUICtrlListView_EndUpdate($ListView1)


$cover = GUICtrlCreateLabel("",8, 8, 289, 225); blocking the control!
GUICtrlSetState($cover,$GUI_ONTOP)


For $i=0 To 20
_GUICtrlListView_SetItemSelected($ListView1, $i, True, True)
Sleep(200)
_GUICtrlListView_Scroll($ListView1, 0, 16)
Next
Sleep(2000)

Share this post


Link to post
Share on other sites

YES! Thank you, works perfectly! sticking a label on top was certainly a lot easier that doing the whole png thing, thanks again!


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

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