15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Editing the Labels in a ListCtrl

David Lantsman -- davidlan@il.lucky.net
Wednesday, December 04, 1996

Environment: Visual C++ 4.0, Windows 95

Hello,

I have a list control with the edit labels option on.
When the user selects some item and then clicks it an edit control appears to allow the user to edit the label. Up to now, verything OK. 
What I want is to show the edit label not only when the user clicks the item, but when he pushes some button in the dialog.
How can I do that?

Thank you very much,
	David Lantsman

=======================================
Sent by David Lantsman
    mailto:davidlan@luckynet.co.il

Visit me at : http://www.luckynet.co.il/~davidlan
=======================================





From postmaster@majordomo.netcom.com Thu Dec  5 16:35:06 1996
Return-Path: 
Received: from majordomo.netcom.com (listless.netcom.com [206.217.29.105]) by mail6 (8.6.13/Netcom)
	id QAA07577; Thu, 5 Dec 1996 16:35:03 -0800
Received: by majordomo.netcom.com (8.7.5/8.7.3/(NETCOM MLS v1.01)) id QAA16100; Thu, 5 Dec 1996 16:34:57 -0800 (PST)
X-Nvlenv-01Date-Transferred:  6-Dec-1996  2:34:09 -0500; at
 qtts2308.Telkom
X-Nvlenv-01Date-Posted: 06-Dec-1996 02:38:52 +0000; at Telkom00.Telkom
Mime-Version: 1.0
Content-Type: multipart/mixed;
       boundary="PartBoundary_Fri_Dec__6_02:34:30__4028590"
Date: 06 Dec 96 02:38:52 GMT
To: <@majordomo.netcom.com:owner-mfc-l@majordomo.netcom.com>
From: mailer-daemon@telkom00.telkom.co.za
Message-Id: <"4087A732818C637C@Telkom00.Telkom"@-SMF->
Subject: Returned mail: Non delivery of message.


--PartBoundary_Fri_Dec__6_02:34:30__4028590
Content-type: text/plain

	------- Transcript of Report follows ------
Non-Standard: SMF = Addresses-referred-to: stasseed@Telkom11.Telkom
2Non-Standard: SMF = 2200Error-report: 255
21Report-Date: 06-Dec-1996 02:38:52 +0000; at Telkom00.Telkom
Rejected-For: stasseed@Telkom11.Telkom
Non-Standard: SMF = Subject: 200Via-host:Telkom00.Telkom00

(This is a MIME message.  If you can read this, your mail
reader does not support MIME.  Please contact your E-Mail
administrator if you have any questions)

--PartBoundary_Fri_Dec__6_02:34:30__4028590
Content-Type: text/x-HEADERS; charset=US-ASCII
X-NVL-Content-Typename: SMF

Message-id:<2831A13281AF637C>RFC822:199611282238.XAA25428@magigimmix.xs4all.nl
000Authors:"T.K.Wessing" 
To: mfc-l@netcom.com
Copies-to: MHENRY@umi.com
Subject:Re: Tabbing bewtween controls on a view (CView that is)
Date:28-Nov-1996 23:30:33 +0100
X-NVLIPM-Non-Standard:RFC822 = X-MSMail-Priority: Normal
X-NVLIPM-Non-Standard:RFC822 = X-Priority: 3
X-NVLIPM-Non-Standard:RFC822 = X-Mailer: Microsoft Internet Mail 4.70.1155
X-NVLIPM-Non-Standard:RFC822 = MIME-Version: 1.0
From: owner-mfc-l@majordomo.netcom.com
X-NVLIPM-Non-Standard:RFC822 = Errors-To: owner-mfc-l@majordomo.netcom.com
X-NVLIPM-Non-Standard:RFC822 = Precedence: bulk
Reply-to: mfc-l@netcom.com
200Via-host:qtts2308.Telkom00


*********** NGM Non-delivery Information ****************

  Rejected for: stasseed@Telkom11.Telkom
  Reason: 

Original Message: Re: Tabbing bewtween controls on a view (CView that is)
*********************************************************

Hi,

Why don't you use a CFormView with two contols on it?


