View Single Post
Old 01-20-2019, 06:49 PM   #218
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by mespotine View Post
Yes...but it's tricky and fiddly.
You could toggle the sort of the columns, but I'm not sure how to get the width of the LV columns. Here I just send the mouse messages to the control where I want to click inside it. For example the Size column left edge on my explorer is at about 100 pixels from the left of the LV control, If I send a message just to the right of that it toggles the Size column...

Code:
function JS_LMouseDownUp(hWnd, x, y)
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONDOWN", 1, 0, x, y)
  reaper.JS_WindowMessage_Post(hWnd, "WM_LBUTTONUP", 0, 0, x, y)
end

-- get handle to media explorer
local title = reaper.JS_Localize("Media Explorer", "common")
local explorer = reaper.JS_Window_Find(title, true)
-- get handle to 'File' Listview
local container =  reaper.JS_Window_FindChildByID(explorer, 0)
local lv = reaper.JS_Window_FindChildByID(container, 1000)
-- get handle to listview header
local lv_header = reaper.JS_Window_HandleFromAddress(reaper.JS_WindowMessage_Send(lv,"0x101F",0,0,0,0))
-- get LV column count - BUT HOW TO GET COLUMN WIDTHS?
lv_column_count = reaper.JS_WindowMessage_Send(lv_header,"0x1200",0,0,0,0)
-- send mouse click to lv column header 102 pixels to right of left edge.
JS_LMouseDownUp(lv_header, 102, 0)

Last edited by Edgemeal; 02-07-2019 at 08:03 AM. Reason: add Y param
Edgemeal is offline   Reply With Quote