|
Hello,
Thanks for this useful set of classes : my project needed a dynamic list of editable fields and this fits the bill exactly.
I have noticed that the display breaks up if you scroll the list (using mouse wheel or scroll bar) while a field is being edited. I worked round this in my project by setting a flag before creating the combo / edit and then ignoring Vertical Scroll or Mouse Wheel messages for the list while the flag was set.
As a minor aside, I also had to use FindStringExact()in the OnLButtonDown() function, as some of my combo strings are substrings of others.
Regards,
Graham
|
|
|
|
|
Is there any way to add a Date Time Picker control to the list control?
--
Edward Livingston
(aka ExtraLean)
--
"I still maintain that seeing a nipple is far less disturbing than seeing someone get their brains blown out." -- Chris Maunder
|
|
|
|
|
I am trying to resolve some of my other problems using Rational Purify to check what is happening. Purify complains about some items in the code (the bold line):
int CComboListCtrl::InsertColumn( int nCol, char * lpszColumnHeading,int nFormat,int nWidth,int nSubItem )
{
int li_rv = CListCtrl::InsertColumn(nCol,lpszColumnHeading,nFormat,nWidth,nSubItem );
CHeaderCtrl* pHeader ;
HD_ITEM hdr_item;
pHeader = GetHeaderCtrl();
VERIFY( m_header_ctrl.SubclassWindow( pHeader->m_hWnd ) );
hdr_item.pszText = lpszColumnHeading ;
hdr_item.mask = HDI_FORMAT | HDI_TEXT ;
hdr_item.fmt = nFormat | HDF_OWNERDRAW;//HDF_CENTER |HDF_STRING | HDF_OWNERDRAW ;
m_header_ctrl.SetItem(nCol,&hdr_item);
return li_rv ;
}
The call stack:
[I] Message: Assertion failed!
Call location
CrtDbgReport [dbgrpt.c:299]
AfxAssertFailedLine(char const*,int) [afxasert.cpp:39]
CWnd::SubclassWindow(HWND__ *) [wincore.cpp:3877]
CComboListCtrl::InsertColumn(int,char *,int,int,int) [C:\vss\TCD\listcontrol\ComboListCtrl.cpp:440]
HD_ITEM hdr_item;
pHeader = GetHeaderCtrl();
=> VERIFY( m_header_ctrl.SubclassWindow( pHeader->m_hWnd ) );
hdr_item.pszText = lpszColumnHeading ;
hdr_item.mask = HDI_FORMAT | HDI_TEXT ;
hdr_item.fmt = nFormat | HDF_OWNERDRAW;//HDF_CENTER |HDF_STRING | HDF_OWNERDRAW ;
COperationalLimit::Setup_ListCtrl(void) [C:\vss\TCD\OperationalLimit.cpp:427]
if(li_col == CP_OI_COMPANY)
m_list.InsertColumn(li_col, (char *)(LPCTSTR)plcCols->m_header, LVCFMT_LEFT, li_width);
else
=> m_list.InsertColumn(li_col, (char *)(LPCTSTR)plcCols->m_header, LVCFMT_RIGHT, li_width);
li_col++ ;
}
m_list.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES ) ;
COperationalLimit::OnInitialUpdate(void) [C:\vss\TCD\OperationalLimit.cpp:183]
CWnd::OnWndMsg(UINT,UINT,long,long *) [wincore.cpp:1835]
CWnd::WindowProc(UINT,UINT,long) [wincore.cpp:1596]
AfxCallWndProc(CWnd *,HWND__ *,UINT,UINT,long) [wincore.cpp:215]
CWnd::SendMessageToDescendants(HWND__ *,UINT,UINT,long,int,int) [wincore.cpp:2317]
The function that is calling the "insertColumn":
void COperationalLimit::Setup_ListCtrl()
{
int li_col ;
POSITION l_pos ;
int li_width ;
CResourceLCCols* plcCols ;
CResMarketSmryDoc* pDoc =(CResMarketSmryDoc *) GetDocument();
li_col = 0 ;
m_list.DeleteAllItems();
l_pos = pDoc->m_cl_cols_list.GetHeadPosition() ;
while ( l_pos != NULL )
{
plcCols = pDoc->m_cl_cols_list.GetNext( l_pos ) ;
switch ( li_col )
{
case CP_OL_COMPANY:
li_width = 110;
break;
default :
li_width = 85 ;
break ;
}
if(li_col == CP_OI_COMPANY)
m_list.InsertColumn(li_col, (char *)(LPCTSTR)plcCols->m_header, LVCFMT_LEFT, li_width);
else
m_list.InsertColumn(li_col, (char *)(LPCTSTR)plcCols->m_header, LVCFMT_RIGHT, li_width);
li_col++ ;
}
m_list.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES ) ;
// Sets/Resets the column, which support the in place combo box
m_list.SetReadOnlyColumns(CP_OL_COMPANY, TRUE);
m_list.SetReadOnlyColumns(CP_OL_ADJ_VALUE, TRUE);
m_list.SetReadOnlyColumns(CP_OL_MEMBER_EXP, TRUE);
CString strValidChars = "0123456789.";
m_list.SetValidEditCtrlCharacters(strValidChars);
m_list.m_header_ctrl.Set_HeaderLinesNo( 2 ) ;
}
Does anybody have a clue of what is happening? In "release" nothing seems wrong, but when running in "Debug" I got lots of assertions - seems to one for each coloumn.
/Espen
|
|
|
|
|
I find the PopulateComboList message we define by ourself can't work, who know why?
And I set Gridline for it, but can't see them.
ListView_SetExtendedListViewStyleEx(m_ctlList.GetSafeHwnd(),
LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ,
LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS
);
|
|
|
|
|
I got it! It can works well in formview now.
In the formview, I set the listctrl's style "Edit labels" to the state of selected, then it work!
The second problem still there, why can't see gridlines?
|
|
|
|
|
dear sir
I have a been trying to implement your idea about a
combobox into a application that has CFormView instead of
Cdialog. It works exept that when I click on the combobox
I cannot select any of the items in the list but the
cursor imeddiately jumps to the first column. I believe
this is because your function
OnEndLabelEditVariableCriteria executes when I click to
expand the combobox and I don't know why this is
anyway the same code works with a cdialog instead
Please help me with this I really need the help
I can provide the source for anyone that might want to
help me.
thank you all in advance
|
|
|
|
|
Hi,
I have not tested this control extensively with CFormView.
Please send me the code and I will see if I can help.
<blink>Aravindan Premkumar
Life is short, enjoy it with a smile as long as it lasts.
|
|
|
|
|
I cannot attach files to my message when i use the codeproject interface
So I would really need a mail address to communicate with you
|
|
|
|
|
Hi, I am using this controller in an application using CFormView, but I do not understand if we comply to you need.
Here is the source code for a simple screen that uses the control (the source code for 2 container classes is also added since they are in use in the grid, and they are from the same files):
H file
------------
#if !defined(AFX_CHECKRESULT_H__F9AB9BFA_E844_47DB_98DA_C26D6D09BCAD__INCLUDED_)
#define AFX_CHECKRESULT_H__F9AB9BFA_E844_47DB_98DA_C26D6D09BCAD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CheckResult.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CCheckResult form view
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
/****************************************************************************/
/* Class CNGTS_CheckResult_Info */
/****************************************************************************/
class CNGTS_CheckResult_Info
{
protected:
public:
CNGTS_CheckResult_Info() ;
CNGTS_CheckResult_Info( NP_LIMIT_CHECK_INFO_REC * ) ;
public:
NP_LIMIT_CHECK_INFO_REC m_rec ;
};
/****************************************************************************/
/* Class CNGTS_CheckResult_List */
/****************************************************************************/
class CNGTS_CheckResult_List
{
protected:
public:
int m_total ;
CArray<cngts_checkresult_info, cngts_checkresult_info=""> m_list ;
public:
int Info_Add( NP_LIMIT_CHECK_INFO_REC *ptr_inrec) ;
int Info_Delete( NP_LIMIT_CHECK_INFO_REC *ptr_inrec ) ;
CNGTS_CheckResult_Info *Locate_CheckResult( NP_LIMIT_CHECK_INFO_REC *ptr_inrec ) ;
} ;
#define CP_CR_COLS 5
#define CP_COMPANY 0
#define CP_CR_ORDER_ID 1
#define CP_CR_PRICE 2
#define CP_CR_VOLUME 3
#define CP_CR_AMOUNT 4
class CCheckResult : public CFormView
{
protected:
CCheckResult(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CCheckResult)
// Form Data
public:
//{{AFX_DATA(CCheckResult)
enum { IDD = IDD_CHECKRESULT };
CButton m_close;
/*CComboListCtrl*/CResourceListCtrl m_list;
//}}AFX_DATA
// Attributes
public:
// Operations
public:
void Save_Setting( CString ps_section ) ;
void Restore_Setting(CString ps_section);
void ItemAdd_ListCtrl( CNGTS_CheckResult_Info* ptr_rec ) ;
void OnWithdrawOrder();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCheckResult)
public:
virtual void OnInitialUpdate();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CCheckResult();
void Setup_ListCtrl() ;
void Fill_ListCtrl() ;
afx_msg void OnContextMenu(CWnd*, CPoint point);
void Resize_Controls( int pi_x, int pi_y ) ;
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CCheckResult)
afx_msg void OnClose();
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHECKRESULT_H__F9AB9BFA_E844_47DB_98DA_C26D6D09BCAD__INCLUDED_)
CPP file
--------------
// CheckResult.cpp : implementation file
//
#include "stdafx.h"
#include "ngxts.h"
#include "CheckResult.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/****************************************************************************/
/* Class CNGTS_CheckResult_Info */
/****************************************************************************/
CNGTS_CheckResult_Info::CNGTS_CheckResult_Info()
{
memset( &m_rec, 0, sizeof( NP_LIMIT_CHECK_INFO_REC )) ;
}
CNGTS_CheckResult_Info::CNGTS_CheckResult_Info( NP_LIMIT_CHECK_INFO_REC *ptr_inrec )
{
memcpy( &m_rec, ptr_inrec, sizeof( NP_LIMIT_CHECK_INFO_REC )) ;
}
/****************************************************************************/
/* Class CNGTS_CheckResult_Info */
/****************************************************************************/
//------------------------CNGTS_CheckResult_List::Info_Add------------------
int CNGTS_CheckResult_List::Info_Add( NP_LIMIT_CHECK_INFO_REC *ptr_inrec)
{
Info_Delete(ptr_inrec);
m_list.Add( CNGTS_CheckResult_Info( ptr_inrec )) ;
m_total++ ;
return(1);
}
//------------------------CNGTS_CheckResult_List::Info_Delete------------------
int CNGTS_CheckResult_List::Info_Delete( NP_LIMIT_CHECK_INFO_REC *ptr_inrec )
{
CNGTS_CheckResult_Info *lptr ;
lptr = Locate_CheckResult( ptr_inrec ) ;
if ( lptr )
{
int li_idx = lptr - &m_list[0] ;
m_list.RemoveAt( li_idx ) ;
m_total-- ;
return 1 ;
}
return 0 ;
}
//---------------------------CNGTS_CheckResult_List::Locate_CheckResult-------------------
CNGTS_CheckResult_Info *CNGTS_CheckResult_List::Locate_CheckResult( NP_LIMIT_CHECK_INFO_REC *ptr_inrec )
{
NP_LIMIT_CHECK_INFO_REC* ptr;
for(int i=0;i<m_total;i++)
{
="" ptr="(NP_LIMIT_CHECK_INFO_REC*)" &m_list[i].m_rec;
="" if(strcmp(ptr-="">order_reference,ptr_inrec->order_reference)==0)
return(&m_list[i]);
}
return NULL ;
}
/////////////////////////////////////////////////////////////////////////////
// CCheckResult
IMPLEMENT_DYNCREATE(CCheckResult, CFormView)
CCheckResult::CCheckResult()
: CFormView(CCheckResult::IDD)
{
//{{AFX_DATA_INIT(CCheckResult)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CCheckResult::~CCheckResult()
{
}
void CCheckResult::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCheckResult)
DDX_Control(pDX, IDCLOSE, m_close);
DDX_Control(pDX, IDC_ORDER_LIST, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCheckResult, CFormView)
//{{AFX_MSG_MAP(CCheckResult)
ON_WM_CONTEXTMENU()
ON_BN_CLICKED(IDCLOSE, OnClose)
ON_WM_SIZE()
//}}AFX_MSG_MAP
ON_COMMAND(ID_WITHDRAWORDER, OnWithdrawOrder)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCheckResult diagnostics
#ifdef _DEBUG
void CCheckResult::AssertValid() const
{
CFormView::AssertValid();
}
void CCheckResult::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCheckResult message handlers
void CCheckResult::OnClose()
{
CResMarketSmryDoc* pDoc =(CResMarketSmryDoc *) GetDocument();
pDoc->OnCloseDocument() ;
}
void CCheckResult::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
CRect lt_rect ;
CString lc_tempstr ;
CResMarketSmryDoc *pDoc =(CResMarketSmryDoc *) GetDocument();
if ( pDoc->m_restore_section == "0" )
{
lc_tempstr.Format( "%s", pDoc->m_classname ) ;
g_Res_Utils.LoadWindowXY((CWnd*) GetParentFrame(), (char *)(LPCTSTR)lc_tempstr, g_Res_PgmInfo.m_screen_file ) ;
lc_tempstr.Format( "%s-bid", pDoc->m_classname ) ;
g_Res_Utils.LoadListCtrlColWidth( &m_list, (char *)(LPCTSTR)lc_tempstr, pDoc->m_ctlList_cols, g_Res_PgmInfo.m_screen_file ) ;
}
else
Restore_Setting( pDoc->m_restore_section ) ;
// determine the list ctrl height
GetWindowRect( <_rect ) ;
Resize_Controls( lt_rect.right - lt_rect.left - 20, lt_rect.bottom - lt_rect.top - 20 ) ;
Setup_ListCtrl() ;
m_list.DeleteAllItems();
Fill_ListCtrl();
// reading new data - delete of old list
g_NGTS_CheckResult_List.m_list.RemoveAll();
g_NGTS_CheckResult_List.m_total = 0;
}
void CCheckResult::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
Resize_Controls(cx,cy);
}
void CCheckResult::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
m_list.DeleteAllItems();
Fill_ListCtrl();
}
void CCheckResult::Resize_Controls(int pi_x,int pi_y)
{
CRect lrect;
m_close.GetClientRect( &lrect ) ;
int width = lrect.right - lrect.left;
int height = lrect.bottom - lrect.top;
m_list.MoveWindow(15,55,pi_x-30,pi_y-105,FALSE);
m_close.MoveWindow(pi_x-120,pi_y-35,width,height,FALSE);
this->Invalidate() ;
}
void CCheckResult::Setup_ListCtrl()
{
int li_col ;
POSITION l_pos ;
int li_width ;
CResourceLCCols* plcCols ;
CResMarketSmryDoc* pDoc =(CResMarketSmryDoc *) GetDocument();
li_col = 0 ;
m_list.DeleteAllItems();
l_pos = pDoc->m_cl_cols_list.GetHeadPosition() ;
while ( l_pos != NULL )
{
plcCols = pDoc->m_cl_cols_list.GetNext( l_pos ) ;
switch ( li_col )
{
case CP_COMPANY:
case CP_CR_ORDER_ID:
case CP_CR_PRICE:
case CP_CR_VOLUME:
case CP_CR_AMOUNT:
li_width = 70;
break;
default :
li_width = 85 ;
break ;
}
m_list.InsertColumn(li_col, (char *)(LPCTSTR)plcCols->m_header, LVCFMT_RIGHT, li_width);
li_col++ ;
}
m_list.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES ) ;
// Sets/Resets the column, which support the in place combo box
/* m_list.SetReadOnlyColumns(CP_CR_ORDER_ID, TRUE);
m_list.SetReadOnlyColumns(CP_CR_PRICE, TRUE);
m_list.SetReadOnlyColumns(CP_CR_VOLUME, TRUE);
m_list.SetReadOnlyColumns(CP_CR_AMOUNT, TRUE);*/
/* CString strValidChars = "0123456789.";
m_list.SetValidEditCtrlCharacters(strValidChars);*/
m_list.m_header_ctrl.Set_HeaderLinesNo( 2 ) ;
}
//---------------CNGTSMarketMaint::Fill_ListCtrl----------
void CCheckResult::Fill_ListCtrl()
{
int li_i ;
CString lc_tempstr;
CNGTS_CheckResult_Info* ptr = NULL;
m_list.SetRedraw( FALSE ) ;
m_list.DeleteAllItems();
for ( li_i = 0 ; li_i < g_NGTS_CheckResult_List.m_list.GetSize() ; li_i++ )
{
ptr = &g_NGTS_CheckResult_List.m_list[li_i];
ItemAdd_ListCtrl(ptr);
if(li_i == 0)
{
/* set static text telling the check type of the data */
/* m_vat.SetWindowText( lc_tempstr ) ;*/
}
}
m_list.SetRedraw( TRUE ) ;
}
void CCheckResult::ItemAdd_ListCtrl( CNGTS_CheckResult_Info *ptr_oi_attr )
{
LV_ITEM lvitem ;
CString lc_tempstr ;
int li_current_item;
CRes_Order_Info *lcs_order ;
CNGTS_Instrument_Info *lptr_Instrument ;
lcs_order = g_Market_Summary.Locate_Order_By_OrderReference( ptr_oi_attr->m_rec.order_reference ) ;
// Locate the Market Pointer & Instrument
if (( lptr_Instrument = lcs_order->Locate_Instrument()) == NULL )
return ;
lc_tempstr.Empty();
g_Market_Summary.Get_User_Company_Code( lcs_order->m_order_rec.company_id, &lc_tempstr ) ;
lvitem.pszText = (char *)(LPCTSTR)lc_tempstr ;
int iCount = m_list.GetItemCount();
li_current_item = m_list.InsertItem(LVIF_TEXT|LVIF_STATE, iCount,
lc_tempstr,0,0, 0, 0);
lvitem.mask = LVIF_TEXT ;
lvitem.iImage = 0 ;
lvitem.iItem = li_current_item ;
lvitem.iSubItem = CP_CR_ORDER_ID ;
lc_tempstr.Format("%d",lcs_order->m_order_rec.order_id);
lvitem.pszText = (char *)(LPCTSTR)lc_tempstr ;
m_list.SetItem( &lvitem ) ;
lvitem.iSubItem = CP_CR_PRICE ;
lcs_order->Price_Format( lptr_Instrument, &lc_tempstr ) ;
lvitem.pszText = (char *)(LPCTSTR)lc_tempstr ;
m_list.SetItem( &lvitem ) ;
lvitem.iSubItem = CP_CR_VOLUME ;
lcs_order->Volume_Format( lptr_Instrument, &lc_tempstr ) ;
lvitem.pszText = (char *)(LPCTSTR)lc_tempstr ;
m_list.SetItem( &lvitem ) ;
lvitem.iSubItem = CP_CR_AMOUNT ;
CString x,y;
lc_tempstr.Format("%.2f",lcs_order->Volume_Format( lptr_Instrument, &x ) * lcs_order->Price_Format( lptr_Instrument, &y ));
lvitem.pszText = (char *)(LPCTSTR)lc_tempstr ;
m_list.SetItem( &lvitem ) ;
m_list.SetItemData( li_current_item, (long)ptr_oi_attr ) ;
}
/*----------------CCheckResult::Save_Setting------------------*/
void CCheckResult::Save_Setting( CString pc_section )
{
CString lc_tempstr ;
CResMarketSmryDoc *pDoc =(CResMarketSmryDoc *) GetDocument();
lc_tempstr.Format( "%s", pDoc->m_classname ) ;
g_Res_Utils.WriteUserProfileString( pc_section, "name", (char *)(LPCTSTR)pDoc->m_classname, g_Res_PgmInfo.m_screen_file ) ;
g_Res_Utils.SaveWindowXY((CWnd*) GetParentFrame(), pc_section, (char*)(LPCTSTR)lc_tempstr, g_Res_PgmInfo.m_screen_file ) ;
g_Res_Utils.SaveListCtrlColWidth( &m_list, pc_section, (char *)(LPCTSTR)lc_tempstr, pDoc->m_ctlList_cols, g_Res_PgmInfo.m_screen_file ) ;
}
//-----------------------CCheckResult::Restore_Setting---------------
void CCheckResult::Restore_Setting( CString pc_section )
{
CString lc_tempstr;
CResMarketSmryDoc* pDoc =(CResMarketSmryDoc *) GetDocument();
lc_tempstr.Format( "%s", pDoc->m_classname ) ;
g_Res_Utils.LoadWindowXY((CWnd*) GetParentFrame(),pc_section, (char *)(LPCTSTR)lc_tempstr, g_Res_PgmInfo.m_screen_file ) ;
g_Res_Utils.LoadListCtrlColWidth( &m_list, pc_section, (char *)(LPCTSTR)lc_tempstr, pDoc->m_ctlList_cols, g_Res_PgmInfo.m_screen_file ) ;
}
//---------------CResTransactionLog::OnContextMenu---------------
void CCheckResult::OnContextMenu(CWnd*, CPoint point)
{
if (point.x == -1 && point.y == -1)
{
//keystroke invocation
CRect rect;
GetClientRect(rect);
ClientToScreen(rect);
point = rect.TopLeft();
point.Offset(5, 5);
}
CMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUP_CHECKRESULT));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = this;
CNgxtsApp *thisapp = ( CNgxtsApp* )AfxGetApp() ;
CResourceMainFrame *cmf = ( CResourceMainFrame * )thisapp->m_pMainWnd ;
CNGTS_Instrument_Info *lptr_instr ;
lptr_instr = cmf->m_order_hint.instr_ptr ;
menu.EnableMenuItem( ID_WITHDRAWORDER, MF_BYCOMMAND | MF_GRAYED ) ;
if ( g_Res_PgmInfo.is_trader() || g_Res_PgmInfo.GetUserType() & NP_UR_MARKET)
{
menu.EnableMenuItem( ID_WITHDRAWORDER, MF_BYCOMMAND ) ;
}
while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent();
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
pWndPopupOwner);
}
void CCheckResult::OnWithdrawOrder()
{
CRes_Order_Info *lptr_order = NULL ;
NP_LOCALSTOP_ORDER_REF_REC *ptr_out ;
int nItem = 0;
POSITION pos = m_list.GetFirstSelectedItemPosition();
if (pos == NULL)
;
else
{
while (pos)
{
nItem = m_list.GetNextSelectedItem(pos);
lptr_order = (CRes_Order_Info*) m_list.GetItemData(nItem);
if(lptr_order == NULL){
AfxMessageBox("No item selected");
return;
}
g_Trading_OutMsg.code = NC_MARKET_TO_LOCAL_INFO ;
ptr_out = (NP_LOCALSTOP_ORDER_REF_REC *)&g_Trading_OutMsg.msg ;
ptr_out->order_id = lptr_order->m_extra.m_order_id ;
strcpy(ptr_out->order_reference,lptr_order->m_order_rec.order_reference) ;
ptr_out->instrument_id = lptr_order->m_order_rec.instrument_id ;
ptr_out->user_id = g_Res_PgmInfo.m_logon_rec.client_id ;
g_Trading_OutMsg.Send_Msg() ;
}
}
}
/Espen
|
|
|
|
|
Look at my messages upstair.
"I got it! It can works well in formview now.
In the formview, I set the listctrl's style "Edit labels" to the state of selected, then it work!"
|
|
|
|
|
HarveyLiu wrote:
In the formview, I set the listctrl's style "Edit labels" to the state of selected, then it work!"
man do you mean that you do right click propreties
and then set the edit labels to true
I did that from the beggining
It works but like I said only with the arrows
when you click it with the mouse to select something it quickly deselects itself
|
|
|
|
|
The Solution when using CFormView is to comment out the SetFocus on the OnCreate function in InPlaceCombo.cpp file, the combo box should not have focus when it is created
int CInPlaceCombo::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CComboBox::OnCreate(lpCreateStruct) == -1)
{
return -1;
}
// Set the proper font
CFont* pFont = GetParent()->GetFont();
SetFont(pFont);
//@@SetFocus();
ResetContent();
for (POSITION Pos_ = m_DropDownList.GetHeadPosition(); Pos_ != NULL;)
{
AddString((LPCTSTR) (m_DropDownList.GetNext(Pos_)));
}
return 0;
}
www.pricecutbook.co.uk
|
|
|
|
|
Does anybody know how to get the active cell to change to "next" cell on enter?
When entering more than one value it is not that good to have to use the mouse to get to the next cell. Arrow keys do not set the focus or move the cursor.
/Espen
|
|
|
|
|
|
I have used this controller for a small project, and for me it seems like there sometimes are a problem displaying data.
The problem is that some data is not displayed and some are - using different Pc's, the same application and the same data to display, some rows are missing from the grid or the grid is empty. The problem looks like a memory problem - it is not there all the time. Using purify I do not see any memory problem. My compiler is MSVC 6 on Win XP Pro. All SP installed.
If somebody do know what to look for - please help me.
Yo!
|
|
|
|
|
Please send me the code if possible.
<blink>Aravindan Premkumar
Life is short, enjoy it with a smile as long as it lasts.
|
|
|
|
|
how to lose the focus and made the edit or combo disapear.
|
|
|
|
|
How to add tooltips text on this Inplace edit/combo listctrl
|
|
|
|
|
bootes wrote:
How to add tooltips text on this Inplace edit/combo listctrl
I have not given a thought to this .
I will try and let you know.
|
|
|
|
|
ON_MESSAGE(WM_PASTE, OnPaste)
d:\2004\프로그램관련\style\customizedreportlistctrl_src\listctrl\inplaceedit.cpp(47): error C2440: 'static_cast' : 'void (__thiscall CInPlaceEdit::* )(WPARAM,LPARAM)'에서 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'(으)로 변환할 수 없습니다.
pls, how do i fix it ?
|
|
|
|
|
Hi,
Could you please send me your code or provide more information.
<blink>Aravindan Premkumar
Life is short, enjoy it with a smile as long as it lasts.
|
|
|
|
|
Hi,
I have the same prb.
I added your files to my project and got this from compilation:
Compiling...
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
cl /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Zc:wchar_t /Yu"stdafx.h" /Fp"Debug/vlvconf.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /FR"Debug/" /W3 /c /Wp64 /ZI /TP
.\InPlaceEdit.cpp
InPlaceEdit.cpp
e:\somepath\InPlaceEdit.cpp(47) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CInPlaceEdit::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
I used
Microsoft Visual C++ .NET 69462-335-0000007-18548
aka VC7, while the original example compiles well with VS6.
Do you need more info ?
Thx for help !
Best regards,
H.
|
|
|
|
|
Hi,
In VC7, the message handler return value will have to be changed from "void" to LRESULT. Let me know if this does not solve the problem.
<blink>Aravindan Premkumar
Life is short, enjoy it with a smile as long as it lasts.
|
|
|
|
|
It does ! So thank you !
I did that already b/c I found from the "goto definition" in afxmsg_.h the LRESULT as required return type ..
I changed the existing returns in the OnPaint to return(-1) and added
a return(0) to the end of the function.... well the returned value is
anyway not used (I guess).
I did not yet add functionality yet - but at least it compiles
Thank you again,
H.
|
|
|
|
|
The message handler has changed to a LRESULT return value in VC7(+)
So change in InPlaceEdit.h from:
afx_msg void OnPaste(WPARAM wParam, LPARAM lParam);
to
afx_msg LPARAM OnPaste(WPARAM wParam, LPARAM lParam);
and in the .cpp to:
LPARAM CInPlaceEdit::OnPaste(WPARAM /*wParam*/, LPARAM /*lParam*/)
You will then need to change all the return values to return 0, and
change "CEdit::Default();" to "return CEdit::Default();"
|
|
|
|
|