/=====================================
|  T.K.Wessing
|  Senior Software Engineer
|  Caledon Systems International BV
|  The Netherlands
|  Private E-Mail:
|  tkw@xs4all.nl
\=====================================
The Nedherlands ?
Yep, "The Nedherlands" It does exists indeed!


----------
> From: MHENRY.UMI.COM 
> To: mfc-l@netcom.com
> Subject: Tabbing bewtween controls on a view (CView that is)
> Date: Monday, September 23, 1996 7:26 PM
> 
> 
>  
>  Environment: VC++ 4.0, Win 95 
>  
>  
> I have a CView-derived class that I place two CListBoxs and a
CRichEditView 
> on.  I'd like to be able to tab between them.  I've tried giving the view

> window the extended "WS_EX_CONTROLPARENT", which according to the
(negligible) 
> documentation allows you to tab between control windows on a view.  But
it 
> doesn't work, i.e., you hit tab and nothing happens. 
>  
> Has anyone used this extended window style?  I can't find decent
documentation 
> on it anywhere.  I suppose I could create a dialog template and put my 
> controls on that in a CFormView, but I'd rather not mess with another
dialog 
> resource if I can avoid it.  Besides, This should work (I think). 
>  
>  
> Here's my code... 
>  
> BOOL CMTIView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD 
> dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* 
> pContext)  
> { 
> // create the window 
>  
> if (!CWnd::CreateEx(WS_EX_CONTROLPARENT, lpszClassName, lpszWindowName, 
> dwStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom -
rect.top, 
> pParentWnd->m_hWnd, (HMENU)nID, pContext)) return FALSE; 
>  
> // create CRichEditCtrl	 
> VERIFY(m_pRECFile->Create((WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL
| 
> ES_SUNKEN | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY),  
> 					CRect(1,1,10,10), this, 0)); 
>  
> // create the list boxes	 
> VERIFY(m_pListIdentified->CreateEx(WS_EX_CLIENTEDGE,"LISTBOX","", 
>            WS_CHILD | WS_BORDER | WS_VISIBLE | WS_VSCROLL  | WS_HSCROLL |

> LBS_NOINTEGRALHEIGHT | LBS_STANDARD, 
>            1,1,10,10,GetSafeHwnd(),(HMENU)IDC_LIST_TERM_IDENTIFY)); 
>  
> VERIFY(m_ListTerms.CreateEx(WS_EX_CLIENTEDGE,"LISTBOX","", 
>            WS_CHILD | WS_BORDER | WS_VISIBLE | WS_VSCROLL | 
> LBS_NOINTEGRALHEIGHT | LBS_STANDARD, 
>            1,1,10,10,GetSafeHwnd(),(HMENU)IDC_LIST_TERMS)); 
>  
> return TRUE; 
> } 
>  
> I also tried setting the controls with the WS_TABSTOP style but to no
avail. 
>  
> --matt 
> /~~~~~~~~~~~~~~~~~~~~~~~~~~~  
>   Matthew Henry  -- UMI            
>   mhenry@umi.com     (Work)              
>   mhenry1384@aol.com (Home)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~/  
> 
> 

--PartBoundary_Fri_Dec__6_02:34:30__4028590--



Ronald D. Patton -- rpatton@sky.net
Thursday, December 05, 1996

[Mini-digest: 6 responses]

David,

Look at CListCtrl::EditLabel()

Ron Patton

----------
> From: David Lantsman 
> To: 'mfc-l@netcom.com'
> Subject: Editing the Labels in a ListCtrl
> Date: Wednesday, December 04, 1996 12:15 AM
> 
> Environment: Visual C++ 4.0, Windows 95
> 
> Hello,
> 
> I have a list control with the edit labels option on.
> When the user selects some item and then clicks it an edit control
appears to allow the user to edit the label. Up to now, verything OK. 
> What I want is to show the edit label not only when the user clicks the
item, but when he pushes some button in the dialog.
> How can I do that?
> 
> Thank you very much,
> 	David Lantsman
> 
> =======================================
> Sent by David Lantsman
>     mailto:davidlan@luckynet.co.il
> 
> Visit me at : http://www.luckynet.co.il/~davidlan
> =======================================
> 
> 
> 
-----From: "Serge Wautier" 

