Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1011 closed Bug (No Bug)

GUICtrlSetOnEvent registeres also on Listviewitems created with _GUICtrlListView_AddItem and lparam

Reported by: Qsek Owned by:
Milestone: Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: Cc:

Description

When using OnEventMode, GUICtrlSetOnEvent seems to also fire when you click on Listviewitems created with _GUICtrlListView_AddItem
If the $iParam is the same as a controlID of an control on which GUICtrlSetOnEvent is bounded, a click on this Listviewitem will run the associated OnEvent function, as if you would have clicked the control.
See attached example 2.au3
click on item 4 and 5
Qsek

Attachments (1)

2.au3 (2.1 KB) - added by Qsek 10 years ago.
Attachment to Ticket #1011

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Qsek

Attachment to Ticket #1011

comment:1 Changed 10 years ago by Gary

  • Resolution set to No Bug
  • Status changed from new to closed

Not a bug, Application defined data is just that, you need to make sure that if you use lparam to start at a number higher than any control already created to not have the same application defined data value.

comment:2 follow-up: Changed 10 years ago by Gary

see the example2 for _GUICtrlListView_RegisterSortCallBack in the help file

comment:3 in reply to: ↑ 2 ; follow-up: Changed 10 years ago by anonymous

hmm ok so as i understand lparam sets the controlID of the LVitem?
This should be mentioned somewhere in the help.
I can be a really annoying bug if you work with LV's and lparam.
But do you think it is good that it is possible to create a control(LVitem) that has the same ControlID as another control?
and why is it only affecting GUISetOnEvent? Normally you should be able to use GUICtrlSetData and the other control functions if you set the lparam.

comment:4 in reply to: ↑ 3 Changed 10 years ago by Valik

Replying to anonymous:

hmm ok so as i understand lparam sets the controlID of the LVitem?

Not quite. Due to poor design in AutoIt, the LPARAM is internally used to store the control ID that AutoIt returns. That means it's not possible to use the LPARAM of built-in ListViewItems without breaking AutoIt's handling. Likewise it makes it so that even users who are not using the built-in control and are instead using the Windows API directly can't effectively use the LPARAM without clashing.

You should never mix built-in and UDF controls. Use one or the other, not both.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.