i know how to create a subclass (wnd_extend) but i don't know how to apply this subclass to a control on a dialog. i tried this:
wnd<> mainframe = create_wnd<MainFrame>( "Renamer 4", null_wnd, create_info().menu(IDR_MAINWND) );
here i try to subclass the tree with the id IDC_TREE_FOLDER with the class FolderTree. but all it does is creating another tree.
thx to your answers!
He he ;) That's the beauty of auto-mapping. It happens by default. So in other words, if your dialog has some child controls, at runtime, when the dialog is created, all its children (C++ classes) are automatically created.
For instance, say you put a list control with ID_list on your dialog - at design time. At runtime you can reference it like this:
well ok, nice system but:
how do i respond to the messages of the controls in the subclass directly? i mean: if the binding to the subclass happens at runtime and dynamically then i can't get the messages in the class handler but only in the dialog (or parent window).
but what if i want a special tree subclass which has a special behaviour when clicking on the tree. it would be necessary to have a static connection between the subclass and the actual control because the treehandler must get the message.
that's my theory, perhaps you will correct me or show an easy way i overlooked...
You create an event handler for your dialog.
There are plenty of examples to get you started.
For your tree, you can check out examples\Splitter\simple_viewer. The dialog receives and handles events from a tree-view and a list-view.
or... (check the next message)
In case you want to extend a control - like, for instance my_edit (which extends the edit control, but implements extra features)
In this case you subclass it at run-time.
Use the (advanced) remap<> function.
// say your child window is an edit box
// from now on, this child has been subclassed
It is best to do this in your dialog' constructor.
ok, i'll give the remap-mechanism a try.