wxBitmap in wxButton not centred when building with Xcode

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
t_wangda
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Apr 09, 2020 8:40 am

wxBitmap in wxButton not centred when building with Xcode

Post by t_wangda » Thu Apr 09, 2020 8:59 am

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);
Attachments
Screen Shot 2020-04-09 at 4.52.52 PM.png
Screen Shot 2020-04-09 at 4.52.52 PM.png (38.36 KiB) Viewed 374 times

Post Reply