Forum > LCL
Basic Q: in TreeView one can call "aNode.EndEdit". Does Listview has such?
(1/1)
d7_2_laz:
For a plugin running inside Notepad++ i had irregularities with item inplace editors (treeview, listview)
who don't close 'automatically' in all expected cases. Eg. the do Not close when clicking onto another control inside the plugin's docking form, or onto some control outside.
I was able to find some workaround hack for the treeview using "OnMouseLeave": if the mouse goes outside the treeview whilst the node editor is open, then i close it explicitely using "aTreeView.Selected.EndEdit(True);".
Does Listview knows something like "EndEdit" - including 'cancel' parameter - which allows to call such closure from outside via code ?
As listview item editor i use something like this:
https://forum.lazarus.freepascal.org/index.php/topic,54348.msg403726.html#msg403726
Remark: for the ListView, there is a "DoEndEdit(AItem: TListItem, const AValue: String)" procedure. But his behaves quirky in my tests
(it requires a new/changed value for the item's caption - otherwise the item editor keeps open -, that's not wanted).
jamie:
Did you try posting a message "WM_CancelMode" to the control ?
P.S.
Not sure if the LCL processes this, if so then it should be in the Lmessages unit under "LM_CANCELMODE"
Jamie
d7_2_laz:
Oh, i wasn't aware of the LM_CANCELMODE message yet, thanks for the idea!
Tried it (sending onto the item's editor handle), before or after the DoEndEdit, or without the latter, but it didn't make a difference ..
jamie:
Yawn!
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.SpeedButton1Click(Sender: TObject);begin ActiveControl := nil; Listview1.Selected := Nil;end;
You are most likely moving to a TGraphicsControl which does not change the focus.
d7_2_laz:
jamie, and this code to implement for potentially all existing controls (if graphicontrol)?
Most cases here are no graphic controls.
Navigation
[0] Message Index