1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Custom Image Button

Discussion in 'C++' started by shabbir, Nov 27, 2007.

  1. Skezza

    Skezza New Member

    Joined:
    Jul 3, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello,
    I know this thread is 2 years old but I was sent the link by a colleague who is learning WinCE 6 development. He was having problems using more than one CGuiButton. They were disappearing rather inexplicably. For example, pressing on one, then another would remove the bitmap from the first button.

    I ran through the code on my lunch break at work and have found the cause:

    Code:
    void CGuiButton::OnKillFocus(CWnd* pNewWnd)
    {
    	this->Invalidate();
    }
    line 139 of GuiButton.cpp : this->Invalidate(); is unnecessary in my opinion.

    My own experience is fairly middle of the road, but I just wondered why it was there? I cannot see a reason to call Invalidate() on the CGuiButton on kill focus. The only reason to call Invalidate is if the region needs repainting, but for a Bitmap button, I can't see when this would be the case.
    Rather than say this fixes it (it does in my case) I was wondering if you could explain why it was there in the first place as I'm sure it isn't there for nothing?

    Cheers
     
  2. Skezza

    Skezza New Member

    Joined:
    Jul 3, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    For those who aren't sure, comment out the line and try again.
     

Share This Page