|
Cool, all good for tabs then.
Tried running the TabViews sample on VS2008, and it's reporting a problem with the manifest file. After trying a full conversion from the VC6 project (and adding some missing files) same result, but setting the Generate Manifest item to No in the linker properties allowed the Release build to run.
Will have to check this again - is this the trouble you're having? You didn't mention an 'Unable to start' message.
Tim
|
|
|
|
|
Hi Tim,
Yes, that's exactly the problem that I was having.
I compared the property page of the 3dTabview and
the property page of the Tabview, and the property
pages looked the same.
-jc
|
|
|
|
|
Ok - looks like the manifest file that shipped
with the project has some problematic refs to VC8.
Open the TabViews.exe.manifest file (should be available in the
Source Files section of the Solution view) and remove the
following dependencies:
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.DebugMFC' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
You may find that on run it complains about not being able
to find the MFC90xx.dll - this happens sometimes when
the .exe file is not being placed in the output directory -
for each build this should be edited in the Linker | General
settings to include $(OutDir)\ before the filename of the Output File.
Not sure that explains much in the 'why' category, but should help.
Tim
|
|
|
|
|
Tim,
I built/executed the demo "cell types" program,
and I reviewed the code about changing the
fonts.
However, when I tried using the" QuickSetFont() method,
in my application, I observed some strange behavior.
//code snippet
CFont noFont;
CFont boldFont,
boldFont.CreateFont( 14, 0, 0, 0, 900, 0, 0, 0, 0, 0, 0, 0, 0, _T( "Arial" ) );
QuickSetFont(yCol,xRow,&noFont)
QuickSetText(yCol,xRow,_T("No font created?"));
//The font is different than the "normal" font, but what font
//attributes are being used?
QuickSetFont(yCol,xRow,&boldFont)
QuickSetText(yCol,xRow,_T("Font created"));
//The font looks like the "noFont" ?
I made a few changes in my application, and it
appears that the font problem is related to
an "Excel" type grid and "themes".
Any suggestion, on what changes I should make,
to get the fonts to look like the fonts that
are being created?
Thanks,
-jc
modified on Saturday, December 6, 2008 3:09 PM
|
|
|
|
|
Hi Tim,
Once, we removed the grid code from the
View class, and placed the grid code into
MyCug class, the fonts now look like the
fonts that are being created.
We only have one remaining problem. In the
first grid (first tab), the grid lines are
visible, but in the other four grids the
grid lines are not visible.
For our application, it's not important if
the grid lines are visible or not. However,
all of the grids have to look consistent.
In other words, either the grid lines have
to be visible in all of the grids, or the
grid lines have to be invisible in all of
the grids.
How do we make either the grid lines visible
in all of the grids, or how do make the grid
lines invisible in all of the grids?
Thanks,
-jc
modified on Sunday, December 7, 2008 10:32 PM
|
|
|
|
|
Hi jc
The grid lines that should show by default (on all tabs) are the result of a default to 'exel' borders. You can turn this off with a call to EnableExcelBorders(FALSE) , which should leave you with no lines.
Each cell can take control of the 4 borders style and color, with calls to SetBorder() and SetBorderColor() . This can be done for column defaults for uniformity, or used as a highlight technique.
I don't see why the lines are not showing up in the other grids, but an explicit call to EnableExcelBorders(TRUE) should do it.
Tim
|
|
|
|
|
Hi Tim,
Thank you for your reply.
However, neither the EnableExcelBorders(FALSE)
nor the EnableExcelBorders(true) had any effect on our
application. As such, I tried the EnableExcelBorders(FALSE)
method on the Excel Demo program, and the method had
no effect on the grid lines.
void CExcelDemoView::OnInitialUpdate()
{
CView::OnInitialUpdate();
if( GetDocument()->GetOpenFilename() != _T(""))
{
CXMLParser xmlParser;
xmlParser.SetGridObject( &m_grid );
xmlParser.Load( GetDocument()->GetOpenFilename());
m_grid.AdjustComponentSizes();
}
else
{
int cols = 10, rows = 50;
/////
m_grid.EnableExcelBorders(FALSE);
//////
m_grid.SetDefColWidth( 60 );
m_grid.SetNumberRows( rows );
m_grid.SetNumberCols( cols );
What I am doing wrong?
Thanks,
-jc
|
|
|
|
|
Hmmm... are you starting with the setup in the Excel Demo?
What happens there is that the MyCug::OnSetup calls UGExcel::OnSetup , which sets up a column default cell with thin right and bottom borders, and calls EnableExcelBorders(FALSE) .
The EnableExcelBorders(FALSE) call will, I think, apply to susequent sheets, but not the column default cell, which would need to be put in place for each sheet.
So, the code you want in your OnSetup(s) is probably something like:
GetGridDefault( &cell );
cell.SetFont( CreateFont( -11, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 0, "Arial" ));
cell.SetBorderColor( &m_cellBorderPen );
cell.SetBorder( UG_BDR_RTHIN|UG_BDR_BTHIN );
SetGridDefault( &cell );
There's also some code in there affecting the header defaults etc.
Tim
|
|
|
|
|
Hi Tim,
Thanks again, the code snippet solved the problem.
-jc
|
|
|
|
|
Whenever I am adding up a new row on top of the grid by InsertRow(0), I would like it to get the whole row focused and reverse-highlighted so that the newly inserted topmost row look always selected and reverse-highlighted.
Of course, the previously reverse-highlighted one should be returned to the default color.
What is the simpliest and most efficient way of doing it?
Thanks
HR
modified on Friday, December 5, 2008 4:25 PM
|
|
|
|
|
If you're using multiselect (SetMultiSelectMode(1) ) you could highlight the row by adding a call to SelectRange -
m_pGrid->InsertRow(0);
m_pGrid->GotoRow(0);
m_pGrid->SelectRange(0,0,m_pGrid->GetNumberCols()-1,0);
m_pGrid->RedrawRow(0);
If you don't want multiselection, you can also call SetHighlightRow(TRUE) and then the current row will always be fully highlighted.
If you don't like that effect, you could set a member flag that says 'drawing new row' and check it in OnGetCell , allowing you to change the text and back color of cells on the fly if row is 0. [edit] Hmmm - but depending on when you reset the flag that might mean that you would need to check another flag and redraw the row in OnRowChange - could get cumbersome). [/edit]
Tim
|
|
|
|
|
r_grid1.SetMultiSelectMode(1);
int ans = r_grid1.InsertRow(0);
cell.SetBackColor(RGB(0, 255, 255));
cell.SetTextColor(RGB(0, 0, 0));
r_grid1.QuickSetRange(0, 0, r_grid1.GetNumberCols() - 1, 0, &cell);
r_grid1.QuickSetText(0, 0, _T("MC"));
r_grid1.GotoRow(0);
r_grid1.SelectRange(0, 0, r_grid1.GetNumberCols() - 1, 0);
r_grid1.RedrawRow(0);
Everytime the above code is executed, a new colored row is inserted. Therefore all inserted rows are colored.
But what I want is to first reset the previous top row's color to default (white/black) and color the newly inserted row only.
How should I modify?
HR
modified on Saturday, December 6, 2008 4:06 AM
|
|
|
|
|
Whenever I 'InsertRow(0)', a row is inserted at the top, however the row is not instantly displayed but I had to move back and forth the horizontal scrollbar a few times. Clicking the new row will also display some columns but not all. It depends on which column I click.
How do I make the newly inserted row displayed immediately?
HR
<ps> How do I attach a file to show the screen captures?
modified on Wednesday, December 3, 2008 4:40 PM
|
|
|
|
|
You could try some combination of:
m_pGrid->InsertRow(0);
m_pGrid->GotoRow(0);
m_pGrid->RedrawRow(0);
Or maybe RedrawAll() - but I think GotoRow() might do it.
Tim
|
|
|
|
|
It's working.
Thanks again.
HR
|
|
|
|
|
ehaerim wrote: How do I make the newly inserted row displayed immediately?
There's no approved facility for inserting anything more than smileys in a message - it would be a big hit on bandwidth - if you have a page somewhere else you can put a gif, you can link to it.
Tim
|
|
|
|
|
I want to display the grid's record # in asending order on the first left column. This would be shown as 1, 2, 3, ...
And also want to InsertRow everytime a new record is available and display the sequence # of that record. That would be shown as ..., 3, 2, 1 from top to bottom.
Now, the first left columen needs to be updated everytime a new record is inserted. Simply, I would increment all the record # by 1 to make them look like 2, 3, 4, ... and insert the new record with #1. This is problem when there are thousands or more records because I have to update all the existing records' sequence #s.
This will cause the grid slow down and even could cause flickering.
Is there any efficient way of doing it?
|
|
|
|
|
Check out the OnGetCell notification - this is called just before the cell is about to be displayed with the row and col and a pointer to the cell.
Set the cell's value (cell->SetNumber(row) ) if it is in a col that should display the index (e.g. col == 0).
I'm a little unclear about the decending index though.
Tim
|
|
|
|
|
It works great! Thanks.
HR
|
|
|
|
|
Ultimate Grid popup menus get created by the OnRButtonDown message. The normal behaviour is for context menus to appear when the right mouse button is released.
Also I believe that the creation of context menus should be done in the WM_CONTEXTMENU handler, not in OnRButtonDown.
A WM_CONTEXTMENU handler should be used so that the Application key (the one next to the right control key) and Shift+F10 work. Some rules would need added to decide on a sensible place to create the menu when point (-1,-1) is passed to the handler.
Then OnRButtonUp in the various sections of the grid would call OnContextMenu (the default behaviour of CWnd::OnRButtonUp) so that the popup menu appears when the mouse button goes up rather than down.
Is there any reason why things work as they do? I'm happy to look into a solution if this isn't something that is going to be addressed in a future release.
Regards
Allen
modified on Monday, January 26, 2009 7:23 PM
|
|
|
|
|
I don't think the menu should necessarily be created on mouse button up. Most apps do this but Excel doesn't.
Here's a default implementation for WM_CONTEXTMENU. I think the grid should use this, particularly for accessibility.
UGGrid.h
protected:
afx_msg void OnPaint();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
<code>afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);</code>
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg UINT OnGetDlgCode();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
#ifdef WM_MOUSEWHEEL
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
#endif
DECLARE_MESSAGE_MAP()
UGGrid.cpp
BEGIN_MESSAGE_MAP(CUGGrid, CWnd)
ON_WM_PAINT()
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDBLCLK()
ON_WM_MOUSEMOVE()
ON_WM_RBUTTONDOWN()
<code>ON_WM_CONTEXTMENU()</code>
ON_WM_RBUTTONUP()
ON_WM_CHAR()
ON_WM_KILLFOCUS()
ON_WM_SETFOCUS()
ON_WM_MOUSEACTIVATE()
ON_WM_SIZE()
ON_WM_SETCURSOR()
ON_WM_KEYUP()
ON_WM_GETDLGCODE()
ON_WM_CREATE()
ON_WM_RBUTTONDBLCLK()
ON_WM_VSCROLL()
ON_WM_HSCROLL()
ON_WM_ERASEBKGND()
ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest)
ON_WM_HELPINFO()
ON_NOTIFY_EX( TTN_NEEDTEXT, 0, ToolTipNeedText)
#ifdef WM_MOUSEWHEEL
ON_WM_MOUSEWHEEL()
#endif
END_MESSAGE_MAP()
<code>
void CUGGrid::OnContextMenu(CWnd* pWnd, CPoint point)
{
int col = m_ctrl->GetCurrentCol();
long row = m_ctrl->GetCurrentRow();
CRect rect;
m_ctrl->GetCellRect(col, row, &rect);
int section;
if (col < 0) {
m_ctrl->m_CUGSideHdg->ClientToScreen(&rect);
section = UG_SIDEHEADING;
}
else if (row < 0) {
m_ctrl->m_CUGTopHdg->ClientToScreen(&rect);
section = UG_TOPHEADING;
}
else {
ClientToScreen(&rect);
section = UG_GRID;
}
CPoint pt(rect.left, rect.top);
m_ctrl->StartMenu(col, row, &pt, section);
}
<code>
</code></code>
|
|
|
|
|
Hello,
I successfully built the Excel Sample program.
However, the grid sample does not have sheet tabs
like the web page sample.
How do I create sheet tabs?
Attachment(1)
Thanks,
-jc
|
|
|
|
|
Yes - odd - but you can set up the sheets.
I pasted this code into the start of CUGExcel::OnSetup in the Excel demo:
SetNumberSheets(1);
AddTab(_T("Employees"), 0);
SetTabWidth(200);
SetSheetNumber(0,TRUE);
Since we've set the sheet number, the rest of this setup is valid - could also make use of OnSheetSetup .
Actually, you can comment out the SetNumberSheets and SetSheetNumber calls if you just want the tab to show.
Tim
|
|
|
|
|
Tim,
I am not sure of your explanation, but
I added the code that you provided, and
that fixed the problem.
Thanks,
-jc
|
|
|
|
|
Hello.
First, thanks for sharing this Grid library. I am just beginning to try it out, but it seems very useful.
I have some problems reading the documentation. When I try to open the UGrid72.chm file, I get a message telling me that no link could be established to the web site in Internet Explorer. I can only see the headlines in the left part of the screen, tantalizingly showing me what subjects I could read about if the link had worked...
This looks very much like what is described in the problems.txt file, which tells me to right click on the CHM file, choose properties, and Unblock. Unfortunately, doing so did not solve the problem. Neither did unblocking the CHI file.
Can anybody help me get access to the documentation, either through this file or in some other way?
I am using Windows XP, IE version 6.0. I am working on a computer where I do not have full rights, but are allowed to install programs.
Best regards,
Lars Jødal
|
|
|
|
|