Jump to content

Get control ID for ListView item


jonny1234
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

 

Link to comment
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

Link to comment
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.

 

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...