Page 1 of 1

wxBitmap in wxButton not centred when building with Xcode

Posted: Thu Apr 09, 2020 8:59 am
by t_wangda
Hi team, i am building a desktop GUI using wxWidgets-3.1.3 on 3 platforms: Windows, Mac and Linux.

The home page is as attached, which just shows 3 tile buttons. Each button has a statictext description below and a bitmap in the button.

However, when I build on Windows and Linux, bitmap pictures are able to show in the middle of the button. When i tried to build using XCode on mac, the position of the bitmaps get distorted as shown. I know the root cause is because the bitmap Direction is wxLEFT by default.

I have tried:

adding wxBU_NOTEXT style to each button, but it doesn't work.

I need this UI by next week. So any help will be much appreciated !

Code: Select all

	wxImage::AddHandler(new wxPNGHandler);
	wxBitmap DataValidationIcon = wxBITMAP_PNG_FROM_DATA(Data_Validation);
	wxBitmap ActiveIdleIcon = wxBITMAP_PNG_FROM_DATA(Active_Idle);
	wxBitmap SDKDemoIcon = wxBITMAP_PNG_FROM_DATA(SDK_Demo);
    
    DataValidationBtn->SetBitmap(DataValidationIcon);
	ActiveIdleBtn->SetBitmap(ActiveIdleIcon);
	SDKDemoBtn->SetBitmap(SDKDemoIcon);