 |
|
|
 |
|
 |
Hi, in my editlist one colom having string type. And there are more than 500 string in that list. I want that strings will be selected by simply typing character one by one. I dont want to select it manually by scrolling. Is it possible.?
|
|
|
|
 |
|
 |
Hi,
Tried ur code. When Tried with modified combo style CBS_DROPDOWN INSTED OF CBS_DROPDOWNLIST,
on click creates combobox & immediately calls onkill todestroy the window.
Why is this?
Pl.Help
V.Bala
bala_potty
|
|
|
|
 |
|
 |
When using CBS_DROPDOWN, then a CEdit child control is also created by the CComboBox, which can get focus. The CComboBox is meant to destroy itself when it looses focus to the CListCtrl, but now the CComboBox can loose focus to this child control and will also cause it to destroy itself.
See MFC Grid control for an implementation of a CComboBox that supports CBS_DROPDOWN (Can with minor modifications be used in a CListCtrl).
|
|
|
|
 |
|
 |
You are right.
Thanks
bala_potty
|
|
|
|
 |
|
 |
I had found a lot of infomation online,but you example is the best!!
thank you
|
|
|
|
 |
|
 |
My list has 3 columns.
The first column has a string which has 25 characters in it.
If I edit the 'third column' the 'first column' string is edited down to 15 characters.
Need a code fix?
|
|
|
|
 |
|
 |
If you have a very short list to display in the drop - say only 2 items - then the presence of the horizontal scroll at the bottom tends to obscure much of the fist item and all of the second item. Of course one could use the vertical scroller to scroll up and down between the items, but have you seen the size of the scroll buttons? My proposal is that if there are not so many items in, say less than 10, then set the style as.... <code> if(lstItems.GetCount() < 10) dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE |CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL; else dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL |CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL; </code> And then one can use the autosizing function (which must be provided by oneself) to adjust the heoight of the combobox to show all items in the list.... <code> if(lstItems.GetCount() < 10) CDialogHelpers::SetComboBoxDropDownHeight(pList);</code> where the function <code>CDialogHelpers::SetComboBoxDropDownHeight()</code> is implemented as follows. <code> void CDialogHelpers::SetComboBoxDropDownHeight(CComboBox *box, UINT nLinesToDisplay /* = -1 */) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); ASSERT(IsWindow(*box)); // Window must exist or SetWindowPos won't work if(nLinesToDisplay == -1) { nLinesToDisplay = box->GetCount(); } CRect cbSize; // current size of combo box int Height; // new height for drop-down portion of combo box box->GetClientRect(cbSize); Height = box->GetItemHeight(-1); // start with size of the edit-box portion Height += box->GetItemHeight(0) * (nLinesToDisplay + 1); // add height of lines of text // Note: The use of SM_CYEDGE assumes that we're using Windows '95 // Now add on the height of the border of the edit box Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges // The height of the border of the drop-down box Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges // now set the size of the window box->SetWindowPos(NULL, // not relative to any other windows 0, 0, // TopLeft corner doesn't change cbSize.right, Height, // existing width, new height SWP_NOMOVE | SWP_NOZORDER // don't move box or change z-ordering. ); } </code> Excuse the use of the magic number 10 above, this would be replaced with a <code>#define</code> or <code>const</code> of course. Hope this minor improvements helps any others out there who are frustrated by short lists appearing too small. Jordan
|
|
|
|
 |
|
 |
I have a question to Shilonir.
Could you explain me this part of your code.Thanks in advance.
//basic code start
CRect rect;
int offset = 0;
// Make sure that the item is visible
if( !EnsureVisible(nItem, TRUE))
return NULL;
GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);
// 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;
}
rect.left += offset;
rect.right = rect.left + GetColumnWidth(nSubItem);
if(rect.right > rcClient.right)
rect.right = rcClient.right;
//basic code end
|
|
|
|
 |
|
 |
Hi,
I would like to use Editable Table Control in CFrameView Window.
( Some where in middle of the window)
Same code and the concept if I use for a ListControl in CFrameView,
It doesn't work.
Which part of the code I have to modify?
Please help me.
Thanks & Regards,
T R Raghavendra
|
|
|
|
 |
|
 |
Nice work but...
when the list goes scrolling while editing the edit should loose the focus!
Cabbi
|
|
|
|
 |
|
 |
just implement vscroll event like this :
void
CEditList::OnVScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (GetFocus() != this)
SetFocus();
CListCtrl::OnVScroll (nSBCode, nPos, pScrollBar);
}
rab
|
|
|
|
 |
|
 |
What if i don't want to loose focus. But rather want the edit control to scroll to.
|
|
|
|
 |
|
 |
Then you will have to move the edit by yourself
|
|
|
|
 |
|
 |
Hi Nir Shilon
First of all congratulations for your work, I am very happy to work with it.
I define a new state eNone, for that part of the Editcontrol that could not be edited by the user.
Now I have a little problem. I use the extended style LVS_EX_CHECKBOXES in my Editcontrol. If the Checkbox is FALSE I want to forbid editig the listcontrol.
That means normally when Checkbox is TRUE and I click on the Edittcontrol the Combobox appears, thats all right and works very well, but when the checkbox is FALSE I don't want appearing the combobox.
I changed the following function:
void CEditList::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
if( GetFocus() != this)
SetFocus();
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if ( m_fGetType && m_fGetType( pNMListView->iSubItem ) == eCombo )
ComboItem(pNMListView->iItem, pNMListView->iSubItem);
else
{
if ( m_fGetType && m_fGetType( pNMListView->iSubItem ) != eNone )
EditItem (pNMListView->iItem, pNMListView->iSubItem);
}
*pResult = 0;
}
My first way to realise it was changing the Editcotrol from eCombo to eNone for all cols in that row but on the line
if ( m_fGetType && m_fGetType( pNMListView->iSubItem ) == eCombo )
I've got an exception.
Can you tell me how I can realise it?
Many thanks
yummi
|
|
|
|
 |
|
 |
dear Sudip
thnx for you comment
i wanted to encapsulate this functionality inside a simple CEditList
which could later be derived from.
i am familiar with your idea, which would of-course work.
yet due to the fact that generality issue is involved here ....
yours
nirs;)
good fellow
shilonir
|
|
|
|
 |
|
 |
just have a combobox & an edit control in your dialog template and make them NOT visible. In the OnInitDialog set the parent of both edit and the combo to the ListCtrl. Now on NM_CLICK event of the list control do the setwindowpos of combo box and edit box. Simple is'nt it...
Sudip
|
|
|
|
 |