• How can I extract the column values from DListView_Line
    5 replies, posted
Hi all, Right now I have this, which gets the prop model (ID=5): pnListView.OnRowRightClick = function(pnSelf, nIndex, pnLine)   SetClipboardText(pnLine:GetColumnText(5)) end I am aiming to use different ID when different column is clicked. How can I get the line written text when the right click is pressed? Can I use pnLine:GetColumnText(pnLine:GetColumnID()) ?
https://wiki.garrysmod.com/page/DListView_Line/GetColumnText You already have what you need/want?
Can you elaborate, what do you mean by line written text? Do you mean get all the data from the row?
Hello All, Kind of .. I want to replace this constant "5" with something dynamic. When the user right-clicks on a ListView box, to copy the text in the dedicated box, rather than always column #5 every time he clicks. I was asking how to index the right-clicked column ID, so I can retrieve its internal text.
Oh I see, kind of a weird use case, definitely not something DListView was designed for, but you should be able to fairly accurately determine which column was right clicked using some math and cursor position. Here are the relevant functions: https://wiki.garrysmod.com/page/DListView/OnRowRightClick https://wiki.garrysmod.com/page/DListView/ColumnWidth https://wiki.garrysmod.com/page/Panel/ScreenToLocal https://wiki.garrysmod.com/page/input/GetCursorPos
Thanks, Rubat. Works ;)
Sorry, you need to Log In to post a reply to this thread.