Integrated Application Platform › Forums › General › List View – Tool Tip and Click
- This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by ajith.
March 24, 2015 at 5:37 am #1158
I have two doubts related to ListView, which is inside a custom control
1) Is it possible to make the tooltip that pops up when you hover the mouse stay as long as you keep the mouse pointer over the same record?
2) When I click a row in the ListView, I need to bring up a Dialog showing the value from a field of that row. I am using ItemClicked(item) method. It works fine except that only the first column is truly clickable. When I click other columns, the value false is returned. How can I change this behaviour?
ajithMarch 24, 2015 at 9:31 am #1159amckinlayKeymaster
1) There is a Windows message to set the tooltip timing – TTM_SETDELAYTIME. This would let you keep the tooltip open longer. For example, at the end of ToolTipControl New you could add:
.SendMessage(TTM.SETDELAYTIME, TTDT.AUTOPOP, 30000) // 30 sec
Note: I have not tested this.
2) I am not sure what you mean by “false is returned”. Do you mean the value passed to ItemClicked? This value is the row currently selected. If no row is selected it will be false.
According to the MSDN documentation for list view NM_CLICK you must use LVM_SUBITEMHITTEST (ListViewControl SubItemHitTest) to determine which item was clicked on.March 25, 2015 at 12:06 am #1160
Thanks for the reply.
1) The fix for the tooltip you suggested is working.
2) My custom control has got the medthod:
When I run the control and click the first column (cell) of any rows in the ListView, the inspect shows a number (the row’s number). But, if instead of the first column, I click the second column (cell) (which also has data), the Inspect shows false.
In other words, the ItemClicked gives the number of the row clicked only if the click is made over the first column (cell) of the row, not any other columns (cells).
Is it possible to change this behaviour so that ItemClicked (or some other method) would give the row’s number (or value) whether you clcik on the first cell or any other cell?
ajithMarch 25, 2015 at 11:36 am #1162amckinlayKeymaster
The problem is that clicking on a row only selects the row if you click on the first item. (And ItemClicked is passing the selected row.) This is Windows, not Suneido.
One way to make it work is to set a style with something like:
.List.SetExtendedStyle(LVS_EX.FULLROWSELECT)March 25, 2015 at 11:41 pm #1163
That works exactly the way I wanted.
Thanks a lot,
- You must be logged in to reply to this topic.