wxFrame without icons

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
LiveStudent
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Jun 04, 2019 8:25 pm

wxFrame without icons

Post by LiveStudent » Wed Jun 12, 2019 3:47 pm

Hello!
How can I remove the icon located at the top left of my application?
I don't want it.
I see that it's not defined an empty icon to be used, we "only" have the following:

#define wxICON_WARNING 0x00000100
#define wxICON_ERROR 0x00000200
#define wxICON_QUESTION 0x00000400
#define wxICON_INFORMATION 0x00000800
#define wxICON_EXCLAMATION wxICON_WARNING
#define wxICON_HAND wxICON_ERROR
#define wxICON_STOP wxICON_ERROR
#define wxICON_ASTERISK wxICON_INFORMATION

So, I can't use the following two lines to get my aim

Code: Select all

wxIcon icon(wxICON(wxICON_ERROR));
	this->SetIcon(icon);
By the way, my wxFrame has the wxDEFAULT_FRAME_STYLE:
defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN

I managed to remove the icon removing using these styles only (wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION), but it's not what I want since I want to be able to close my wxFrame if needed.

The question I kindly want to ask you is: how can I solve it?
Last edited by LiveStudent on Wed Jun 12, 2019 5:53 pm, edited 1 time in total.

alys666
I live to help wx-kind
I live to help wx-kind
Posts: 156
Joined: Tue Oct 18, 2016 2:31 pm

Re: wxFrame without icons

Post by alys666 » Wed Jun 12, 2019 4:50 pm

how people know - which icon is on top left of your app?
under ubuntu unity it's a close window icon. but with hack it could be at top right of application.
according to your flags - you removed this close window button successfully ...and are asking - how to close window?
aren't your demands incompatible?
anyway if you removed this close button, you can close window via code.
kinda frame->Close()
Last edited by alys666 on Wed Jun 12, 2019 8:10 pm, edited 1 time in total.
ubuntu 16.04, wxWidgets 3.0.4

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 689
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxFrame without icons

Post by Manolo » Wed Jun 12, 2019 5:23 pm

Perhaps you want a wxDialog instead of a wxFrame.

LiveStudent
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Jun 04, 2019 8:25 pm

Re: wxFrame without icons

Post by LiveStudent » Wed Jun 12, 2019 5:35 pm

alys666 wrote:
Wed Jun 12, 2019 4:50 pm
how people know - which icon in on top left of your app?
you're right. I mean, regardless of which icons appears, I want don't want it.
The default one I have right now and want to remove, is the one that appears in the following picture, at the upper left border:
Image
anyway if you removed this close button, you can close window via code.
kinda frame->Close()
thanks for the kind suggestion! But I'd like to keep alive the chance to close it manually.
Perhaps you want a wxDialog instead of a wxFrame.
thanks @Manolo. I've tried this way too and it works. Mine is a theoretical knowledge: is it possible to "emulate" its behaviour using a wxFrame instead of a wxDialog?

thank you very much to both of you!

alys666
I live to help wx-kind
I live to help wx-kind
Posts: 156
Joined: Tue Oct 18, 2016 2:31 pm

Re: wxFrame without icons

Post by alys666 » Wed Jun 12, 2019 5:48 pm

if you want to close manually the window, return - wxCLOSE_BOX back to flags.
i doubt you can hide this icon, wxwidgets uses native window decoration. it's your os window manager likes this style. Try to configure him somehow.
ubuntu 16.04, wxWidgets 3.0.4

Post Reply