|
As I have pointed out in a different post, please make sure you have the latest version from my web site as you are more than likely pointed out a bug which has been fixed a long time ago.
|
|
|
|
|
|
Well, you can put an image before every control or after. To do that, I've modified the original bitmap which contains 16*16 icons. Now, each icon is 32*16. I simply have added a blank 16*16 icon to the right of each icon.
Then, I've build another bitmap with other symbols one the same way, but now, the blank icon is on the left. You have also to add both bitmap to an imagelist.
So when you create an item in the tree, you assign an icon of the first or the second bitmap, and then set an overlay image for this item. This overlay image must be an image where the blank portion is on the opposite side of the main image.
|
|
|
|
|
Hi
It seems ur zip file is corrupted.
can u make provide of new source files
Thanks
Sudhakar
|
|
|
|
|
You can download the latest version from my web site (www.naughter.com
|
|
|
|
|
dont know if this is the right place or not but now ill try it out anyway.. ;o)
well i need some open asp code without "dll" or "com"/"active x" if possible that can show or draw organisation chart based on a employee table.
the chart should dynamically show employee / department-structure in a tree view and/or box(kinda)diagram.
The tableshould use ID and "ChildID" / "parentID" for structuring the chart.
Kind regards,
MONZTERBR
|
|
|
|
|
Hello.
I am developing a project that includes a Dialog containing a CTreeCtrl object.
When running my application in a WindowsNT machine and i display the Dialog i can see correctly the CTreeCtrl.
But when i run my application in a Windows98 machine when i display the Dialog if i don´t click on the CTreeCtrl i can´t see it.
I have seen during the execution of my application that when i display the dialog that contains the CTreeCtrl, what is selected (or focused) is the dialog and not the CTreeCtrl.
If i don't click on in the CTreeCtrl twice it doesn't appear and at this moment it is selected (focused).
But this case is only produced the first time i open the dialog.The following times i open the dialog, the CTreeCtrl is displayed correctly.
In my resource.h file i have the following definition:
IDD_TREE DIALOGEX 0, 0, 662, 402
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Actividades"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Aceptar",IDOK,600,380,50,14
PUSHBUTTON "Cancelar",IDCANCEL,540,380,50,14
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASLINES |
TVS_LINESATROOT | TVS_DISABLEDRAGDROP |
TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_INFOTIP | WS_BORDER | WS_GROUP | WS_TABSTOP,5,5,650,350,
WS_EX_DLGMODALFRAME
END
The first time i open the dialog, as caption property (on the top) of the tree, i can see "Tree1" and when i click on it twice it disappears.
Thanks in advance
Yolanda
|
|
|
|
|
If a combo (and probably an edit also) contol is read whilst it is being edited the present value is not returned (I got an empty string).
My solution is probably not ideal - it would not work in modeless dialogs so a solution based on an ON_NOTIFY_REFLECT of NM_KILLFOCUS would probably be better - but here it is:
Add a public member function:
void CTreeOptionsCtrl::ConcludeCurrentEdit()
{
if (m_hControlItem)
{
UpdateTreeControlTextFromChildControl();
DestroyOldChildControl();
}
}
Modify 2 of the DDX functions to call it:
void DDX_TreeEdit(...)
{
...
if (pDX->m_bSaveAndValidate)
{
pCtrlTreeOptions->ConcludeCurrentEdit();
sText = pCtrlTreeOptions->GetEditText(hItem);
}
else
{
pCtrlTreeOptions->SetEditText(hItem, sText);
}
}
void DDX_TreeCombo()
{
...
if (pDX->m_bSaveAndValidate)
{
pCtrlTreeOptions->ConcludeCurrentEdit();
sText = pCtrlTreeOptions->GetComboText(hItem);
}
else
{
pCtrlTreeOptions->SetComboText(hItem, sText);
}
}
Hope this is useful.
BTW: Thanks PJ Naughter for a great bit of code - it's saved me days if not weeks of work
Gaz Robertson
|
|
|
|
|
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.
Can anyone help?
Thank you,
Dyan
|
|
|
|
|
Hi,
I have just added a edit control to an existing tree control. But it should work with a combo box the same way.
LRESULT CZiOptionPPgAdvanced::OnNotify(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHanddled)
{
USES_CONVERSION;
switch (((LPNMHDR) lParam)->code)
{
case TVN_SELCHANGED :
{
if (!m_hWndTreeView)
return 1;
if (m_hWndEditControl)
::DestroyWindow(m_hWndEditControl);
HTREEITEM hSelectedItem = TreeView_GetSelection(m_hWndTreeView);
if (hSelectedItem == NULL)
return 0;
RECT rText;
TreeView_GetItemRect(m_hWndTreeView,hSelectedItem,&rText,TRUE);
//create the control
m_hWndEditControl = CreateWindowEx(WS_EX_CLIENTEDGE,"Edit","",WS_CHILD,rText.right,
rText.top,100,rText.bottom - rText.top +5,
m_hWndTreeView,NULL,_Module.GetModuleInstance(),NULL);
::ShowWindow(m_hWndEditControl,SW_SHOW);
}
break;
default:
break;
}
}
|
|
|
|
|
Hi,
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
thanks
Daniel
|
|
|
|
|
Hi,
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.
So, how do I do this from within this class?
/Daniel
|
|
|
|
|
|
Apply Settings buttons are bad UI design. You should apply the new settings immediately.
Yes, you can respond to TVN_SELCHANGED; just use the ClassWizard to add a handler.
|
|
|
|
|
Well, I would not know about whether or not it's bad UI design (though I'm a
HCI guy, so perhaps I have some idea after all...)
I quite like the idea of having both Ok, Apply and Cancel, and it seems to be
windows standard, right?
|
|
|
|
|
ok, this issue has now been sorted out. thanks for the class
Daniel
|
|
|
|
|
"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
|
|
|
|
|
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
|
|
|
|
|
I would like to know how the parent window can be notified to handle mouse clicks in the tree control. If I implement a handler for the NM_CLICK message for the control in the parent window, it seem like it is never called. It only calls the CTreeOptionsCtrl::OnClick() handler.
I have read something about message reflection, but I have not been able to get it right.
Regards,
Roar
|
|
|
|
|
I had the same problem and the solution I came up with is for the control to send a custom message to its parent inside the OnClick function. The parent then processes the custom message and acts as if it had received a NM_CLICK notification
|
|
|
|
|
I also registered a user message, and then post it from the control back to my parent window.
Is there not a better way? Doing this for each message is tedious at best.
Conrad - conradb@adroit.co.za
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
|
For my purposes (selecting directories for processing), there is no real need for a "group". Instead, a parent node should just be a normal check box node that just happens to contain child items.
Is there any way to do this with this control
|
|
|
|
|
I am wanting the same thing I would like to be able to a normal check box for the parent "group" item and have it automatically select all the children.
I would also like to be able to use radio buttons for the parent "group" objects and check boxes for the children.
Did you ever get a response to your question?
I would sure like to know what you did.
|
|
|
|
|
i grabbed some code from www.codeguru.com and built my own control to do what i needed. unfortunately, it's very closely integrated to the project i used it for, so i can't really post it here. if i get some free time, maybe i'll try to clean it up...
-c
|
|
|
|
|