Keeping CTreeCtrl item highlighted
Andrey Zmievski -- zmievski@ispi.net Friday, March 07, 1997 Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey
S. J. Ackerman -- sja@gte.net Monday, March 10, 1997 [Mini-digest: 21 responses] Use undocumented TVS_SHOWSELALWAYS style bit: //////////////////////////////////////////////////////////////////////////// / // CMyTreeView message handlers //////////////////////////////////////////////////////////////////////////// / int CMyTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) { lpCreateStruct->style |= TVS_HASLINES | TVS_HASBUTTONS | TVS_SHOWSELALWAYS; if (CTreeView::OnCreate(lpCreateStruct) == -1) return -1; // Create the Image List m_ctlImage.Create(IDB_IMAGELIST, 16, 0, RGB(255, 0, 255)); m_ctlImage.SetBkColor(GetSysColor(COLOR_WINDOW)); /// Attach image list to Tree CTreeCtrlEx& ctlTree = (CTreeCtrlEx&) GetTreeCtrl(); ctlTree.SetImageList(&m_ctlImage); return 0; } ---------- > From: Andrey Zmievski> To: mfc-l@netcom.com > Subject: Keeping CTreeCtrl item highlighted > Date: Saturday, March 08, 1997 12:43 AM > > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey Steven J. Ackerman, Consultant ACS, Sarasota, FL sja@gte.net http://www.acscontrol.com -----From: Joe Willcoxson At 11:43 PM 3/7/97 -0600, you wrote: >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > The documentation says to use the tree-view window style TVS_SHOWSELALWAYS to accomplish what you want. Editorial: Yes, the MFC version of common control docu -- Gloria in excelsius Deo Joe Willcoxson (joew@statsoft.com) Work: http://www.statsoft.com, Home: http://users.aol.com/chinajoe #define STD_DISCLAIMER "I speak only for myself" -----From: "Davanum Srinivas" Hi, Set the CListCtrl style when u create it. >>LVS_SHOWSELALWAYS Always show the selection,if any, even if the control does not >> have the focus. -- dims ////////////////////////////////////////////////// // Davanum M. Srinivas // dims@usa.net // // State Street Bank. // dims@ix.netcom.com // // (617)-985-0685 // srinidm@itd.ssb.com // ////////////////////////////////////////////////// ---------- > From: Andrey Zmievski > To: mfc-l@netcom.com > Subject: Keeping CTreeCtrl item highlighted > Date: Saturday, March 08, 1997 12:43 AM > > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey > -----From: Mike Bowler The only way I was able to do this was by using "custom draw" which is = documented in the activex sdk. This allows you to take over control of = colours and fonts for each item in the tree and will allow you to force = the selected colour to something distinctive even when the tree doesn't = have the focus. Mike mbowler@acm.org -----Original Message----- From: Andrey Zmievski [SMTP:zmievski@ispi.net] Sent: Saturday, March 08, 1997 12:44 AM To: mfc-l@netcom.com Subject: Keeping CTreeCtrl item highlighted Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey -----From: Zafir Anjum All you need to do is specify the TVS_SHOWSELALWAYS style. In the Tree Control Properties dialog check the "Show selection always". -Zafir At 11:43 PM 3/7/97 -0600, you wrote: >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey > > -----From: Mario Contestabile >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? int mtreeview::OnCreate(LPCREATESTRUCT lpCreateStruct) { lpCreateStruct->style |= .... | TVS_SHOWSELALWAYS; if (CTreeView::OnCreate(lpCreateStruct) == -1) return -1; } mcontest@universal.com -----From: "Keith Bottner" Set the flag for the CTreeCtrl that keeps the item highlighted when it loses focus. Keith Bottner kbottner@macromedia.com ---------- > From: Andrey Zmievski > To: mfc-l@netcom.com > Subject: Keeping CTreeCtrl item highlighted > Date: Friday, March 07, 1997 11:43 PM > > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey > -----From: jtalkar@optika.com (Jeremiah Talkar) Use the style TVS_SHOWSELALWAYS. I could not find it documented in VC++ 4.2b or earlier, but it is defined in the common controls header file. Also, you cannot select this style from the control properties dialog if the tree control is on a dialog, so add it manually to the dialog resource template in your project's RC file. Jeremiah -----Original Message----- From: Andrey Zmievski Sent: Friday, March 07, 1997 11:43 PM To: mfc-l@netcom.com Subject: Keeping CTreeCtrl item highlighted Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey -----From: ktm@ormec.com Andrey (zmievski@isppi.net) wrote: > Environment: MSVC++ 4.0, NT 4.0 > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? Before you get any further into tree controls, please read TN060 and the parts of the manual it references. There's a lot of information in there, and you could save yourself some time by reading the manual instead of waiting for a reply from the world at large. If your CTreeCtrl is in a dialog, just open up the properties dialog, and set the "Show selection always" checkbox on the Styles tab. If your CTreeCtrl is created on-the-fly or is actually a CTreeView, see "Tree-View Window Styles" in books online, and use ModifyStyle to add the TVS_SHOWSELALWAYS style, e.g. // in the view class, probably in OnInitialUpdate GetTreeCtrl().ModifyStyle(0, TVS_SHOWSELALWAYS); Katy -- Katy Mulvey <mailto:ktm@ormec.com> Software Development Engineer ORMEC Systems -----From: "Bradley V. Pohl" TVS_SHOWSELALWAYS -- Brad Pohl brad.pohl@pobox.com -----Original Message----- Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey -----From: Michael Johnson try long val =GetWindowLong(treeCtrl.m_hWnd,GWL_STYLE); SetWindowLong treeCtrl.m_hWnd,GWL_STYLE,val|TVS_SHOWSELALWAYS); TVS_SHOWSELALWAYS will keep it selected when the window loses focus. mike >-----Original Message----- >From: zmievski@ispi.net [SMTP:zmievski@ispi.net] >Sent: Friday, March 07, 1997 9:44 PM >To: mfc-l@netcom.com >Subject: Keeping CTreeCtrl item highlighted > >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey > -----From: "Cunningham Graham, GD-IT347" Use the following m_TreeCtrl.ModifyStyle(0, TVS_SHOWSELALWAYS); //---------------------------------------------------------- Email : Graham.Cunningham@contractor.net //---------------------------------------------------------- -----Original Message----- From: zmievski@ispi.net [SMTP:zmievski@ispi.net] Sent: Saturday, March 08, 1997 6:44 AM To: mfc-l@netcom.com Subject: Keeping CTreeCtrl item highlighted Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey -----From: "Claus Michelsen" Hi Andrey, You should apply the TVS_SHOWSELALWAYS style to the tree. Best regards, Claus Michelsen ---------- > From: Andrey Zmievski > To: mfc-l@netcom.com > Subject: Keeping CTreeCtrl item highlighted > Date: Saturday, 8 March, 1997 6:43 > > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey > -----From: "Rammohan Rao K. V." Hi Andrey, Set TVS_SHOWSELALWAYS style bit. Like BOOL CMyTreeCtrl::PreCreateWindow(CREATESTRUCT& cs) { cs.style |= TVS_SHOWSELALWAYS; return CTreeView::PreCreateWindow(cs); } >---------- >From: zmievski@ispi.net[SMTP:zmievski@ispi.net] >Sent: 08 March 1997 11:13 >To: mfc-l@netcom.com >Subject: Keeping CTreeCtrl item highlighted > >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey > > -----From: Robert Tenback At 11:43 PM 3/7/97 -0600, you wrote: >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey There is an style: TVS_SHOWSELALWAYS that should do the trick. Robert ____ ___ ___ ___ ___ _____ drs. Robert Tenback / / / / / / / / / / Utrecht University /---/ / / /--/ /-- /--/ / Faculty of Arts / \ /__/ /__/ /___ / \ / Dept. Computers and Humanities Robert.Tenback@let.ruu.nl -----From: Lubimov Alexey Style TVS_SHOWSELALWAYS will do. HTH Alex >-----Original Message----- >From: zmievski@ispi.net [SMTP:zmievski@ispi.net] >Sent: Saturday, March 08, 1997 8:44 AM >To: mfc-l@netcom.com >Subject: Keeping CTreeCtrl item highlighted > >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey > -----From: Fabio Claudio Ferracchiati Hi, simply put TVS_SHOWSELALWAYS as style flag. Bye Fabio >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? -----From: Regis NICOLAS At 11:43 PM 3/7/97 -0600, you wrote: >Environment: MSVC++ 4.0, NT 4.0 > >I need to find a way to keep a currently selected tree item visibly >highlighted even when the tree loses focus. Any ideas? > >-Andrey > > In my MSVC++ 4.2 resource editor I have a check box in Tree properties: Show selction always. It does that. I don't know if it exists in MSVC++ 4.0 Otherwise the bit set by this check box in my resource script is TVS_SHOWSELALWAYS. Hope this helps... Regis, ------------------------------ Regis NICOLAS - R&D Windows Smartcode Technologie mailto:nicolas@smartcode.fr http://www.smartcode.fr/ http://www.smartcodesoft.com/ Tel.: (33) (0)4 67 59 30 16 -----From: "Ian Colomby" > From: Andrey Zmievski > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey Try using the style: TVS_SHOWSELALWAYS __________________________________________________ Ian Colomby, Senior Programmer The Bulldog Group Inc. icolomby@bulldog.ca http://www.bulldog.ca T (416) 594-9207 x267 F (416) 594-9577 -----From: browkl@inel.gov (Kenneth L Brown) Set the TVS_SHOWSELALWAYS flag. Andrey Zmievski wrote: Environment: MSVC++ 4.0, NT 4.0 I need to find a way to keep a currently selected tree item visibly highlighted even when the tree loses focus. Any ideas? -Andrey -----From: "Serge Wautier" Andrey, Did you try the "Show selection always" style ? Serge Wautier, Techno Trade s.a. Belgium serge.wautier@ontonet.be http://www.tbox.fr ---------- > From: Andrey Zmievski > To: mfc-l@netcom.com > Subject: Keeping CTreeCtrl item highlighted > Date: samedi 8 mars 1997 6:43 > > Environment: MSVC++ 4.0, NT 4.0 > > I need to find a way to keep a currently selected tree item visibly > highlighted even when the tree loses focus. Any ideas? > > -Andrey
Become an MFC-L member | Вернуться в корень Архива |