View Single Post
Old 01-24-2020, 01:08 PM   #915
Human being with feelings
amagalma's Avatar
Join Date: Apr 2011
Posts: 2,203

Originally Posted by Edgemeal View Post
Not sure if the API has been updated since I tried that (post 249), but I ended up doing it like,..

itemCount = reaper.JS_WindowMessage_Send(combo, "CB_GETCOUNT", 0,0,0,0 )
cur_index = reaper.JS_WindowMessage_Send(combo, "CB_GETCURSEL", 0,0,0,0) -- save current index
for i = 0, itemCount-1 do 
  reaper.JS_WindowMessage_Send(combo, "CB_SETCURSEL", i, 0,0,0)
  t[#t+1] = reaper.JS_Window_GetTitle(combo,"") -- save item text to table
reaper.JS_WindowMessage_Send(combo, "CB_SETCURSEL", cur_index, 0,0,0) -- restore index
Odd thing is, I can't get the handle to that ComboBox or any of the children on that window, I got combobox handle from SPY++ to test that code.

I tried to do the same with a ListBox but it didn't work. Any idea why? Is there any other way?

t = {}
wnd =  reaper.JS_Window_Find( "Theme development/tweaker", true )
listbox = reaper.JS_Window_FindChildByID( wnd, 1209 )
itemCount = reaper.JS_WindowMessage_Send(listbox, "LB_GETCOUNT", 0,0,0,0 )
cur_index = reaper.JS_WindowMessage_Send(listbox, "LB_GETCURSEL", 0,0,0,0) -- save current index
for i = 0, itemCount-1 do 
  reaper.JS_WindowMessage_Send(listbox, "LB_SETCURSEL", i, 0,0,0)
  t[#t+1] = reaper.JS_Window_GetTitle(listbox,"") -- save item text to table
reaper.JS_WindowMessage_Send(listbox, "LB_SETCURSEL", cur_index, 0,0,0) -- restore index
amagalma is offline   Reply With Quote