[haiku-3rdparty-dev] Re: BPictureButton with own BMessenger

  • From: Brian Hill <perelandra777@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 3 Mar 2011 19:55:42 -0500

On Mar 3, 2011, at 7:32 PM, Robert Stiehler wrote:

> Hi,
> 
> tried it but now change, same problem, same error ;/
> 
> actual code:
> 
> CustomPictureButton::CustomPictureButton(BRect frame, 
>                         const char* name, 
>                         BPicture *off,
>                         BPicture *on,
>                         BMessage *message,
>                         uint32 behavior,
>                         uint32 resizeMask,
>                         uint32 flgs)
> : BPictureButton(frame, name, off, on, message, behavior, resizeMask, flgs)
> {
> }
> 
> 
> CustomPictureButton::CustomPictureButton(BMessage *msg)
> : BPictureButton(msg) {
> }
> 
> 
> CustomPictureButton::~CustomPictureButton() {
> }
> 
> 
> status_t
> CustomPictureButton::Archive(BMessage *msg, bool deep) const {
>     status_t err;
> 
>     err = BPictureButton::Archive(msg, deep);
>     msg->AddString("class", "CustomPictureButton");
>     return err;
> }
> 
> 
> CustomPictureButton*
> CustomPictureButton::Instantiate(BMessage *msg) {
>     if (!validate_instantiation(msg, "CustomPictureButton")) {
>         return NULL;
>     }
>     return new CustomPictureButton(msg);
> }
> 
> Maybe a problem in Instantiate() method or the constructor 
> "CustomPictureButton(BMessage *msg)"?
> 
> 

Hmm, what is the actual text of the error message?

You can try taking out the comment from AddItem and make sure mDeskbarIconId is 
an int32:

status_t err = mDeskbar.AddItem(mBtnCall, &mDeskbarIconId);


Also, try adding the "add-on" key to the archive as such with you application's 
signature:

status_t
CustomPictureButton::Archive(BMessage *msg, bool deep) const {
    status_t err;

    err = BPictureButton::Archive(msg, deep);
    msg->AddString("class", "CustomPictureButton");
    msg->AddString("add-on", "your_app_signature");
    return err;
}


-Brian

Other related posts: