how to create more no of controls dynamically to wxscrolledwindow in c++ - c++

I have a list containing a number of different controls (wxStaticText, wxTextCtrl, wxCheckBox, wxRadioButton, wxComboBox, wxListButton). I'm currently creating a large number of controls dynamically in my wxScrolledWindow. When I create more than 5,000 controls this way, my EXE hangs if I scroll the window.
I want to fix this problem by only creating the objects shown on-screen, and dynamically creating/destroying objects as I scroll my window. How do I implement this?

You shouldn't create that many controls. There is a limit of 10000 windows under Windows and while it can be increased, it's really not a wise thing to do.
Creating the controls on demand when they're scrolled into view risks being tricky. Instead, consider using wxGrid or wxDataViewCtrl to display your data and create the controls only for the (single) item being currently edited.

Related

Show 'full size' of a window control

I have a bit of an issue that involves a CMFCPropertyGridCtrl.
Normally you assign a window size to it and if it cannot fit it sets up a vertical scroll bar (for all I can see this is just the normal generic CWnd associated scrollbar). And this is great for when you just want to dump the control inside a re-sizeable window.
However, I have the reverse situation, where I would like to fit my outer window so that it shows the entire height of the control (such that no scroll bar needs to be created). In order to do that I somehow needs to get an ideal height given the contents of the control. Is that possible in some generic way or just for CMFCPropertyGridCtrl ?
To give a little more background, I have multiple gridctrl's on top of each other so to speak. Therefore, I have put a scrollbar on the outer window so you could say they share that scrollbar (and this one is working just fine). I could go into details why I want this design(as opposed to just one gridctrl with everything), but basicly it's a kind of cards where each card/element has it's own set of properties.

How to minimize screen flickering when carrying out multiple graphic changes in Qt?

I am implementing fullscreen function (and restore) in my application, which will hide toolbars, few other qt widgets to show a single window in fullscreen. For the same I pass individual high level commands to hide/show each item. But as qt processes each I see multiple intermediate screens. I am looking out for command to make the process smooth and avoid seeing intermediate visuals. Currently I am hiding the main window completely and display it back after all modifications are complete but not satisfied as the application disappears for 2-3 seconds.
I am looking for some solution to avoid display of multiple intermediate screens making transition more smooth.
You should be able achieve this using updatesEnabled property of QWidget.
Disable updates for the widget which contains all the child widgets and layouts you want updated (it might be your top level window, or perhaps QMainWindow central widget, or whatever), do the changes, then re-enable updates.

Making UWP ComboBox exceeding parent windows

My app needs to be small in nature so I make it 500 x 100 px in size.
The problem is the ComboBox selection items are also squeezed into that small window size. Of course, I can scroll it, but it doesn't feel right this way.
Here is the picture:
Is it possible to expand the ComboBox selection list so that it exceeds the parent window? Preferably in XAML if possible
Is it possible to expand the ComboBox selection list so that it exceeds the parent window?
No, this is impossible in UWP apps. While using ComboBox class, it displays the drop-down list in PopupRoot, which is a layer has the same view port as its parent window. Anything outside this view port will be clipped, users can't see them. For example, following is a normal ComboBox:
After I give a Margin="-20,-30,0,0" to the drop-down list, it looks like
The part outside the window is clipped.
Besides, The implementation of ComboBox will also make sure the ComboBox's selection list won't exceeds the parent window. The selection list's max height is calculated at runtime, it will be always less than the parent window's height and we can't change its value manually, so it is not possible to expand the ComboBox's selection list.
It's not possible, but you can extend your page to the title bar to have at least some additional space using CoreApplicationViewTitleBar.ExtendViewIntoTitleBar property.
Take a look here and here. (I know the examples are written in C# but it should be similar in C++)

MFC dynamic adding controls with scroll bar

I want to add controls, including buttons, edit box and custom controls, dynamically in a MFC MDI application. I am using from view and I want to create the following GUI.
What I want to do is:
I am able to create those row of controls(Button, Edit box and custom
control) dynamically.
I can have many rows of those controls.
When there are too many rows and the form view has no space to
display them, a scroll bar will appear.
I had read some resources talking about how to create controls dynamically. But I am still wondering how to insert them into something so that I can have a scroll bar when there are too many rows of controls I have to handle.

How can I add multiple icons to an individual TreeView item?

I am trying to display multiple icons to the Treeview item but it is not displaying all the icons, it displays only one.
I am using the following code:
CImageList m_imageState;
m_cTree.m_imageState.Create(16, 16, ILC_MASK, 0, 4);
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm2, RGB(255,0,255));
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm1, RGB(0,255,255));
m_cTree.SetImageList( &(m_cTree.m_imageState), TVSIL_NORMAL );
But when I see Treeview, item displays only one icon.
Is it possible to display multiple icons with Treeview item?
Please suggest how can I do this.
Correct, only one icon will be displayed per item in a TreeView control. This is by design, a hard limitation of the native control that the MFC library wraps.
The only way you're going to be able to display multiple icons per item is owner drawing. It's a pretty difficult task for a TreeView control, not nearly as easy as owner drawing a button or a label control. Make sure that you really this need this functionality, and consider whether there's a better way of displaying the relevant information to your users.
Alternatively, you could create custom bitmaps that combine multiple images next to one another, and add those to your ImageList. The resulting images will be wider than they are tall, but the control doesn't care: it will display whatever size images you specify, as long as all the images in the image list have the same dimensions. This is definitely a hack, but it might work, depending on your needs.