View Single Post
Old 05-15-2019, 08:23 PM   #24
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 389
Default

Okay, I took this code and moved it to library/classes/Class - IButton.lua

And then tried calling it by editing the simple template:

Code:
-- NoIndex: true

--[[
	Lokasenna_GUI example

	- Getting user input before running an action; i.e. replacing GetUserInputs

]]--

-- The Core library must be loaded prior to anything else

local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
if not lib_path or lib_path == "" then
    reaper.MB("Couldn't load the Lokasenna_GUI library. Please run 'Script: Set Lokasenna_GUI v2 library path.lua' in your Action List.", "Whoops!", 0)
    return
end
loadfile(lib_path .. "Core.lua")()

GUI.req("Classes/Class - IButton.lua")()

-- If any of the requested libraries weren't found, abort the script nicely.
if missing_lib then return 0 end




------------------------------------
-------- Functions  ----------------
------------------------------------


local function btn_click()
	
	reaper.ShowMessageBox(
		"This is where we pretend to perform some sort of fancy operation with the user's settings.\n\n"
		.."Glue the processed items together afterward: "
		, "Yay!", 0)

	-- Exit the script on the next update
	--GUI.quit = true
	
end




------------------------------------
-------- Window settings -----------
------------------------------------


GUI.name = "Example - Typical script options"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 400, 200
GUI.anchor, GUI.corner = "mouse", "C"




------------------------------------
-------- GUI Elements --------------
------------------------------------
-- Required properties: z, w, h, image, func, params
iProps = {
		type = "IButton",
		z = 1,
		x = 0,
		y = 0,
		w = 48,
		h = 40,
		image = "C:\\Users\\emoon\\Documents\\_REAPER\\Scripts\\LBX\\LBXCS_resources\\controls\\switchesMed.png",
		func = btn_click
		--params????
}
GUI.New("img_btn",iProps)


GUI.Init()
GUI.Main()
I get "Core.lua:747: attempt to call a nil value (method 'new')"

What am I doing wrong here?
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote