|
I use the example program to add my project.And my project is a Dialog based program use another class named CTabCtrlSSL.It can use a dialog as propertypage .I add the Dialog demo to my program as one propertypage in tabctrl.but when i want delete one row use sendmessage function.it will delete two rows .why ?
|
|
|
|
|
I tried to create a supergrid in a dialog.
It works fine, but it seems the checkboxes are lost.
The demo project has the same problem when try to
display the grid in dialog. Any suggestions?
|
|
|
|
|
If you replace the initialization code to be the same as that used for the view it seems to work fine (although I haven't done much testing) and you can see the checkboxes.
The following is the patched OnCreate method for the dialog:
int CTestTreeDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
//m_List.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(0,0,0,0),this,0x1001);
//m_List.InitializeGrid();
//m_List.SetExtendedStyle(0);
//m_List.ModifyStyleEx(0,WS_EX_CLIENTEDGE);
m_List.Create(WS_CHILD | WS_VISIBLE,CRect(0,0,0,0),this,0x100);
m_List.InitializeGrid();
return 0;
}
|
|
|
|
|
Hi, I've seen a newer code at http://codeguru.earthweb.com/listview/supergrid.shtml
But in the sources you tell us that you update more often here, but the more recent code is still at codeguru!!
|
|
|
|
|
Hi wanna do drag n drop with root items,
does anybody know how that works?
thanks in advance
|
|
|
|
|
I did use the Microsoft Drag and Drop classes. It works fine.
Below is an example of my Symbol Grid which is derived from CSuperGridCtrl.
You need do register the clippboard format You want to usein the ctor of CSymbolGrid:
CSymbolGrid::CSymbolGrid()
{
DragDropFormat = ::RegisterClipboardFormat(GLOBAL_CLIPBOARD_FORMAT);
}
void CSymbolGrid::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
CString lAddress,lLength;
int SelItem = GetSelectedItem();
GetSelAddress(lAddress);
GetSelLength(lLength);
// Create the drag&drop source and data objects
COleDropSource *pDropSource = new COleDropSource;
COleDataSource *pDataSource = new COleDataSource;
// now grab the data (here: the count and text)
// and serialize it into an clipboard archive
HGLOBAL hGlob;
try // to drag into a memory dump
{
CSharedFile file(GMEM_ZEROINIT|GMEM_DDESHARE|GMEM_MOVEABLE);
CArchive ar(&file, CArchive::store);
// "Serialize" your data object into the archive
// (yes, you may use YourObject.Serialize(ar) here!)
CPtrArray lptrArr;
OnAddVar(lptrArr);
WORD larrSize = lptrArr.GetSize();
ar << lAddress << lLength << larrSize;
ar.Close();
// put the file object into the data object
hGlob = file.Detach();
pDataSource->CacheGlobalData(DragDropFormat, hGlob);
pDataSource->DoDragDrop(DROPEFFECT_MOVE|DROPEFFECT_COPY, NULL, pDropSource);
}
catch(...)
{
// exception while destructing the file
ASSERT(FALSE);
}
delete pDropSource;
delete pDataSource;
*pResult = 0;
}
In the Target Window You must also Register the ClipBoard Format.
For the Drop Target I use a derived class
class CViewDropTarget : public COleDropTarget
{
public:
CViewDropTarget();
virtual ~CViewDropTarget();
void SetClassPtr(CView *lptr) { ViewPtr = lptr; };
private:
CView *ViewPtr;
UINT DragDropFormat;
public:
CString Address; // Address we got by Drop operation
CString Length; // Length we got by Drop operation
protected:
virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point );
virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point );
};
CViewDropTarget::CViewDropTarget()
{
DragDropFormat = ::RegisterClipboardFormat(GLOBAL_CLIPBOARD_FORMAT);
ViewPtr=NULL;
}
CViewDropTarget::~CViewDropTarget()
{
}
DROPEFFECT CViewDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point )
{
CFile *pFile = pDataObject->GetFileData(DragDropFormat);
if (pFile != NULL)
{
// perhaps some point checking here?
delete pFile; // Is a must, because every time a Shared memory object is created,
// which must be deleted !
return DROPEFFECT_COPY; // data fits
}
else
return DROPEFFECT_NONE; // data won’t fit
}
BOOL CViewDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point )
{
CFile *pFile = pDataObject->GetFileData(DragDropFormat);
if (pFile != NULL)
{
// perhaps some point checking first?
try
{
CArchive ar(pFile, CArchive::load);
if (DragDropFormat != CF_TEXT)
{
// "Serialize" your data object from the archive
// (yes, you may use YourObject.Serialize(ar) here!)
ar >> Address >> Length;
}
ar.Close();
}
catch(...)
{
// exception in the destructor of ar
ASSERT(FALSE);
}
}
delete pFile; // Is a must, because every time a Shared memory object is created,
// which must be deleted !
// notify our view from a drop operation
SendMessage(ViewPtr->m_hWnd,WM_USER_DROP_MEM_DUMP,0,0);
return COleDropTarget::OnDrop(pWnd, pDataObject, dropEffect, point);
}
Create an Instance of this class in Your View
class CMyView : CView
{
private:
CViewDropTarget DropTarget
}
CMyView::CMyView()
{
DropTarget.SetClassPtr(this); // mark it as target for our sendmessage function
}
in the View ctor set the view ptr to make it for the class possible to send a message when
a drop operation has occured.
CMyView::OnInitialUpdate()
{
// register Your view as drop target
if( !DropTarget.Register(this) )
ASSERT(FALSE);
}
Thats all I think. It works great.
|
|
|
|
|
Hi,
How do i actually edit the items in listview? i don't want to just edit the most left first column, i need to be able to edit all the columns.
thanks a lot!
|
|
|
|
|
This one has already support to edit all the items in listvews. You can press "right arrow", then, "enter", then you can edit the item which you select.
Try it!;P
Programming is funny.
|
|
|
|
|
I made a modification on your application to adapt it to another context:
- suppress of the tree aspect
- intelligent loading of lists in combos
- definition of readonly cells
- add multi line tooltip by item
- update the font to a bigger one
- ...
It works fine
Thanks again
Mohamed KHADRAOUI
|
|
|
|
|
hello,
i want to display an icon ! in the center of the column.For
drawing columns we are using listview control..it is not ownerdrwan ...thats why i am gettting problem..is there any way to do this...?
and second thing is i want to select(highlight) all the columns in a row except the first one.
i am using vc++.
these are higher priority issues...
so please help me out in this
thank you,
kalpana
|
|
|
|
|
I'd like to know how I can sort the entire tree.
With kind regards
Raymond Falck
RaymondFalck@Hotmail.com
|
|
|
|
|
Hi
firstly, thanks for making that great control...
I'v got some question...
I would like to make Multiline from second collum to end...
It means the item in the first collum has several datas...
So I want to display that several datas in the control...
Do you have any tips for this question...?
Please help me....
have a nice day....
--- thunder ---
|
|
|
|
|
I'm not an expert in C++, but I really like this control. Is there a way to port it to the web quickly? Possibly making it an Active X control. If anyone has any ideas I would really appriciate it.
Thank you, David DeBoer
|
|
|
|
|
If my control's data depends on data group read from equipment and some data changed in seconds(you maybe don't know which one will change and when it will change), my question is how to easy map this data to grid and redraw it on time, it's better change it's font(color). thanks
|
|
|
|
|
How can I use superGrid in visual fox forms?
Mr. Fox
|
|
|
|
|
Dear Mr. Fox
No
Allan
|
|
|
|
|
Hi,
I inserted a ListCtrl in a dialog (In a Dialog based appl) and setted in the resource editor some properties (View=Report; No column header; No sort header). In the classwizard i added a member variable to this control (CSupergridCtrl as the class). But, when i added the items, the plus sign doesn't appears nor the images. Can anyone help me, please? BTW: i used it as in the demo and i inserted the initialization in OnInitDialog.
Best Regards,
Dirsow.
|
|
|
|
|
Hi,
the demo is using the CMySuperGrid m_List; not the CSuperGridCtrl directly, this means
that the code in the int CMySuperGrid::OnCreate(LPCREATESTRUCT lpCreateStruct) will
never be called, e.g the imagelist will not be created and hence you don´t see the images.
Hope this helps
regards, Allan
|
|
|
|
|
The code to draw the plus/minus signs and item images is in the DrawItem handler. To get this called in a dialog, use an owner drawn list control. Delete the list control from the dialog, and add a CMySuperGridCtrl m_ListCtrl in the header of the dialog. In the OnInitDialog handler of your dialog class, you can then add something like:
CRect rcSheet;
GetDlgItem( IDC_STATIC_PLACEHOLDER )->GetWindowRect( &rcSheet );
ScreenToClient( &rcSheet );
m_ListCtrl.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT, rcSheet, this, IDC_SQ_LIST);
m_ListCtrl.InitializeGrid();
Where IDC_STATIC_PLACEHOLDER is just a picture placeholder for the ListCtrl and IDC_SQ_LIST is just an entry in the resource.h file.
Orlando
|
|
|
|
|
Hi all,
in regards to this article, I have a new email
an@norager-consulting.dk
Allan
|
|
|
|
|
Hi Allan
I am very interesten in your supergrid control and I would like to know if you have some instructions on how to use it (files required, how to call it, etc.). Thank you in advance
Best regards,
Manuel Ventura
manuel.ventura@ist.utl.pt
|
|
|
|
|
This isn't documented.
|
|
|
|
|
Didn't you check supergridctrl.h?
|
|
|
|
|
I didn't yet use that control, but i couldn't find such a beautiful and free control on the net.
Before going deep further in the use of SuperGrid Control, i'd like to know :
- if it's possible to print/print preview from SuperGrid Control,
- if you could provide a VC5 release of that library (ok i know we're going to soon be in VC7 and some guys keep on using VC5 !!!).
Thanks for any answers.
|
|
|
|
|
Hi!
I'm using this great control in a View in a MDI application. The control works ok, but the grid appears empty.
But, if you click in a cell, and edit control appears with the correct data so you can edit it. When you finish,
the data disapperars again. Then, you only view a grid with empty cells, but the data is here!!!
This is the code I use:
CSuperGridCtrl m_lbLista;
CItemInfo* lp;
LV_COLUMN lvColumn;
m_lbLista.Create(WS_VISIBLE|WS_CHILD, CRect(0, 0, 0, 0), this, ID_LISTASQL);
m_lbLista.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT);
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.cx = 100;
lvColumn.pszText = "Columna 1";
m_lbLista.InsertColumn(0, &lvColumn);
lvColumn.pszText = "Columna 2";
m_lbLista.InsertColumn(1, &lvColumn);
lp = new CItemInfo();
lp->SetItemText("Texto 1");
lp->AddSubItemText("Texto 2");
m_lbLista.InsertRootItem(lp);
This show an empty grid, but if you click on the first cell, an edit control appears with the text "Texto 1".
Then, the data is here, but not show.
Any ideas
|
|
|
|
|