Win32 textBox in treeview - winapi

I want to add textbox in treeview as child of one of the parent node. Is it possible> If yes how to achieve this?

The native TreeView control isn't going to be helpful at all to make this work. Programming one yourself is a tricky proposition. It is however a very popular UI gadget. Any component vendor sells one, invariably called "TreeList".
You'll have to do some shopping if you want to use such a component from unmanaged C/C++. An ActiveX version of such a control is as close as you can get. Most component vendors have however put that in their legacy bag.

Depending on your requirements, you may be able to use the built-in label editing features of the Win32 tree view. See TVM_EDITLABEL.
To make an item act like an edit control, you could send this message yourself when the item is clicked. You could also use owner-draw techniques to make the item look more like an edit control when it isn't in label-editing mode.

Related

Is there a JPanel equivalent for MFC

Im my application I want to implement the feature of when a user click on a button show a Panel which will consist of some user controls. I know In Java I can easily use Jpanel and use setVisible() method to get this done easily. But this is an MFC application. I couldn't find any built or customized component that I can use for my purpose.
I also tried GroupBox. But it is not grouping the components logically.
What would be the best approach for this?
As user1793036 says, start by creating a dialog resource and CDialog derived class for the panel. In the dialog resource properties turn off the Title Bar style. In the code call Create for the dialog and then SetWindowPos to place it where you want it to appear.
MFC is nothing but a thin wrapper over Win32 API for windows and controls. The core Win32 API doesn't provide any feature to group controls in a group-box or panel. One way is to have a window and make that window parent of all required controls. Unfortunately, this isn't easy to do.
I suggest you, since you are learning, to drop the idea. Instead, learn what you can achieve with existing set of features provided by MFC/Win32. With MFC/Win32, you would, mostly need to derive/subclass a class/window to get something fancy (such as colored list-control).

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.

passing values between parent and child windows

I am really new to MVC 3 and need a help on this.
I have a parent window with a listbox and a child window that is a pop up. The child window has a checkbox list and i need to populate the parent window's listbox when items are selcted in the child window's checkboxlist. How to acheive this in mvc 3 razor ?
I think you're actually looking for something more than just a Razor answer here, you're looking for JavaScript.
Razor is just a generator - you use it to build HTML, JavaScript (or email or XML or JSON or whatever text you want). Now, it's a really good generator, but it can't do the notification things you're looking to do.
JavaScript, however, will let you pass a message to the server from the popup window, and the parent window can use JavaScript to poll the server for messages.
One way to do this without writing the plumbing yourself is to use a library such as SignalR (located at https://github.com/SignalR/SignalR, or you can install it in your project through NuGet) which can handle the client->server->client communication for you.
On a separate note, if the "window" is just an in-page pop-up, you don't have to do anything nearly as complicated. You can just use script on the same page to control any of the DOM elements.
Hope this helps some, cheers.

How to create a view for a single control?

What is the best way to create a view for a single control that I need to load into a Shell region in a Prism app. I know I can wrap the control in a UserControl, but I suspect there may be a better way.
I am working on a demo app to learn Prism 4. Each module will load a navigation button into an ItemsControl in a region in the Shell. These navigation buttons will function like the Mail, Calendar, and other buttons in Outlook.
I am creating the view in each module that will hold the module's navigation button. The simplest way to create the view seems to be to wrap it in a UserControl. My question is this: Is there a better way to do it? Thanks for your help.
If you need graphical control, what you are doing is the way to go. If you find yourself making all of the buttons look the same (copy - pasting) you might find that a menu registration service is the way to go.
You'd have a service like IMenuService that you register with your container and modules can come around and register menu items to. You can then create buttons for the module. I've provided a sample for this here:
http://dl.getdropbox.com/u/376992/CAGMenus.zip
Your question, though, seems to be about whether or not you need to wrap a control in a UserControl to register them with a region? If that's the question, I believe the answer is no, although you might amend your question to tell us what you are running up against that makes you think this.
I ended up wrapping the control in a UserControl, and it seems to work fine. I am still interested in seeing if there is a better way to load the button, so I will hold this question open for a few days.
Edit 02/22/2011: I tried using a control without a UserControl wrapper, and I got the following error:
Library project file cannot specify ApplicationDefinition element.
I wrapped the control in a UserControl and the error went away.

Altering windows form from userControl

i'm quite new with windows forms and i have a small issue.
i have a form that contains a userControl.
the form also contains a button with enabled = false, and upon some user selection in the userControl sets the button to enabled = true.
basically, i want to know what's the best way to change something in the form upon a change in the userControl.
I saw on the internet that event/delegates might be the answer, but it seems too complicated for such a small thing.
anyone has another solution?
thanks
Bosco
Events are your friends. They're really not that complicated. Just find an apropriate event for your user selection and set the button property.
User controls are meant to be hosted by different forms or other user controls. That's why they should be decoupled from their host controls.
IMHO best way to decouple the user control from its parent is to use events. Another way would be to implement the observer pattern. Events are a special implementation of observer pattern in .NET.

Resources