Errors When Button Created as TextOnly

I have a button that I am creating with textOnly set to TRUE, but when I click on it in the simulator I am getting the following error:

File: bad argument #1 to ‘unpack’ (table expected, got nil)

Bad argument #1 to ‘unpack’ (table expected, got nil)

 

stack traceback:

[C]: in function ‘unpack’

?: in function ‘_setState’

?: in function ‘?’

?: in function <?:224>

?: in function <?:218>

 

My button is created as (it is created relative an object called textBox):

 

local btnClose = widget.newButton

  {

    id = “btnClose”,

    height = 25,

    width = 25,

    x = textBox.x + (textBox.width/2) - 25,

    y = textBox.y - (textBox.height/2) + 25,

    label = “X”,

    labelColor =

    {

      default = { .8, 0, 0 },

    },

    font = native.systemFontBold,

    fontSize = 24,

    emboss = true,

    onPress = buttonHandler,

    textOnly = true

  }

 

The button handler:

 

local function buttonHandler(event)

  if event.phase == “ended” then

    if (event.target.id == “btnClose”) then

      – execute code here

    end

  end

end

 

It works find if I do not set textOnly to true, however there is a small gray box where the button is drawn on my Android device (no testing on iOS yet)

 

I tried adjusting the handler but the error is happening before the handler is called…it seems to be internal to the button widget, so is there some other settings I could try?

 

Thank you!

I use textOnly but I’m on daily builds. I’m guessing you’re on 2189 since you have a starter account. This should mean that this issue is fixed in a later update to the widgets. You’re in luck because the widget updates after 2189 have recently released in the opensource repository on Corona Labs Github. Get the widgets from there, findout how to override the internal version with the version you downloaded and then you’ll be fine. Good luck.

Thanks I am working around it for now by using a 1px transparent image  :wink:

Thats a very good workaround! Great job figuring that one. 

I use textOnly but I’m on daily builds. I’m guessing you’re on 2189 since you have a starter account. This should mean that this issue is fixed in a later update to the widgets. You’re in luck because the widget updates after 2189 have recently released in the opensource repository on Corona Labs Github. Get the widgets from there, findout how to override the internal version with the version you downloaded and then you’ll be fine. Good luck.

Thanks I am working around it for now by using a 1px transparent image  :wink:

Thats a very good workaround! Great job figuring that one.