I have an existing tree control on a property page, along with other controls. The tree contains no images, but does have lines linking the various nodes. A CString member variable contains the text which is displayed on the branch labels. Since this is a property page, initialization is done through the OnInitDialog() function, and not through the DoDataExchange function.
I have several buttons which add and delete various nodes and their subitems.
I would like to add a combo box to my existing tree control, but cannot figure out how to do so. All my attempts to apply the techniques described in this article have yielded errors.
I guess this is basically the same question as someone else has already asked, but please bear with me -- I'm quite new to VC++.
I'm trying to implement an "Apply Settings" button to work with this control. But it seems as if it's not possible to add something that responds to a TVN_SELCHANGED message, or rather, that function seems not to be used.
So, how do I proceed?
As I am new to VC++, please answer in as much detail as you think I need
well as the question may be misunderstood: what I wanted to do was to have an Apply button that is disabled (with GetDlgItem(X)->EnableWindow(FALSE), and then--when the user changes something in the trectrl--do a EnableWindow(TRUE) to allow the user to press the apply button which hence updates the variables that holds the configuration data.
"Apply" buttons are not bad UI design. Some dialogs are appropriate for apply buttons (control panels, property dialogs), and some are not.
Apply buttons are typically made possible by tracking a "dirty bit" for the data you're manipulating. Most text editors, for example, display windows that have unsaved changes with an asterisk (*) in the window title. When text editors provide the "Save" command, it is the logical equivalent of the dialog "Apply" command- "save my changes, don't close what I'm working on."
Some benefits of having an Apply button:
-1- It makes it possible to save without closing the dialog. (ex: Changing desktop settings, see the changes, make more changes, without having to reopen a dialog.)
-2- It serves as a reminder to the user that something has changed. (ex: User opens dialog, changes one setting, gets a phone call, goes back to dialog and can't remember if they changed anything.)
-3- It forces the programmer to provide local object storage in the GUI code, rather than be tempted to manipulate the original object directly. (ex: Dialog has pointer to real object, changes it on the fly as the dialog is maniupulated. User hits "Cancel", program either backs out changes already made, or risks persisting changes not meant to be saved.)
So, if you just add a "dirty bit", it is easy to make the apply button enable/disable properly - you disable it when the dirty bit is off, and enable it vice versa. Clicking Apply then pushes the local dialog storage to the original, and sets the button back to disabled. Implementing your "OnOK" logic to save stuff in a subroutine makes this easier; you can call the same subroutine in both "OnOK" and "OnApply", where "OnOK" then exits the dialog, but "OnApply" does not.
Instead of an Edit Box, I'm trying to add a Rich Edit Ctrl. However, I haven't been able to do so successfully even though I duplicated the code for an Edit Box. Also, does anyone know how to extend the width to reach the end of the tree control?
Lost in Space
Last Visit: 31-Dec-99 19:00 Last Update: 27-Apr-15 15:57