> From: David Lantsman 
> Subject: Editing the Labels in a ListCtrl

> What I want is to show the edit label not only when the user clicks the
item, but when he pushes some button in the dialog.
> How can I do that?

Simply call CListCtrl::EditLabel(iItem)

NB: In explorer, there's a not well known keyboard shortcut for this
function : F2.
As far as i remember, this shortcut is not a standard feature of the
listview control. (It's easy though to handle it by overriding
PreTranslateMessage).

Serge Wautier,
Techno Trade s.a.
Belgium
serge.wautier@ontonet.be
http://www.tbox.fr

-----From: "P. Senthil" 

David Lantsman wrote:

> Environment: Visual C++ 4.0, Windows 95
> 
> Hello,
> 
> I have a list control with the edit labels option on.
> When the user selects some item and then clicks it an edit control appears to allow the user to edit the label. Up to now, verything OK.
> What I want is to show the edit label not only when the user clicks the item, but when he pushes some button in the dialog.
> How can I do that?
> 
> Thank you very much,
>         David Lantsman
> 
> =======================================
> Sent by David Lantsman
>     mailto:davidlan@luckynet.co.il
> 
> Visit me at : http://www.luckynet.co.il/~davidlan
> =======================================


Use the macro:
HWND ListView_EditLabel(HWND hwnd, int iItem); 

-- 
P. Senthil
-----------------------------------------------------------------------
1, 7th Avenue (West),
7th Main Road,
Dhandeeswaram Nagar,
Velachery,
MADRAS - 600 042.

Mail:  senthilp@geocities.com

Homepage: www.geocities.com/SiliconValley/Heights/6504
-----From: Lee 

Hi,

All you need is the following, where m_ListCtrl is a CListCtrl:

void CmyClass::OnEditButton() 
{
	int current_index = m_ListCtrl.GetNextItem(-1,LVNI_SELECTED);
	if(current_index == -1)
		return;
	
	m_ListCtrl.SetFocus();
	m_ListCtrl.EditLabel(current_index);	
}
-----From: "Mark Koehler" 

> Environment: Visual C++ 4.0, Windows 95
> 
> Hello,
> 
> I have a list control with the edit labels option on.
> When the user selects some item and then clicks it an edit control
appears to allow the user to edit the label. Up to now, verything OK. 
> What I want is to show the edit label not only when the user clicks the
item, but when he pushes some button in the dialog.
> How can I do that?
> 
> Thank you very much,
> 	David Lantsman
> 
That's simple enough. Call CListCtrl::EditLabel(nIndex).
-----From: Claus Michelsen 

Hi David,

You can use the start the editing of a list control item by calling the =
EditLabel function if you use the MFC CListCtrl class. The handler for =
the button that starts the editing can look like this:

{
	// Find the selected item
	int nItem =3D m_ctrlList.GetNextItem(-1, LVNI_SELECTED);
	if (nItem !=3D -1)
	{
		// Set the focus back to the list control BEFORE beginning editing.
		m_ctrlList.SetFocus();

		// Begin edting of the item.
		VERIFY(m_ctrlList.EditLabel(nItem));
	}
}

If you don't use the MFC CListCtrl  class you must use the LVM_EDITLABEL =
message. It is important that you still remember to set the focus to the =
list control BEFORE starting the editing.

It is also important that the list control has the LVS_EDITLABELS style =
set.

I hope this can help.


Best regards,
Claus Michelsen



-----Original Message-----
From:	David Lantsman [SMTP:davidlan@il.lucky.net]
Sent:	4. december 1996 07:16
To:	'mfc-l@netcom.com'
Subject:	Editing the Labels in a ListCtrl

Environment: Visual C++ 4.0, Windows 95

Hello,

I have a list control with the edit labels option on.
When the user selects some item and then clicks it an edit control =
appears to allow the user to edit the label. Up to now, verything OK.=20
What I want is to show the edit label not only when the user clicks the =
item, but when he pushes some button in the dialog.
How can I do that?

Thank you very much,
	David Lantsman

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sent by David Lantsman
    mailto:davidlan@luckynet.co.il

Visit me at : http://www.luckynet.co.il/~davidlan
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D





| Вернуться в корень Архива |