CListCtrl selection without focus
Andrew Lazarus -- DrLaz@advisorsw.com Monday, December 02, 1996 Environment: VC++ 4.2b, Win 95 I would like to have the user pick at least one entry in several list controls. So it would be best if there were some feedback which items were selected even in the list controls without the focus. Is it necessary to implement Owner Draw for this? (Urk.) andrew lazarus senior software engineer DrLaz@advisorsw.com
Dean Wiles -- deanw@isc-br.isc-br.com Wednesday, December 04, 1996 [Mini-digest: 11 responses] > From: Andrew Lazarus> To: mfc-l@netcom.com > Subject: CListCtrl selection without focus > Date: Monday, December 02, 1996 9:25 AM > > Environment: VC++ 4.2b, Win 95 > > I would like to have the user pick at least one entry in several list > controls. So it would be best if there were some feedback which items > were selected even in the list controls without the focus. Is it > necessary to implement Owner Draw for this? (Urk.) > andrew lazarus > senior software engineer > DrLaz@advisorsw.com You will get LVN_ITEMCHANGED notification on your CListCtrl controls or use CListCtrl::GetItem and check the LVIS_SELECTED flag in the state field. -------------------------------------------------------------------------- Dean Wiles (deanw@mail.isc-br.com) Olivetti North America Phone: (509)927-7037 22425 East Appleway Ave Fax: (509)927-2499 Liberty Lake, WA 99019-9534 If the Son sets you free, you will be free indeed. (John 8:36) -----From: Randy Taylor nope. use the LVS_SHOWSELALWAYS style. At 05:25 PM 12/2/96 +0000, you wrote: >Environment: VC++ 4.2b, Win 95 > >I would like to have the user pick at least one entry in several list >controls. So it would be best if there were some feedback which items >were selected even in the list controls without the focus. Is it >necessary to implement Owner Draw for this? (Urk.) >andrew lazarus >senior software engineer >DrLaz@advisorsw.com > > -----From: "Cunningham Graham, IK 23" there is a style flag for this LVS_SHOWSELALWAYS regards Graham Cunningham 00 41 31 338 0633 >---------- >From: Andrew Lazarus[SMTP:DrLaz@advisorsw.com] >Sent: Montag, 2. Dezember 1996 18:25 >To: mfc-l@netcom.com >Subject: CListCtrl selection without focus > >Environment: VC++ 4.2b, Win 95 > >I would like to have the user pick at least one entry in several list >controls. So it would be best if there were some feedback which items >were selected even in the list controls without the focus. Is it >necessary to implement Owner Draw for this? (Urk.) >andrew lazarus >senior software engineer >DrLaz@advisorsw.com > -----From: Andre Hinsberger Use the LVS_SHOWSELALWAYS style. Andr=E9 Hinsberger >---------- >From: Andrew Lazarus[SMTP:DrLaz@advisorsw.com] >Sent: Montag, 2. Dezember 1996 18:25 >To: mfc-l@netcom.com >Subject: CListCtrl selection without focus > >Environment: VC++ 4.2b, Win 95 > >I would like to have the user pick at least one entry in several list=20 >controls. So it would be best if there were some feedback which items=20 >were selected even in the list controls without the focus. Is it=20 >necessary to implement Owner Draw for this? (Urk.) >andrew lazarus >senior software engineer >DrLaz@advisorsw.com > -----From: Curt Sutherland At 05:25 PM 12/2/96 +0000, you wrote: >Environment: VC++ 4.2b, Win 95 > >I would like to have the user pick at least one entry in several list >controls. So it would be best if there were some feedback which items >were selected even in the list controls without the focus. Is it >necessary to implement Owner Draw for this? (Urk.) >andrew lazarus >senior software engineer >DrLaz@advisorsw.com > Environment: VC++ 4.2b, WinNT 3.51 To have the selection shown in the ListCtrl while the control does not have focus, you need to set the LVS_SHOWSELALWAYS flag in dwStyle paramater of the CListCtrl::Create. I've check the VC++ wizard for the List control and this is not one of the setable properties but it is available. -----From: "R.H.J. Geraets" At 17:25 12/2/96 +0000, you wrote: >Environment: VC++ 4.2b, Win 95 > >I would like to have the user pick at least one entry in several list >controls. So it would be best if there were some feedback which items >were selected even in the list controls without the focus. Is it >necessary to implement Owner Draw for this? (Urk.) >andrew lazarus >senior software engineer >DrLaz@advisorsw.com > Add LVS_SHOWSELALWAYS to the options of the list control in your .rc file. The list control will now always show its selection, even when it does not have the focus. btw. this this option is not offered via the properties pop-up box of a list control when editing a dialog template so it has to manually inserted into the .rc file, but the option is documented in the list view control reference in books online. Does anyone know what the reason for this is? was it plainly forgotten or deliberately left out? Rene' Geraets -----From: "Ed Wheeless" Try using the ModifyStyle member function to set the LVS_SHOWSELALWAYS style on your CListCtrl. Regards, Ed Wheeless ---------- > From: Andrew Lazarus > To: mfc-l@netcom.com > Subject: CListCtrl selection without focus > Date: Monday, December 02, 1996 12:25 PM > > Environment: VC++ 4.2b, Win 95 > > I would like to have the user pick at least one entry in several list > controls. So it would be best if there were some feedback which items > were selected even in the list controls without the focus. Is it > necessary to implement Owner Draw for this? (Urk.) > andrew lazarus > senior software engineer > DrLaz@advisorsw.com -----From: Josef Haslinger Andrew Lazarus wrote: > I would like to have the user pick at least one entry in several list > controls. So it would be best if there were some feedback which items > were selected even in the list controls without the focus. You have to use the LVS_SHOWSELALWAYS flag with your list controls. Unfortunately, Developer Studio does not allow to set this flag directly, so you have to add it manually to your *.rc file: [...] CONTROL "List1",IDC_OBJ_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOLABELWRAP LVS_AUTOARRANGE | LVS_OWNERDRAWFIXED | WS_VISIBLE .... -- ,'~~. ( o o ) +-----------.oooO--(_)--Oooo.---------+ | JOSEF HASLINGER | | hasling@art.at | | josef.haslinger@gascad.telecom.at | | .oooO | | ( ) Oooo. | +--------------\ (----( )-----------+ \_) ) / (_/ -----From: Sven Plastwich Hi Andrew, No need for an ownerdrawed CListCtrl to keep the selection ( even if the focus is removed ). Open your .RC in Text-Mode and set LVS_SHOWSELALWAYS for your ListCtrl. (Must have been forgotten in the Properties-Dialog) Best regardz Sven ---------- From: Andrew Lazarus[SMTP:DrLaz@advisorsw.com] Sent: Montag, 2. Dezember 1996 18:25 To: mfc-l@netcom.com Subject: CListCtrl selection without focus Environment: VC++ 4.2b, Win 95 I would like to have the user pick at least one entry in several list controls. So it would be best if there were some feedback which items were selected even in the list controls without the focus. Is it necessary to implement Owner Draw for this? (Urk.) andrew lazarus senior software engineer DrLaz@advisorsw.com -----From: Thomas Scholz Hi Andrew, you asked: > So it would be best if there were some feedback which items > were selected even in the list controls without the focus. Is it > necessary to implement Owner Draw for this? (Urk.) Answer: no, it's not necessary. Just use the additional style LVS_SHOWSELALWAYS when creating your CListCtrl objects. But for nearly every other reasonable feature for list controls you *have to* owner draw the controls items (e.g. showing the selection on a whole row, drawing grid lines, ...) MS has promised to provide such additional features to be shipped with the Internet Explorer 4.0, but who knows when that will be? Regards, Thomas Scholz -- Tel. Job: (++49/0)911 276-5305 E-Mail: Thomas.Scholz@datev.de -----From: "Andrew Lazarus" > Andrew Lazarus wrote: > > I would like to have the user pick at least one entry in several list > > controls. Haslinger replied > You have to use the LVS_SHOWSELALWAYS flag with your list controls. > Unfortunately, Developer Studio does not allow to set this flag > directly, so you have to add it manually to your *.rc file: Thank you to the 4 people who sent this (Katy Mulvey was first). Just so you-all don't think I'm an idiot, this flag is not mentioned in the printed docs. (It is online.) andrew lazarus senior software engineer DrLaz@advisorsw.com
| Вернуться в корень Архива |