Author Topic: error C2665: 'ButtonAdd' : none of the 2 overloads could convert all the argumen  (Read 3066 times)

Micboy

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-2
    • View Profile
I seem to be unable to resolve this! Could someone help me please!
The error is:
error C2665: 'ButtonAdd' : none of the 2 overloads could convert all the argument types

The code is:
Code: [Select]
        //Already initialised cn1, SP_Button, and OnMenu(int id, int evt)
cn1 = ContainerAdd(0, 0, 0); //ContainerAdd(cn, x ,y)
MenuView[0] = ViewAdd(cn1,"Images/Menu1.png", 0,0);
SP_Button = ButtonAdd(cn1, "Images/Single_Player.png" ,60 ,260, OnMenu1, 1);

int ButtonAdd(int cn,char *filename, int x, int y, int (*callback)(int id), int id);

I'm trying to figure out whats wrong, but cant seem to identify the problem!
Thank you in advance,

Micboy


PS, the full error is:
error C2665: 'ButtonAdd' : none of the 2 overloads could convert all the argument types
1>          dfsdk\dragonfiresdk\lights\dragonfiresdk.h(244): could be 'int ButtonAdd(int,char *,int,int,int (__cdecl *)(int),int)'
1>          while trying to match the argument list '(int, const char [20], int, int, overloaded-function, int)'
« Last Edit: January 15, 2013, 01:45:35 pm by Micboy »

EricB

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +1/-0
    • View Profile
Not sure if this will help but I noticed in the ButtonAdd api instructions "The filename used with a button should not specify the extension since the internal button code will automatically append 1.png and 2.png to load the images. " I never added the extensions so I don't know what would happen if you did. Just a thought.
EricB

DeadSn0wMan

  • Guest
You can't have the Onresponse function within a class....which sucks I know....

Micboy

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-2
    • View Profile
Thanks for your help guys. Realised that Im not allowed OnButton(int id, int event), only id.

Case closed!!!

bous006

  • Guest
Hey guys, I was reading this because i  also have a problem with my buttons. My app will compile but the image only shows up as a red dot. Here is my code and if anyone could help that would be great. Pressing the button and all that works great, its just loading the image.

button = ButtonAdd("Images/Button", 75, 0, OnButton,0);

nednones

  • Guest
What is the exact filename for the buttons that you are using for "button"

DeadSn0wMan

  • Guest
I don't think you need the "Image/" before the filename in the buttonAdd function

EricB

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +1/-0
    • View Profile
Also remember you must have 2 images for the button. Button1 and Button2, Button1 is for the unpressed image and Button is for the pressed image. They can be the same image if you like but must be named 1 & 2. Also make sure the letter case is correct, if not it will work in the simulator but not on the device.
EricB

bous006

  • Guest
Thanks guys, i used this info to resolve my problem.