Setting Keyboard Focus To Trackdsp-Effect Or Diskbrowser?

Hi.

renoise().window.lock_keyboard_focus=true  
  

Will set the keyboard focus to the center one (sample editor, pattern editor, order list, instrument keymap)

How would I go about setting the keyboard focus on a Track DSP effect I’ve just added with a script? :)
Or to the diskbrowser?
or to the pattern matrix/order list?

Well, I did find one way of doing it, but couldn’t seem to get it going

  
renoise.song().selected_track:insert_device_at(device_name, 2)  
renoise.song().selected_device_index=2  

Doesn’t choose the just_inserted_tool, but does choose whichever happens to be 2 before the plug is added :) another case where a “delay” would assist the functionality, right?

Have you tried it this way?

  
local just_inserted_tool = renoise.song().selected_track:insert_device_at(device_name, 2)  
renoise.song().selected_device_index = just_inserted_tool  
  

edit:
Maybe even:

  
renoise.song().selected_device_index = renoise.song().selected_track:insert_device_at(device_name, 2)  
  


This is speculation, though.

That code works just fine for me - creates a new device right after the track’s vol/pan device and then selects that device, no “delay” needed. The keyboard focus stays on the pattern editor, though, which I think is not what you want.

just_inserted_tool is a renoise.TrackDevice, renoise.song().selected_device_index is a number, so the assignment on line 2 throws an error. :( Additionally, the renoise.song().selected_device property is read-only, so I don’t think there’s a way to set the selected device with the actual renoise.TrackDevice object.

= true

Missed the obvious fact it returned a device object, not its index. But… Apropos: Are there supported ways of moving keyboard focus around in the API?

I’d love for there to be. Being able to set keyboard cursor focus to Disk Browser would be amazing, especially since discovering that left+right control which sample is chosen in the sample_keyzone_mode, and pressing enter on a sample in disk browser loads the sample to selected keyzone slot.

Weirdly enough, got it working in Mixer view:

renoise.tool():add_keybinding {  
name = "Global:Track Devices:Load George Yohng's W1",  
invoke = function() renoise.app().window.lower_frame_is_visible=true  
renoise.app().window.active_lower_frame=1  
renoise.song().selected_track:insert_device_at("Audio/Effects/AU/aufx:4Fwl:Yhng", 2)  
renoise.song().selected_track.devices[2].external_editor_visible=true  
renoise.song().selected_device_index = 2  
end}  

However, the cursor focus will only show in trackdsp view (lower frame) if the cursor focus is already on trackdsp…
So it’s half-working… And we return back to “Cursor Focus for Upper Frame & Lower Frame” setting :)