Originally posted by: ashraf
when using this code the error generated tell me that i IDC_IPEDIT is undeclared variable
and when declare it as unsigned integer a warning tell me that i used IDC_IPEDIT without initiate it
how can override that?
Originally posted by: Bob L.
Everything works with the Debug version, but it crashes if I want to compile the Release version. Anybody has some advice?
Thanks
BL
Originally posted by: Yingwen Song
The following statement should be added to the Message Map of class CMyListCtrl to get WM_NOTIFY be processed.
ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT,OnEndLabelEdit)
ON_NOTIFY_REFLECT_EX returns a BOOl value. If you return FALSE in CMyListCtrl::OnEndLabelEdit, the parent dialog's OnEndLabelEdit will also be invoked. This is useful if you have a resusable list control and you need to notify the parent dialogue to do something when the data changes. Perhaps the parent dialogue is using the CMyListCtrl and needs to update some global variable states when the user enters new data. The list control shouldn't need to worry about how it is used. It is simply providing the basic capabilities. It could be the parents job to insert, remove, delete items from the control or extract information to save in some other global data structure or something. So in the parent you also setup handling of the LVN_ENDLABELEDIT just as was done for the CMyListCtrl except that you use ON_NOTIFY instead of ON_NOTIFY_REFLECT_EX. Write the code for that handler to do whatever is necessary. In the CMyListCtrl, simply add a return value of FALSE to allow the parent's handler to be called after the CMyListCtrl finishes.
ReplyOriginally posted by: Pete Burgess
If the item to be edited is only partially visible, scroll the column into view. Also fixes problem when "last" horizontal scroll is not a full view width (edit control was displayed in wrong place).
In EditSubLabel replace
CRect rect;
GetItemRect( nItem, &rect, LVIR_BOUNDS );
// Now scroll if we need to expose the column
CRect rcClient;
GetClientRect( &rcClient );
if( offset + rect.left < 0 || offset + rect.left > rcClient.right )
{
CSize size;
size.cx = offset + rect.left;
size.cy = 0;
Scroll( size );
rect.left -= size.cx;
}
with
CRect rcClient;
GetClientRect(&rcClient);
CRect rect;
while (true)
{
GetSubItemRect(nItem, nCol, LVIR_BOUNDS, rect);
// Now scroll if we need to expose the column
if(rect.left >= 0 && (rect.left + GetColumnWidth(nCol) - 3) <= rcClient.right)
{
break; // cell is in view
}
CSize size;
size.cx = rect.left;
size.cy = 0;
if (!Scroll(size)) break; // scroll failed
}
Reply
Originally posted by: John Smith
On Kill Focus doesnt send the message back to the parent.
Can anybody tell the reason.
Originally posted by: Jason Grant
If you are haveing a problem with an inactive ComboBox here is one solution. Detemine if the mouse is clicked whithin the rect of the combobox. If it is I set the focus to another control in the dialog and then set the focus back to the combobox.
int Class::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
CRect rect;
CPoint point(::GetMessagePos());
m_ComboBox.GetWindowRect(&rect);
if(rect.PtInRect(point))
{
// Under Win95 the combobox does not drop down if the user has clicked in the
// list control. Setting focus to the OK button first corrects the problem
m_Ok.SetFocus();
m_ComboBox.SetFocus();
}
return CDialog::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
Originally posted by: craig knutson
... i am trying to use this implementation with full row select code i got from a microsoft example several years ago.
things seem to be working ok, except as soon as i click on a "subitem" i am given the edit control. i.e. i don't have to click twice, like on the main item.
i am pretty sure the problem lies in the OnLButtonDown() routine. i tried moving the line:
CListCtrl::OnLButtonDown(nFlags, point);
to the end of the routine, rather than at the top, but the effect that has is to let me edit the main
item immediately when i click on the row.
does someone have a suggestion?
thanks much!
craigk
cknutson@flash.net
Originally posted by: Wally Bergseth
CEdit* MyCListCtrl::EditSubLabel( int nItem, int nCol )
// Now scroll if we need to expose the column
The scrolling didn't work correctly when the column wasn't displayed, this code seems to fixed it.
{
...........
CRect rcClient;
GetClientRect( &rcClient );
if( offset + rect.left < 0 || offset + rect.left > rcClient.right )
{
CSize size;
if(offset + rect.left < 0)
size.cx = -(offset - rect.left);
else
size.cx = offset - rect.left;
size.cy = 0;
Scroll( size );
GetItemRect( nItem, &rect, LVIR_BOUNDS );
}
...........
}
Originally posted by: Jason Grant
If an Edit box in the list control has the focus and then the focus is sent to a drop down combobox (via the mouse), the combobox won't drop down or receive any mouse input. I've spent a fair amount of time trying to resolve the problem but haven't been very successful. Strangely enough this problem doesn't seem to exist for NT.
ReplyOriginally posted by: Bill Foust
I'm taking this a step further and adding column definitions
that allow an LButton down do one of 3 things. Edit the field
using an edit box, edit the field using a drop list or
not allowing an edit on the box.
Suprisingly, the last case (not allowing an edit) is not working.
At the point where you would normally call EditSubLabel(), I do
nothing. Unfortunately, MFC gets in the way, and does the standard
field edit action (ie bring up an edit for the first column). I'm
stumped on how to stop this behavior. For this implementation, you
need the LVS_EDITLABELS flag defined, so I can't just remove the
attribute. I can't see what the CInPlaceEdit and CInPlaceList classes
are doing to stop it from happening when an edit is done using one of
those classes.
Any comments?
Thanks
Bill