Skip to content

Tab bar cannot be initialized with files due to undefined imageSheet variable #21

Open
@mdsandell

Description

@mdsandell

You cannot call widget.newTabBar() with image files (not an image sheet), due to initWithImageFiles attempting to use (unnecessarily) an undefined "imageSheet" variable. I'm pretty sure this line can simply be deleted to fix the issue, but I'm not sure how to test this myself.

Example taken from documentation:

-- Create the widget
local tabBar = widget.newTabBar(
    {
        left = 0,
        top = display.contentHeight-120,
        width = 580,
        height = 120,
        backgroundFile = "tabBarBack.png",
        tabSelectedLeftFile = "tabBarSelL.png",
        tabSelectedRightFile = "tabBarSelR.png",
        tabSelectedMiddleFile = "tabBarSelM.png",
        tabSelectedFrameWidth = 40,
        tabSelectedFrameHeight = 120,
        buttons = tabButtons
    }
)

Failure:

Variable 'imageSheet' is not declared

File: /Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget_tabbar.lua
Line: 227

stack traceback:
	[C]: in function 'error'
	strict.lua:24: in function <strict.lua:22>
	/Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget_tabbar.lua:227: in function 'initWithImageFiles'
	/Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget_tabbar.lua:851: in function </Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget_tabbar.lua:754>
	(tail call): ?
	/Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget.lua:135: in function </Users/vlad/actions-runner/_work/corona/corona/subrepos/widget/widgetLibrary/widget.lua:122>
	(tail call): ?
	main.lua:841: in function 'createTabBar'
	main.lua:873: in main chunk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions