|
Hi,
I wrote the following line :
m_grid.GetCell( 1, 1)->SetText("First line\nSecond line");
and enabled the tool tips.
However the tip for the (1,1) cell appeared as one line ,
meaning '\n' didn't do a thing
How do I make the tip to appear as two lines
or how do I create a multiline tip
Daniel Mark
Thanks
|
|
|
|
|
in the TitleTip.cpp
you should replace the line:
dc.TextOut( 0, 0, strTitle );
with
dc.DrawText(strTitle,strTitle.GetLength(), ......
where the strTitle contains all your data including "\n".
Before calling the DrawText fuction, you should recalc the rect.
|
|
|
|
|
It seems that there is a problem whereby the grid
doesn't get registered as a drop target unless it
contains scroll bars.
If I place a custom control box that is bigger than
the grid (and thus no scroll bars are necessary) then
I can pick the text, but cannot drop it onto that grid.
I would think drag and drop on a grid that requires
scrolling is a bit of a problem!!
Michael Katzmann
|
|
|
|
|
I have a DTCrecordset control, and a form manager control on my web page.
When I insert a record, then update the record shows it is updated.
If I hit the refresh button on my web browser it gives me a popup message to retry or cancel, if someone hits retry it creates another record. Does anyone Know a way around this?
LK
|
|
|
|
|
I had to make the following minor change in order to get it to work within our application where we've internationalized, placing all of our resources in a separate .DLL (any dialog which had a CGridCtrl would fail to load):
change
HINSTANCE hInst = AfxGetInstanceHandle();
to:
HINSTANCE hInst = AfxGetResourceHandle();
Steve Wolf
|
|
|
|
|
I'm trying to use the grid control in a CFormView-based class, by inserting a custom control in the dialog. My application fails with "Failed to create empty document" message at start, this seems to be caused by failure in CFrameWnd::LoadFrame() to create the main window. Any ideas on how to make this work?
|
|
|
|
|
forget about subclassing the dialog custom control and create the control at runtime on the formview's initialupdate call, that's how i'm doing it in my program ie i have a seperation function cll CreateGrids()
called from CFormView::OnInitalUpdate();
// protected member variable initalized in constructor to null
// CGridCtrl* m_pTopScoresGrid
CFormClassView::OnInitialUpdate()
{
if (m_pTopScoresGrid == NULL)
{
// Create the Gridctrl object
m_pTopScoresGrid = new CGridCtrl(6,12,2,1);
if (!m_pTopScoresGrid) return ;
// Create the Gridctrl window
rect.left=220;
rect.right=rect.left+370;
rect.top=30;
rect.bottom= rect.top+178;
m_pTopScoresGrid->Create(rect, this, 100);
m_pTopScoresGrid->EnableWysiwygPrinting();
m_pTopScoresGrid->SetEditable(FALSE);
for(int i=1; i< m_pTopScoresGrid->GetColumnCount(); i++)
m_pTopScoresGrid->SetColumnWidth(i,24);
for(int j=0; j < m_pTopScoresGrid->GetRowCount(); j++)
m_pTopScoresGrid->SetRowHeight(j,26);
} // end of CFormClassView::OnInitalUpdate
// of course you might want a line or 2 in the OnSize function
// so that the grid will size with the window for the view like
void CFormClassView::OnSize(UINT nType, int cx, int cy)
CFormView::OnSize(nType, cx, cy);
CRect cRect;
CRect tsRect;
GetClientRect(cRect);
// make sure we have a grid to resize
if(m_pTopScoresGrid!=NULL )
{
tsRect.left=220;
tsRect.right=cRect.right-12;
tsRect.top=30;
tsRect.bottom=tsRect.top+182;
m_pTopScoresGrid->MoveWindow(&tsRect);
} // make sure pointers have vaild window objects
} // end of CFormClassView::OnSize
i've don't particularly like having to subclass the custom control in the dialog code, this way is
easier, for me. you may have to finesse the rect to get the control where you want it.
|
|
|
|
|
|
Hi,
I am using the Grid Control with some Check Boxes, and I need some of the check boxes to be centered, and some to be left aligned. The current Version 2.22 does not allow this. Either all check boxes are left, or centered. Here is my fix.
BOOL CCellCheckBox::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd )
{
.
.
.
.
DWORD nFormat=GetFormat();
if (nFormat & DT_RIGHT) rectCheck.left=rectCheck.right-nSize;
if (nFormat & DT_CENTER)
{
rectCheck.left=rect.CenterPoint().x -(nSize>>1);
rectCheck.right=rectCheck.left+nSize;
}
if (nFormat & DT_TOP) rectCheck.bottom=rectCheck.top+nSize;
if (nFormat & DT_BOTTOM) rectCheck.top=rectCheck.bottom-nSize;
if (nFormat & DT_VCENTER)
{
rectCheck.top = rect.CenterPoint().y - (nSize>>1);
rectCheck.bottom = rectCheck.top + nSize;
}
.
.
.
}
Thanks,
Peter Tewkesbury
Software Developer - Manchester, England
|
|
|
|
|
Hi,
did anybody make a modification for data binding? Read only ODBC level 1 would be enough - just adding several properties for ODBC connection and SQL string.
|
|
|
|
|
Hi,
That is not very difficult. You can do it by self.
But now I am making the grid to read content from ADO
recordset. But the task is not finished. That have any
help for you?
|
|
|
|
|
hi,
how do i get each mfc grid's cell support DDE linkings?
|
|
|
|
|
salut,
nous avons rencontré un problème concernant la base de donnée.
la question se pose comment fait un lien entre le controle Editbox et les champs de la base on a utilisé le composant ADO pour la connexion avec la base et notre application sera réalisée suivant le type dialog-based.
|
|
|
|
|
Hi!
I wanted to change the background color of an individual cell and I tried to do it changing crBkClr but it didn't work...
Do u have any idea of how to do it??
|
|
|
|
|
Hi, You can do this by SetItemBkColour function. I am sure this function is good.
cz
|
|
|
|
|
In v2.22 I've applied the format to remove DT_SINGLELINE DT_VCENTER and the ELLIPSIS stuff, but I'm having trouble getting multi-line cells to auto size. They don't. The extent stuff in the cell classes doesn't actually use the cell width, so I guess that's a non-starter. I added a GetTextExtentEx which also took a col width, but it seems that the height I get back is way too big for the row itself, I'm getting 8 or 9 lines height when I only need 2 or 3. Anyone any advice?
|
|
|
|
|
Not unusually, this was my fault
My mods were all correct, but the problem was I was resizing the rows before setting the normal (larger) column widths in the appropriate columns. Doh!
|
|
|
|
|
Does anyone know how to get the corresponding row numbers for the CGridCellBase objects in the
sorting comparison function? The sorting requirements that I have specify that the grid should be sort by the column selected and a column that contains a price. I know that I can
handle this in the comparison function if I can determine the corresponding row numbers.
Thanks in advance for your help,
Danny
|
|
|
|
|
Hello
I have changed the version of the CGridCtrl class from V2.11 to V2.22 and now the CComboBox doesnt work correctly anymore.
Example: The user selects a string from CCombox and left the active cell => the selected string disappears.
Who can help me ?
|
|
|
|
|
Are there any known issues with the Grid under Windows 95?
I develop using VC++ 5.0 on a Windows NT (SP6) machine. I've added a Grid to a dialog. The dialog is invoked modally from a CButton on a DocView. Under NT the dialog runs perfectly, both from the IDE and fully compiled (as an .EXE). However, if I run the EXE on a Windows 95 machine the entire dialog will not display. Oddly, it does NOT generate an error either.
I've "one by one" removed each control from the dialog and it is definitely the Grid that is causing the problem (or atleast my implementation of it). Any help or ideas would be greatly appreciated.
Mike Mullikin
|
|
|
|
|
There was an issue that had to do with the OLE initialisation, but I thought that had been fixed long ago. I haven't touched win95 for a year or so, os mayhbe the issue has cropped back up again in more recent version.
cheers,
Chris Maunder
|
|
|
|
|
I tried v2.12 with no better luck. I've also disabled TITLETIPS, DRAGDROP & CLIPBOARD (shouldn't that eliminate any OLE issues???), still no luck. Any ideas?
Regards,
Mike Mullikin
|
|
|
|
|
I think I've solved my problem!
I tried the Grid demo on W95/98/ME machines and it worked fine. I wrote my own "simple" demo and it worked fine as well. Then I realized that my "problem" application had one more difference. It has been "localized" for different languages. All of the resources (dialogs, menus, string table etc...) reside in a seperate .DLL file - one for each language.
I started looking through the GridCtrl.cpp and noticed in the RegisterWindowClass() function that the line:
//HINSTANCE hInst = AfxGetResourceHandle();
...was commented out and replaced by the line:
HINSTANCE hInst = AfxGetInstanceHandle();
I un-commented the former and commented the latter and all is well. Why this worked in NT and not 95/98/ME is anybody's guess. I'm sure Microsoft has a good explanation, maybe I'll try to find it someday.
Mike Mullikin
|
|
|
|
|
I've got the same problem, but on Windows 2000. I develop witch VC ++ 6.0 under
WinNt. The Grid works perfect under an NT, but under Win2000, the Dialog wont display.
Derrow
|
|
|
|
|
I had the same problem, but Mr. Mullikin's solution didn't work for me (maybe because I am developing a DLL instead of an exe). Instead, I found the following solution:
In the GridCtrl constructor, I added CS_GLOBALCLASS to the window class style field like so:
wndcls.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
Works for me, I have absolutely no idea why...
--Mike
|
|
|
|