Home Download Buy Blog Forum Support

API Request: set_active_view_in_group

API Request: set_active_view_in_group

Postby phillip.koebbe on Sun Feb 26, 2012 9:38 pm

We have an API for getting the active view (window.active_view_in_group(group)) and it would be nice to have a corresponding set_active_view_in_group(view, group). I encountered a situation today where it would be handy:

I'm working on a plugin to open associated files (code/test pairs) which opens a file and then potentially moves it to a different group. If the reference file (the one open initially) has a neighbor to the right, that neighbor is active in the view after the associated file is moved. To work around this, I did this:

Code: Select all
associated_view = self.window.open_file(path_to_associated_file)
self.window.set_view_index(associated_view, new_group, new_index)
self.window.focus_view(existing_view)
self.window.focus_view(associated_view)


If that doesn't make sense, I can create a short screencast illustrating the behavior. Since window.open_file activates the newly opened file, it is already active in the target group. If there were a way to focus a view in a particular group, that would have saved me a call. It could have looked like

Code: Select all
current_group, current_index = self.window.get_view_index(existing_view)
associated_view = self.window.open_file(path_to_associated_file)
self.window.focus_view(existing_view, current_group)


Thoughts?
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests