As documented:
"If not all tabs can be shown at once, the tab control displays an up-down control so that the user can scroll additional tabs into view."
http://msdn.microsoft.com/en-us/library/bb760550%28VS.85%29.aspx
I don't want this. I don't want an up down control to show if I have too many and I don't want multiline tabs. I want a single strip. I will handle the case of too many tabs with a control I create myself, but I don't want the up-down control. Thanks
There's no style for that, so i believe the only way is a bit of hacking. From what i can see with my Spy++, the updown control is a true child control of the tab control with id = 1. So, you can actually hide it with ShowWindow().
Related
I want to know that whether I can add a textbox or label by changing the options in combo box. For example, I have 2 options in Combobox. If I choose the #1, it must show me 2 textboxes, but if I choose #2 it must show 3 textboxes.Can I do something like this in Visual Studio C++?
This can be done in two ways:
Dynamically create and destroy the edit controls using CreateWindowEx and DestroyWindow.
Statically create your GUI with 3 edit controls and set the visibility of the controls based on the selection using ShowWindow.
Have as many text-boxes you want. But hide them.
Handle CBN_SELCHANGE (ON_CBN_SEL_CHANGE in MFC).
In the handler, show (or hide) the text boxes depending on selection.
Showing/hiding text boxes aren't good from UI perspective. You better enable/disable them appropriately. You may put alternate text when they are disabled, and bring back original change when they have to be enabled.
Creating textboxes at runtime, and then deleting them isn't' good approach. You will need to keep track of Win32 UI handle and/or MFC object. This approach will also need more of UI resource creation/deletion, parent-child relationship handling et. al.
I need a QTabWidget with icons only:
How can I hide the label text of a tab in Qt? I cannot set the text to an empty string (""), as I am using docked widgets ( QDockWidget ) and the label text is set automatically (and I need it if the widget is floating).
But in tabbed mode I just want to display the icons (of the tabs).
Possible approaches:
Font size to 0?
I need to create my own bar class and override the paint event as here
Anything easier / cleaner?
--- Edit ---
Ok, the "set window title to empty string, and reset it the original text" approach works. I am using the topLevelChanged signal for this. However, it has some drawbacks, as the empty text still occupies some space. Another issue, with the text the tooltip is gone, and I cannot set it back.
What I am currently trying is something in-between the "text empty" and Prasad Silva's approach. I try to identify the text label inside the tab and set its size to 0, then reset it. It's slightly different, but would keep the text intact.
Btw, I see a line on top of my tabs, any idea what this is (where it comes from)?
Edit: There seems to be no "easy way" (style sheet, attribute) for this, see Hiding bottom line in QTabBar
Maybe I will create the whole tab bar on my own, as the automatically generated stuff is just too hard to handle (agree with PS on this).
This can not be done easily. Use empty text.
The way I solved something like was to create a QDockWidget subclass that installed a QWidget subclass as the titlebar (via setTitleBarWidget). This gave me control over showing/hiding the text in the titlebar when the dock widget fires topLevelChanged, dockLocationChanged and visiblityChanged.
This is really a big hack to get around the fact that Qt has refused to expose a public API for the docking system. We have since moved on to a custom docking implementation due to these limitations.
If you do not want to see the text, you can set it to an empty text after saving the current text, and when you want to see it again, restore it from the stored variable.
I do not think there is anything in the API for this not so common case, which means you will need to do it yourself.
Now, you could claim that it is tedious to do for many widgets, but on the other hand, you could write a simple hash define or inline function to do this repetitive work for you, which would only result a one-liner call, basically, which you would need to use anyway when changing the state.
I know on Widows, this key is space, for example, space will perform the button's click which is its action,same for radio buttons etc. Is this the standard. If not, what is?
Thanks
Yes, on a MS Window system these keys are handled by windows OS for navigation.
TAB move input focus to the next control.
TAB + SHIFT move input focus to the previous control.
ENTER Activate a button/menu.
SPACE check/uncheck a checkbox.
ALT activate the first menu group. Use arrows to navigate in menu.
UP/DOWN in a group, change radio button
ALT + DOWN In a combobox, open drop down list
There are probably more, but these are the on I came up with right now...
Was it this you had in mind?
So basically, I have a Tab Control (WC_TABCONTROL) and I want to place all of the controls that go with a single tab page on a single window (control, if you will, or panel). I want to create something like the panel in wxWidgets, so that when I call ShowWindow(panel, SW_HIDE), I can hide the panel and all controls inside it. I hope you understand. Thanks, Grant.
I think what you want is a borderless, captionless dialogbox. I've used that very thing with tab-controls. Show and hide them on the tab control click events.
Actually some tab-controls will use the caption of the dialogbox in their own caption. YMMV.
Here's an old-school example. It shows all the basics.
http://msdn.microsoft.com/en-us/library/bb760551%28VS.85%29.aspx
HTH
I have a CListCtrl with checkboxes. I want to be able to disable one of the items so that the user cannot click the checkbox. Is this possible? If so, how?
Edit:
Found the specifics on how to hide a checkbox in another question
Need only some rows in a CListCtrl control to have check boxes
Shortly: Not easily possible.
You'll need to sub-class the CListCtrl and implement this behavior on your own or download for example the MFC Grid Control that allows you to do that.
As for the removing check-boxes idea, yes, that might be possible, MSDN:
Version 4.70. Enables check boxes for items in a list-view control. When
set to this style, the control creates
and sets a state image list with two
images using DrawFrameControl. State
image 1 is the unchecked box, and
state image 2 is the checked box.
Setting the state image to zero
removes the check box.