Adding controls to a Property Sheet at runtime (without Dialog Templates) - winapi

As far as I can see, the way you normally create Property Sheets in Win32 (I am using the API, not MFC) programming is you have a bunch of dialog templates for each tab page, and you make the property sheet out of them. I have read about creating Dialog Templates 'in memory' but I would prefer not to do it this way. How do you add controls to a Property Sheet programatically at runtime, just like you can create a BUTTON and add it to a Window at runtime?

I suggest that you create a blank template and link that to your app. You can then create the property sheet with CreatePropertySheetPage and then add and remove controls to that property sheet as you please.
If you absolutely have to use a template built on the fly in memory, and you can't bring yourself to link a resource to your app, then you need the DLGTEMPLATE structure.

Related

MFC form designer

According to my understanding if I need design MFC form with button I have only one possibility - write everything in code editor. There is no designer. Except cases when I need design dialog form. I can use designer and generate resources for dialogs. But in case normal Frame there is possibility to drop buttons in designer window. Is that truth?
If you want to use a form as a main window, create your project with a CFormView as a base class. You can select that inside the new project wizard. Then you get a dialog resource for that view. It works just like a dialog.
Go to Resource view
Create a new dialog template
Double click the dialog template name
Once the dialog opens, the toolbox get enabled
You can drag&drop the controls to the form now

Activereports (under VB6) issue

I have to modify an old VB6 program that uses ActiveReports 2.0 at work and I am having some problems (BTW I have never used this program before and only have a basic knowledge of VB6)...
I have to make some text boxes biggers which is pretty easy to do but as soon as I move them a whole section of text (and not simply the content of that text box) disappear.
I have noticed that it was in some sort of section (sorry, I don't know how they call that) which englobed those text boxes so I made it bigger and that made no difference.
What could be causing this?
Thank you!
Nick
It sounds like the TextBox is inside a UserControl. A UserControl is created by a developer, and is basically one control with any number of other controls in it. You can check to see if there are any User Controls in your project in the Project Explorer (Ctrl+R).
One way to know exactly what class the control belongs to is to open your form in design mode (Shift+F7), click on the control, and look at the Properties window (F4). The drop-down list should show the currently selected control's class name in bold, then the name of the object.
What is the control's class? If it is anything other than TextBox, then this would explain the unexpected behavior you experienced.

Snapshot for custom DevExpress grid

I have a custom DevExpress Grid overrided with custom GridView. How could I use table snapshots in TestComplete to support this control.
For custom TreeList I found the steps:
You can adjust TestComplete so that it handles a custom control in the same way as the corresponding “standard” control by using the Object Mapping feature. This feature sets a correspondence between control types and their possible class names. To specify that TestComplete should treat a specific control as one of the supported controls:
• Right-click your project in the Project Explorer panel and select Edit | Properties from the context menu. This will open the Project Properties Page.
• Select Object Mapping.
• In the list of control types, choose the type corresponding to your custom control.
• Press Add Class Name and enter the control’s class name.
-- or --
Click Add From Screen and capture the control using the subsequent Add New Object Class dialog.
The class names are case-insensitive and can contain wildcards (* and ?).
• Select File | Save from TestComplete’s main menu to save an object mapping template for the current project.
Note: TestComplete also provides scripting access to a number of child controls of supported third-party controls. Generally, you can work with a child control in the same way you work with its parent. For more information, see Working With Custom Child Controls.
You can not only add an object mapping template for a custom control in the current project, but for all new projects created with TestComplete. This is done in through the Object Mapping Options of the Default Project Properties dialog. In this case all new projects will already be “familiar” with the custom control.
and they work
Since you are working with a .NET Windows Forms applications that uses a grid based on the control from Developer Express, the base grid control is, most probably, XtraGrid. TestComplete has advanced support for this grid control (see the Working With Developer Express XtraGrid - Overview topic) and you can map your descendant grid to this supported control using the Object Mapping feature indeed.
To do this, you need to open the current project' properties editor (Tools | Current Project Properties), select the Object Mapping options group and find a record for the base XtraGrid control as the Developer Express Controls | XtraGrid item. Add the full name of your custom grid's class to the list. This name is stored in the ClrFullClassName property of the grid object. You can see this property in the Object Browser panel.

custom controls with sub components ownership

I have a Visual Studio designer enabled control which uses a collection editor to allow the user to create and edit sub components.
For example, I have a control which offers a readonly "List" property containing a collection of bindings (themselves components with a name property and an event). The user can modify this list of bindings at will and everything works pretty well. They can create and remove bindings without a glitch.
However, when they copy the control, the designer does not copy the binding, it still refers to the original binding components. Also, when they delete the control, it doesn't delete the bindings. It is as if the form has the ownership of these bindings, not the control.
I'm sure there is an attribute to use or some interface to implement, maybe even a custom editor trick to use, but googling for it has left me "feeling unlucky".
Thanks for any help you may have! :)

What ListBox like control is used in Collections Editor of Visual Studio

I need to create a from which uses the same ListBox as the one from Collection Editor of Visual Studio (The ListBox under the Members label). Please, explain exactly which WinForms control is this and which of its properties are set?
You can see the control I am asking about under the Members: label of every collection editor form in design time of Visual Studio.
Thank you.
Hopefully this can get you started. There's other (probably better...) samples out there, but this is a basic starter which can help you get the concept:
http://msdn.microsoft.com/en-us/library/9zky1t4k%28VS.90%29.aspx
Quote:
This example shows how to create a
control named ContactCollectionEditor
that implements a custom collection
editor. The example shows how to
specify the exact type of the object
that a page developer can add to the
control's collection property when
using a custom collection editor. You
associate a collection editor with a
collection property (or the type of
the property) by applying the
EditorAttribute to the collection
property of the control.

Resources