Sign in to follow this  
Followers 0
jonny1234

Get control ID for ListView item

5 posts in this topic

Hi,

I'm creating ListView items using MyGUICtrlCreateListViewItem from example 2 of GUICtrlRegisterListViewSort in the AutoIt help file.

Unlike GUICtrlCreateListViewItem, MyGUICtrlCreateListViewItem returns the index of the newly-created item and not its control ID. But I need the item's control ID to pass to GUICtrlSetBkColor in order to set the background colour of the item.

Please can you help.

Regards,

Jonny

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I'm creating ListView items using MyGUICtrlCreateListViewItem from example 2 of GUICtrlRegisterListViewSort in the AutoIt help file.

Unlike GUICtrlCreateListViewItem, MyGUICtrlCreateListViewItem returns the index of the newly-created item and not its control ID. But I need the item's control ID to pass to GUICtrlSetBkColor in order to set the background colour of the item.

Please can you help.

Regards,

Jonny

You can select the item then use GuiCtrlRead of the listview to get the id of the selected item.

Sorry don't think that will work unless you use GuiCtrlCreateListViewItem

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

You can select the item then use GuiCtrlRead of the listview to get the id of the selected item.

Sorry don't think that will work unless you use GuiCtrlCreateListViewItem

You're right, it doesn't. It always returns 0.

But if I use GuiCtrlCreateListViewItem, then the sorting won't work.

Perhaps I'll have to find a way to set the item background colour, other than by using GUICtrlSetBkColor.

Regards,

Jonny

Share this post


Link to post
Share on other sites

You're right, it doesn't. It always returns 0.

But if I use GuiCtrlCreateListViewItem, then the sorting won't work.

Perhaps I'll have to find a way to set the item background colour, other than by using GUICtrlSetBkColor.

Regards,

Jonny

Use the methods from the first example not the second one and it should work.


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

Use the methods from the first example not the second one and it should work.

You're right, it does. Thanks.

Regards,

Jonny

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