Need disabled ctrls that look like enabled

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
User avatar
bartek_warzocha
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Nov 05, 2013 2:58 pm

Need disabled ctrls that look like enabled

Post by bartek_warzocha » Thu Nov 21, 2013 7:32 am

Hello
I need a control that will be disabled, but I want to make it look like it was enabled.
I want to do a window viewing mode from the database data without editing or change (applies: wxCheckBox, wxComboBox, wxSpinCtrl...). Disabled controls are not very legible.

I have this:
I_have_this.jpg
I_have_this.jpg (16.89 KiB) Viewed 1256 times
I want this (still disabled - looks like enabled):
I_want_this.jpg
I_want_this.jpg (19.21 KiB) Viewed 1256 times
How to do it in the easiest way? :?
Regards
Bartek

rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Re: Need disabled ctrls that look like enabled

Post by rafae11 » Thu Nov 21, 2013 9:09 am

if you disable the panel holding your controls.
it will look like its still active but you wont be able to click on anything.

User avatar
bartek_warzocha
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Nov 05, 2013 2:58 pm

Re: Need disabled ctrls that look like enabled

Post by bartek_warzocha » Thu Nov 21, 2013 10:49 am

Unfortunately it does not work. When I disable panels (notebook pages), all the children are also disabled and look like disabled.
I wish you all the best.
Bartek

rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Re: Need disabled ctrls that look like enabled

Post by rafae11 » Thu Nov 21, 2013 4:11 pm

i use wxFormbuilder v3.2 and wxwidets 2.9.4
i have a wxnotebook and inserted a panel i uncheck enable in object properties in wxFormbuilder.
i put a sizer and a text box. the text box is enabled.
when i compile and run it doesn't grey out the textbox.

User avatar
bartek_warzocha
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Nov 05, 2013 2:58 pm

Re: Need disabled ctrls that look like enabled

Post by bartek_warzocha » Sun Nov 24, 2013 6:32 pm

Hello
I found a solution to the problem. rafae11, thank you for your commitment to the conversation.
I use VC2010 and I alone create interfaces of my applications. I use wxWidgets 2.9.5 and 3.0.0. To create a windows with preview data mode i use functions, which disable the controls after the window building by constructor.
I installed wxFormbuilder and I analyzed how the code is generated. I came to the following conclusions:

1) If you first set up the notebook pages (parents) and its children, and then disable notebook pages (e.g. by appropriate disable function), then notebook pages and children controls are disabled and are 'grey'.
2) If you disable notebook pages (parents) before adding children :!: (in dialog/window constructor - like wxFormbuilder doing), then notebook pages are disabled ('grey') and controls looks like enabled (not 'grey').
In this case you need to add the appropriate control instructions to the constructor of the window.

It is worth remembering, when planning the program. I will always remember.
Regards
Bartek

Post Reply