View Single Post
Old 08-08-2018, 03:08 AM   #256
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
1. That's strange - it should be redrawing automatically. Try adding self:redraw() at the end.
No change. However I discovered that the second time I click with
right mouse the item is selected.
Quote:
2. It can just be self.onmouseup(). When you call a function with :, Lua secretly gives it the name to the left of the : as a parameter called self to work with.
Ok, learned something new again! :-)

Edit: Ooooops, got crash:

Code:
Error: Class - Listbox.lua:159: attempt to index a nil value (local 'self')

Stack traceback:
	Core.lua:72: in metamethod '__index'
	Class - Listbox.lua:159: in field 'onmouseup'
	DLT_ToDoList.lua:398: in field 'onmouseup'
	DLT_ToDoList.lua:439: in method 'onmouser_down'
	Core.lua:905: in field 'Update'
	Core.lua:419: in field 'Main_Update_Elms'
	Core.lua:286: in function <...am Scripts/Development/Lokasenna_GUI v2/Library/Core.lua:282>
		[C]: in function 'xpcall'
	Core.lua:282: in function <...am Scripts/Development/Lokasenna_GUI v2/Library/Core.lua:281>

Lokasenna_GUI:	v2.15.5
Reaper:       	5.93/linux64
Platform:     	Other
Quote:
3. You don't need to a call to GUI.Listbox.mouser_down in this case - that function doesn't exist. It is important to check though, and if it did that would be the correct thing to do. It's necessary when you want to add to an existing function - you run your own code, and then you tell it "do what you normally do".
I checked the class file for Listbox, and you are right, it doesn't exist.
BUT this makes me VERY confused - how can I show the dropdown with right
click in Listbox if onmouser_down doesn't exist!? It shows up just like I
expected, and the selection in dropdown is working fine.
Quote:
4. onmouseup is the right one to call because onmousedown only affects the scrollbar. You can see which methods are used, and what they do, by looking in the class files.

If it's still giving you trouble, PM with me the script and I can have a look.
I will look at this a bit more and if I cant solve it I PM you.
Im very grateful for your help!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote