wxBitmapToggleButton not showing bitmap and text label

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
Prezla
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Sep 22, 2022 3:09 am

wxBitmapToggleButton not showing bitmap and text label

Post by Prezla »

Hello,

I would like to have a button that displayes bitmap image and text so I'm using wxBitmapToggleButton. Under Ubuntu 22.04 only bitmap shows up on the button the text label doesn't show up. Under Windows 10 both bitmap and text label show up on the button. I've narroed it down to wxHAS_BITMAPTOGGLEBUTTON not being defined under Ubuntu. I'm thinking it's a configuration issue but I cannot spot it. Any help would be appreciated. I'm using latest wxWidgets 3.2 release from https://docs.codelite.org/wxWidgets/repo321/

Code: Select all

            std::unique_ptr<wxImage> img;
            img.reset(new wxImage(myIcon1, wxBITMAP_TYPE_PNG));
            img->Rescale(32, 32);
            int btnIndex = ID_BUTTON_BASE_PLAY + buttonIndex++;
            wxBitmapToggleButton* button = new wxBitmapToggleButton(this, btnIndex, wxBitmapBundle(*img.get()), wxPoint(0, 0), wxSize(180, 36));
            button->SetLabel("Some Button Label");
My simple Makefile

Code: Select all

APP:= my-desktop-app
CXX:= g++

LIB_INSTALL_DIR?=./
APP_INSTALL_DIR?=./

SRCS:= $(wildcard *.cpp)

INCS:= $(wildcard *.h)

PKGS:= json-glib-1.0 gtk+-3.0

OBJS:= $(SRCS:.cpp=.o)

CFLAGS+= `pkg-config --cflags $(PKGS)`
CFLAGS+= `wx-config --cxxflags`
#CFLAGS+= -I/usr/include/wx-3.0 -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.0

WX_CXXFLAGS = $(shell wx-config --cxxflags)
#CFLAGS+= ${WX_CXXFLAGS}

LIBS:= `pkg-config --libs $(PKGS)`
WX_LIBS = $(shell wx-config --libs)
#LIBS+= ${WX_LIBS}
LIBS+= `wx-config --libs html,adv,core,xml,base`
LIBS+= -L$(LIB_INSTALL_DIR) -lpthread -Wl,-rpath,$(LIB_INSTALL_DIR)	   

all: $(APP)

%.o: %.cpp $(INCS) Makefile
	$(CXX) -c -o $@ $(CFLAGS) $<

$(APP): $(OBJS) Makefile
	$(CXX) -o $(APP) $(OBJS) $(LIBS)

clean:
	rm -rf $(OBJS) $(APP)

User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxBitmapToggleButton not showing bitmap and text label

Post by doublemax »

I you search for the location where wxHAS_BITMAPTOGGLEBUTTON is defined, you'll see that it's only available under GTK2. So i assume you're using GTK3? If yes, you're out of luck.
Use the source, Luke!
Prezla
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Sep 22, 2022 3:09 am

Re: wxBitmapToggleButton not showing bitmap and text label

Post by Prezla »

Yes I'm using GTK3 :(
Maybe I can use Wayland one day.
Thanks
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxBitmapToggleButton not showing bitmap and text label

Post by ONEEYEMAN »

Hi,
It doesn't matter whether you use Wayland or X11.
This is not supported under GTK3...

Thank you.
Post Reply