|
-
February 17th, 2005, 01:41 PM
#1
iam not able to view the images in the tree
hi all
iam not able to view the images loaded in the tree
but the space for the image is allocated but can not view it
i have added a bitmap and also created the imagelist but iam not able to
view it....
CImageList m_TreeImg;
m_TreeImg.Create(IDB_BITMAP, 16, 5, RGB(255, 255, 255));
m_Tree.SetImageList(&m_TreeImg, TVSIL_NORMAL);
HTREEITEM hCompany, hOffice, hProg, hOperSys, hProd;
hCompany = m_Tree.InsertItem("Microsoft", 0, 5, TVI_ROOT);
hOperSys = m_Tree.InsertItem("Windows 9x", 5, 1, hCompany);
hOperSys = m_Tree.InsertItem("Windows NT", 5, 1, hCompany);
hOffice = m_Tree.InsertItem("Office 97", 1, 4, hCompany);
hProd = m_Tree.InsertItem("Word", 2, 3, hOffice);
hProd = m_Tree.InsertItem("Access", 2, 3, hOffice);
hProd = m_Tree.InsertItem("Excel", 2, 3, hOffice);
hProd = m_Tree.InsertItem("OutLook", 2, 3, hOffice);
hProd = m_Tree.InsertItem("PowerPoint", 2, 3, hOffice);
hProg = m_Tree.InsertItem("Visual C++", 3, 4, hCompany);
hProg = m_Tree.InsertItem("Visual Basic", 3, 4, hCompany);
hProg = m_Tree.InsertItem("Visual FoxPro", 3, 4, hCompany);
hProg = m_Tree.InsertItem("Visual Interdev", 3, 4, hCompany);
and so on....
Every thing is perfect
only thing i cannot view the images even it has allocated the space for the image b4 the text of the tree items....
-
February 17th, 2005, 01:47 PM
#2
Re: iam not able to view the images in the tree
This might be a silly question, but do you add images to m_TreeImg? From the code you posted, it looks like you are setting an empty image list to your tree control.
-
February 17th, 2005, 01:48 PM
#3
Re: iam not able to view the images in the tree
 Originally Posted by ganapathykumar
CImageList m_TreeImg;
m_TreeImg.Create(IDB_BITMAP, 16, 5, RGB(255, 255, 255));
m_Tree.SetImageList(&m_TreeImg, TVSIL_NORMAL);
That's somewhat confusing: The prefix (m_) suggests that m_TreeImg is a member variable of a class, but the code as you posted it looks like it was a local variable... So what is it? And if it is a local variable it won't work, since the image list will be destroyed when it goes out of scope.
-
February 17th, 2005, 01:49 PM
#4
Re: iam not able to view the images in the tree
 Originally Posted by mike200
This might be a silly question, but do you add images to m_TreeImg? From the code you posted, it looks like you are setting an empty image list to your tree control.
No, he loads the bitmaps from a resource (IDB_BITMAP).
-
February 17th, 2005, 02:08 PM
#5
Re: iam not able to view the images in the tree
thanx a lot sir i got it...
and i have another question CMenu
the code is as follows..
void CMyDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
menu.LoadMenu (IDR_MENU2);
CMenu *pMenu=menu.GetSubMenu(0);
pMenu->TrackPopupMenu (TPM_LEFTALIGN ,point.x,point.y,pWnd);
}
if i write any actions on the menu items to handle any operations of the dialog it is not working
for eg when i rclick this menu popups how should i write code for the menu item so that i can exit or do any action for the dialog ...
if i write code on the ::OnMenuItem() function it doesnt work...
give me simple code to exit the dialog fro the context menu...
-
February 17th, 2005, 02:18 PM
#6
Re: iam not able to view the images in the tree
 Originally Posted by ganapathykumar
thanx a lot sir i got it...
And, what was it?
 Originally Posted by ganapathykumar
and i have another question CMenu
You'd better start a new thread for that, since it is not related to your original question.
Anyway:
 Originally Posted by ganapathykumar
for eg when i rclick this menu popups how should i write code for the menu item so that i can exit or do any action for the dialog ...
You are passing the pWnd you get in OnContextMenu to the TrackPopupMenu - that's your dialog window, and that won't work: The command routing (as required for menu command handlers) needs a frame window, not a dialog box.
 Originally Posted by ganapathykumar
give me simple code to exit the dialog fro the context menu...
Usually, dialog boxes are closed with the OK or Cancel buttons, or with the close button in the title bar.
-
February 17th, 2005, 02:24 PM
#7
Re: iam not able to view the images in the tree
so sir,
how can i load a popup menu or a menu when a rclick inside
a dialog box is there any other way 4 it
plz help me...
for eg,
i rclick on a item in the tree in order to open the file
how to do that.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|