[Solved] swap note_column. Where to save data to keep them?

This seems to be the most appropriate order:

-------------------------------------------------------------------------------------------------
--local global variables/tables
main_dialog = nil
local rdn_main_title = " Rodent"
pht_version = "1.1 build 0001"
rns_version = renoise.RENOISE_VERSION
api_version = renoise.API_VERSION
---
vb = renoise.ViewBuilder()
vws = vb.views
rna = renoise.app()
rnt = renoise.tool()
---
song = nil
function song_obs()
  song = renoise.song()
end
if ( song == nil ) and not ( rnt.app_new_document_observable:has_notifier( song_obs ) ) then
  rnt.app_new_document_observable:add_notifier( song_obs )
end

-------------------------------------------------------------------------------------------------
--require
require ( "lua/file_1" )
require ( "lua/file_2" )
--
require ( "lua/keyhandler" )

-------------------------------------------------------------------------------------------------
--main functions

--
--

song = nil – the global

function song_obs() – the function of conversation

song = renoise.song()

end

if ( song == nil ) and not ( rnt.app_new_document_observable:has_notifier( song_obs ) ) then – the condition: song == nil ?

rnt.app_new_document_observable:add_notifier( song_obs ) – the new document observable

end

If this works correctly, it would be most comfortable for a tool that includes several windows. song is only defined once.

Nah… I don’t think so. Is your GUI+buttons really working even when installing now?

Yes!

You can try it yourself with this new template:8072 com.ulneiz.Rodent.xrnx

It seems to work well in all scenarios.

Nope… not when installing by double-clicking.

Remove the “song_obs()” call from the dialog function. No cheating :slight_smile:

My solution above seems to work universally.

Nope… not when installing by double-clicking.

Remove the “song_obs()” call from the dialog function. No cheating :slight_smile:

My solution above seems to work universally.

^_^I forgot to delete it :blink:

-------------------------------------------------------------------------------------------------
--local global variables/tables
main_dialog = nil
local rdn_main_title = " Rodent"
pht_version = "1.1 build 0001"
rns_version = renoise.RENOISE_VERSION
api_version = renoise.API_VERSION
---
vb = renoise.ViewBuilder()
vws = vb.views
rna = renoise.app()
rnt = renoise.tool()
---
song = nil
function song_obs()
  song = renoise.song()
end

-- catching new song / start renoise
rnt.app_new_document_observable:add_notifier( song_obs )

-- catching installation scenario
if pcall ( function() return renoise.song() end ) then
  song = renoise.song()
end

-------------------------------------------------------------------------------------------------
--require
require ( "lua/file_1" )
require ( "lua/file_2" )
--
require ( "lua/keyhandler" )

-------------------------------------------------------------------------------------------------
--main functions

Yes now!!! Thanks!

song = nil

**function song_obs()
song = renoise.song()
end

– catching new song / start renoise
rnt.app_new_document_observable:add_notifier( song_obs )

– catching installation scenario
if pcall ( function() return renoise.song() end ) then
song = renoise.song()
end**

Ufff, to have to get here.For me, this “song” issue has always been a nuisance. This should be done in the API in another way so as not to have so many problems with renoise.song ().But hey, this seems to be the best solution so far I’ve seen.

Then the final tool template looks like this (work fine!):8073 com.ulneiz.Rodent.xrnx

Look at this!!!.. To define some important globals:

  • vb = renoise.ViewBuilder() --ok, easy!
  • vws =vb.views --ok, easy!
  • rna = renoise.app()–ok, easy!
  • rnt = renoise.tool()–ok, easy!
  • song = renoise.song() --no ok, problems for this global!!! In addition, in most tools is the most needed!

It would be nice to detail this whole thing in the thread of renoise tool speed optimization initiative :https://forum.renoise.com/t/renoise-tools-speed-optimization-initiative/45510

Especially in the type of more complex tools, like this template, you can invoke several internal windows in the same tool, including several files through require(“file”).

Yeah I’ll make a post there eventually.

Yeah I’ll make a post there eventually.

Perfect! :slight_smile: