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

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


Possible ? EditLabel() on SubItems ????

Knut Erik Hollund -- knut-erik.hollund@visma.no
Thursday, January 16, 1997

Environment: VC++ 4.0, Windows NT 4.0

Hi

I'm using the CListCtrl->EditLable(index); to show an edit label on the
selected index  - in a ListCtrl. This works fine....
But it seems not to work with SubItems ! 
Can anybody confirm or NOT this to me ?? Should it be possible to
work with Subitems. (In a CListCtrl with a ReportStyle)

:-)
Best Regards
Knut Erik Hollund
knut-erik@visma.no



Mark Koehler -- mkoehler@ix.netcom.com
Friday, January 17, 1997

[Mini-digest: 2 responses]

> Environment: VC++ 4.0, Windows NT 4.0
> 
> Hi
> 
> I'm using the CListCtrl->EditLable(index); to show an edit label on the
> selected index  - in a ListCtrl. This works fine....
> But it seems not to work with SubItems ! 
> Can anybody confirm or NOT this to me ?? Should it be possible to
> work with Subitems. (In a CListCtrl with a ReportStyle)
> 
> :-)
> Best Regards
> Knut Erik Hollund
> knut-erik@visma.no

Unfortunately the CListCtrl does not support in place editing of subitems.
You will need to override default behavior and place edit controls in the
appropriate place to accomplish this.

Mark Koehler
Atlanta, GA

"I'm not a villian, I'm vanilla" - Uncle Creamy (The Tick)


-----From: Roger Onslow/Newcastle/Computer Systems Australia/AU

>I'm using the CListCtrl->EditLable(index); to show an edit label on the
>selected index  - in a ListCtrl. This works fine....
>But it seems not to work with SubItems ! 
>Can anybody confirm or NOT this to me ?? Should it be possible to
>work with Subitems. (In a CListCtrl with a ReportStyle)

Edit label does just that - it edits the label for the list item (which is the 
capition under the icon in icon views, or the first column in report view.

The CListCtrl (and underlying windows common control does NOT support direct 
in-place editing of a sub-item.

However, you can always detect the click, determine the row and column number 
(row is fairly easy, column is trickier - you have to find extents for each 
column and determine which one the user clicked in) - then you can create an 
edit box, place it over the sub-item column entry (you already know the rect, 
just make that the size of the entry box) - copy the contents of the sub-item 
inteo the box, allow for edit and (unless you press ESC) copy the result back.  
This then LOOKs like in place editing (and is pretty much what the common 
control does internally for the label).

Of couse, you many want to try using a grid OCX control instead.

Of course, there are other ways to design this WITHOUT in place editing for 
example:

Trap the double click and pop up an edit dialog that lets you edit all the 
firelds for the row.

And/Or you can trap the right button, determine the row and display a popup 
menu that includes options for deleting, editing etc.

Another alternative is to have edit fields above or below the list show (and 
edit) the values for each field of the current row -- you can respond to the 
change in item message to get notified when a row is selected.  You would then 
include a Modify button which would change the values for the selected row - an 
Add button would add a new row with new values.  Have a look at MS Word File 
Properties Custom page for this sort of design.

There's lots of way to accomplish the same sort of functionality without 
in-place editing

Hope this helps...

Roger Onslow



Colin Angus Mackay -- colin.angus.mackay@dial.pipex.com
Sunday, January 19, 1997

Hi,

I've seen this problem before and as far as I can remember the answer =
(or best solution) was to handle the editing of sub-items yourself by =
creating an CEdit box on top of the subitem in question, then to remove =
the Edit box and insert the data back into the subitem.

Colin Mackay.

----------
From: 	Knut Erik Hollund[SMTP:knut-erik.hollund@visma.no]
Sent: 	16 January 1997 12:56
To: 	'MFC Listserver'
Subject: 	Possible ? EditLabel() on SubItems ????

Environment: VC++ 4.0, Windows NT 4.0

Hi

I'm using the CListCtrl->EditLable(index); to show an edit label on the
selected index  - in a ListCtrl. This works fine....
But it seems not to work with SubItems !=20
Can anybody confirm or NOT this to me ?? Should it be possible to
work with Subitems. (In a CListCtrl with a ReportStyle)

:-)
Best Regards
Knut Erik Hollund
knut-erik@visma.no






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