Remove horizontal divider line from mfc wizard - c++

I have a mfc wizard in which I implemented code for re-sizability. There's a horizontal divider line at the bottom of the wizard dialog, as shown by the red arrow in the picture, which I need to get rid of.
Since I don't know the ID of that line, I haven't included it in my resize code. Because of that, when I resize the wizard, the line keeps messing up the dialog.
It would be a great help if the ID of the divider or a method to remove it can be found.
Thanks.

On my machine (Win8.1) the ID is 3026, as shown with Spy++; have a look if it's the same on yours and/or other machines. Otherwise you could still enumerate all windows and look for the one with the STATIC window class. Then just DestroyWindow() that.
That said, I don't think the line is the issue here; the issue is that your dialog isn't redrawing itself properly. And I speculate that this is caused by it assuming a fixed size. Wizards aren't meant to be resized (see http://msdn.microsoft.com/en-us/library/windows/desktop/bb774544%28v=vs.85%29.aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/bb246463%28v=vs.85%29.aspx). Even if you destroy the line, other content you will put there is going to be invalidated incorrectly as well, I think.
Maybe you can work around it by manually invalidating or playing with various clip related windows styles. However the real answer is 'don't do that'.

Related

How to build an advanced link in draw.io

I am looking for how you can build a link in draw io, so that when you click first, it hides a layer and then opens a different page of the same draw io document.
so far i tried this:
data:action/json,{"actions":[{"toggle": {"cells": ["SvuciECQg7tZUCU10AH1-3"]}},{"open": "data:page/id,IZEQzf0yfGXm-2QJ5-Q8"}]}
But it seems that the Toggle is executed after the Open, and I need the Toggle to be first and then the Open.
I even tried to do an Open of the same page I'm on, do the Toggle, and then do the Open of page 2, but it didn't work. I would appreciate if anyone knows how to do this, thank you very much.
This is pretty old, you've probably figured it out or given up by now. In case you haven't:
If you want to Hide a layer, just Hide the layer. This did exactly what you're describing: (I've inserted your IDs)
data:action/json,{"actions":[{"hide":{"cells":["SvuciECQg7tZUCU10AH1-3"]}},{"open":"data:page/id,IZEQzf0yfGXm-2QJ5-Q8"}]}
If you need to toggle the layer back on, you'll need to Show it again. The code you have works, it's kindof unexpected not knowing if the layer is showing or hidden at the start.
Unless the layer you want to show/hide is on the different page.
You won't be able to interact with objects on a page that's not in scope. In that case, you probably want to hide the layer by default. That way, when you Open the second page, the layer is already hidden.

Disabling a ComboBox item in Win32 API

I would like to disable an item in a combobox in my Win32 application (C++). I'm not quite sure how to do this. I'm trying to achieve something that looks like this:
Notice how CollectionItem2 and 3 are greyed-out.
Any help would be very much appreciated!
If you truly need a combobox for this, then (as #IInspectable said) you'll need to do a custom drawn control. Basically, you'll have to store some information saying which items are disabled/grayed, and draw the items appropriately based on whether they're enabled or not.
There may be a somewhat easier way though. This is normally done with a Split Button. This is button with the BS_SPLITBUTTON style set. When the drop-down part of the button is clicked, it sends a BCN_DROPDOWN notification.
You normally respond to that by displaying a menu, typically using TrackPopupMenu to display it immediately below the button (or immediately to its right, if you prefer). This is a normal menu, so it can have items enabled, disabled, grayed, have check boxes, etc., as you see fit.
If you're using MFC, it has a CSplitButton class that wraps the Split Button, simplifying the code a little bit--you can pass an identifier of a menu and sub-menu when you create the CSplitButton object, and it handles things from there.
A sample result probably looks pretty familiar:
Note: MFC also has a CMfcMenuButton class. This has roughly similar functionality, but is somewhat clumsier to use. If memory serves, it is compatible with older versions of Windows (but the split button goes back to Vista, so it's fine unless you really need to support XP).

MFC: Line control for separating parts of dialog boxes in C++

I am looking for the class name of an MFC Common Control for the caption and line that divide the dialog box into sections: "Section", "Headers and Footers", "Page, and "Preview" in the image below.
It appears that this likely a standard control, but I haven't been able to figure out how to create it so far.
Unless you're dead set on that exact look, this is done with a group box. It will look a little different, as it draws a box all the way around a group, so the result would look something like this:
If you're really set on a line at the top but not bottom or sides, you'll probably have to do that yourself. You'd (at least normally) do this with a custom control. As simple of one as you're looking at here (caption, line, doesn't need to accept any input from the user) that'll be a trivial one to implement, but you'd normally do it as a separate project, then use that in your project.

Qt: How to show icon when item selected

I have a QListWidget containing items which have icons and when the items are selected the icon is just highlighted out. Is there a way to prevent this? I can't use stylesheets because it's for an embedded application and including them takes up too much space.
thanks
I suppose when you say "Highlithed out", you mean that the icon colors don't render well when the line is selected, and therefore, you can't see properly the icon...
Maybe you could consider using a different icon when the item is selected. It's possible to do so by specifing a mode to your icon.
Example :
QIcon MyIcon(":/images/foo");
MyIcon.addFile(":/images/bar", QSize(...), QIcon::Selected);
You can easily make a try in QtDesigner and see the results...
Hope it helps a bit !
Certainly, drawing on a black-and-white screen presents its challenges.
It sounds like you just want to change the appearance of the interface, not any functionality. If this is the case, a QItemDelegate-derived class (or QStyledItemDelegate) is almost certainly what you want. In particular, the drawDecoration function looks like it is used to draw an icon, and the style options should include whether it is selected. The simplest fix would be to override that function, set the selected flag in the options to false, then pass it up to the parent's function.

How to remove the GtkTreeView sorting arrow?

I need to remove the sorting arrow from a column header. This can be done by calling set_sort_indicator(false) on the column.
The arrow isn't displayed, but the space for it seems to still be reserved. If the title of the column is big enough to fill all the header, the last part is clipped (where the arrow should be).
Is there a way to make the title fill the whole header?
This seems to be a bit weird in GTK+. I downloaded and read through relevant parts of the GtkTreeViewColumn's code, and it seems to use this logic:
if (tree_column->show_sort_indicator ||
(GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);
Where arrow is the widget holding the arrow. This seems to indicate that the arrow widget is always packed into the horizontal box that makes up the column's header, and then just hidden (not removed) if it's not supposed to be visible. That will mean it's still there in the box, occupying space and causing the label to be clipped.
I'd recommend searching through the GTK+ bugtracker for an issue about this, and if none is found, create one.
Ok, so I've submitted a bug report to gtk. They said that it is not an issue and it won't be fixed.
I've looked on other graphical toolkits (windows, qt) and their implementation is different, but this doesn't seem to matter to the guys in the gtk team.
Ok you can use set_clickable method to the the column you don't want it to have an arrow
then use signal_connect to the clicked signal and bind it to a function which will use get_sort_column_id to get the current sort order then apply the reverse sort order using set_sort_column_id.