|
|
Comments and Discussions
|
|
 |

|
When I try to download any of the three downloads it goes back to the article saying it wants to make sure I have the newest version or it shows a black console saying no ticket provided.
Please fix I need to construct a grid dynamically with the following features:
1. Unknown number of rows and columns
2. Scrolling
3. Headers that stay in place while scrolling.
4. Cells with letters colored in different colors.
5. Row back ground color depends on data in that row.
6. Movable columns.
7. Hidable rows.
Currently I have 1, 2, 4 and 5 but if I can define my own data source this can be converted to use the MVVM design pattern.
|
|
|
|

|
for example I have a table including a ID column, It need not to be shown on the Grid, But if the Grid can add a new record, how can I added it with a new ID. I suppose it can be added by SQL line like:
INSERT INTO SalaryStatistics (ID,EmpId,iMonth,ItemId,Total) select iif(ISNULL(MAX(ID)),1,max(ID)+1) ,4,201207,1,5000 from SalaryStatistics
the sql code can work for access database.
I did not use auto generate function for ID, because it is not easy for ID replication.
|
|
|
|

|
Thanks it is a good tool.
|
|
|
|

|
I load data from a customized MyDataSource class. It implements GetNumCols, GetNumRows, GetCell. It works well.
Now I want to use more complex top headers, with joined header cells. I noticed in MyCug class we can use SetTH_NumberRows to set multimple header rows and them use JoinCells to join them. But the DataSource Class doesn't have a "GetTh_NumberRows" method or something like that. So how could the MyCug knows there are 2 top header rows in the datasource?
The code I think it should be:
int MyDataSource::GetTH_NumberRows()
{
return 2;
}
int MyDataSource::GetCell(int iCol,long iRow,CUGCell *cell)
{
if(iRow==-2) // set top header cell joins
{
cell->SetJoinInfo(...);
}
...
}
Are there a right way to do that?
ice on my way
|
|
|
|

|
You might not be able to do this in OnGetCell because of the way the cells defer to the parent join on retrieval.
I haven't tested this, but here's something you might be able to try fairly quickly.
Before setting the new datasource as the default, set the top heading row count and implement the joining, text etc. needed for the top heading rows.
After switching to your datasource as the default, add some code to your datasource's GetCell for rows less than 0 that will call the control to get the data for the cell from the default CUGMem datasource.
Something like:
if(row < 0) {
m_ctrl->GetDataSource(0)->GetCell(col,row,&cell);
return UG_SUCCESS;
}
Things like column widths will be controlled by the colInfo for each column, which will I think involves the default datasource, so set these after the switch.
My theory here is that by allowing the memory manger datasource to come into play the cells it stores should be able to retain the info on the joins.
Again, untried, but might not be too hard to implement and test.
Tim
|
|
|
|

|
Hello,
I'm having problems with vs2008 and mssql2005 express.
When i try:
CUGODBCDatasource *m_odbc;
m_odbc->Browse(this->m_hWnd);
app crashes on Close() ugodbc.cpp 83 line.
if i use
CUGODBCDatasource m_odbc;
m_odbc.Browse(this->m_hWnd);
datasource dialog opens up, but when i select datasource i get "Buffer is too small" error after UGStr::tcscpy((LPTSTR)m_dsInfoArray[m_tableCount].remarks,255,(LPTSTR)szRemarks); on ugodbc.cpp 268 line
if i increase 255, app crashes after *m_odbc->GetConnectString() call.
odbc examples works fine. but if i try to recreate them in vs2008 project i get the same as above.
modified on Thursday, November 5, 2009 9:23 AM
|
|
|
|

|
Hello,
The following two changes prevent the demo program from crashing,
when the user tries to move to the right of the last column.
Change 1:
CString string;
SQLColumnInfo* cfi = m_Record->GetFieldInfo(col);
if (col == m_Record->m_nFields) return UG_SUCCESS;
if(m_Record->IsFieldNull(cfi->pValue)) {
------------------
change 2:
From:
if (col <= (int)m_nFields)
To:
if (col < (int)m_nFields)
|
|
|
|

|
Hi everyone.
I have my data in a self-defined data structure (like a memory db) and have a large count of rows, and the rows count is known. At the start, I load data in CMyCug::OnGetCell, the grid works well, the data is displayed without any delay.
Now I want to use a data source instead of loading data in CMyCug directly. But if MyDataSrc::GetNumRows returns the real count of rows, all cells will be loaded when setup the data source, and it costs seconds to show the grid. I noticed the implemention in CADOImpDataSource, which load data when "hit bottom". The defect is the vertical scrollbar cannot indicate the real count of rows and cannot be scroll down to any where immediately.
Any way to do this?
ice on my way
|
|
|
|

|
Hi
No, that shouldn't be the case - if you implement GetNumCols and GetNumRows in your datasource, then
int index = AddDataSource(&m_data);
SetDefDataSource(index);
SetGridUsingDataSource(index);
should be all you need to get going (alternatively, you can bypass SetGridUsingDataSource and set the cols and rows yourself - they needn't be the same as the data).
When the grid needs to paint a cell, it will call your datasources GetCell, which will fill in what's needed, much like you were doing in OnGetCell. The only load time should be in preparing the underlying memory DB, which should be managed by the datasource. If preloading the whole mem DB is a problem, you could probably load as you go, keeping track of how many rows are loaded - my thought is if you know the row count you've already loaded everything. Either way, this is different from the OnHitBottom approach.
It's a nice advantage to have a datasource that knows it's dimensions - no need for OnHitBottom, and the scrollbars should be ok.
Tim
|
|
|
|

|
I'm starting to use Ultimate Grid in an application that uses MS SQL-Server 2000 for the database.
I'm using the ADOImpDatasource class supplied with UG and found that I always got empty grids, no matter what SQL statement I employed. The same SQL statements yield data as expected when I retrieve them with my homemade ADO wrapper class used in calculation routines.
I found out that what made the difference was that my homemade wrapper uses client-side cursors (adUseClient), whereas ADOImpDataSource doesn't specify the cursor location which then defaults to server-side (adUseServer).
I inserted one line into the source of ADOImpDataSource that sets the cursor location to adUseClient (pConnection->CursorLocation = adUseClient), and the grids then filled up with data as expected.
Am I missing something here?
|
|
|
|

|
Hi, Tim
How can I using mdf Microsoft SQL Server Database files(in version 2005 )(*.mdf_*.ldf) in my mfc project with Ultimate grid control?
Thanks a lot !
|
|
|
|

|
You'll need to have MS SQL Server (or Express) installed, then you can set up an ODBC datasource if you have a correct ODBC driver (Control Panel, Administrative Tools, Data Sources(ODBC)).
Once that's done, you should be able to use one of the existing grid datasources (ODBC, ADO, OLEDB) to connect to the SQL Server database engine through that driver. For SQL Server 2005, I think you can use the SQL Server driver or the newer SQL Native Client to set up the datasource.
Tim
|
|
|
|

|
Hi Tim
Ok,I found it,but I want a connect string like "Driver={SQL Native Client};Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;"
with this connect string like a access *.mdb file I can put my *.mdf & *.mdl file side of my project and run it.
Cleary same as your sample ADO datasource that put "test1.mdb" side of program I want use a file like "test1.mdf";
|
|
|
|

|
I think the .NET SqlClient can support (e.g. build a connection string) with this type of file spec, but not ODBC.
Tim
|
|
|
|

|
Hi, Tim
Use the CUGODBCDatasource and UGctl to connect SQL Server2000.
When the field type is smalldatetime(fold:Ultimate Grid\Examples\ODBCEx), the programmer crash. Why...!
Thanks a lot!
|
|
|
|

|
Which version of Visual C++ are you using?
Tim
|
|
|
|

|
I use the VC6.0. Is it the key?
|
|
|
|

|
Hi
My SQL platform is a bit limited here - I was able to open a table with a smalldatetime (I don't see smalltime) though, with the example you mentioned. This code in CUGRecordset::BindFields should execute:
case SQL_DATE:
case SQL_TIME:
case SQL_TIMESTAMP:
cfi->pValue = (void *) new TIMESTAMP_STRUCT;
memset(cfi->pValue, 0, sizeof(TIMESTAMP_STRUCT));
break;
break;
There were a couple of changes to this method in Update 02 - and a previous version would ASSERT(0) if the field type was not identified - but not sure how this would affect you.
What type of crash occurs - and does it occur binding to the field, or at some other point?
Tim
|
|
|
|

|
Hi Tim,
Thanks a lot for your reply! yes ,it is "smalldatetime" type field.
I find that there is no problem with the release version program.
The debug version crash with the following information:
Debug Assertion Failed!
Program:... imateGrid\source\Ultimate Grid\Examples\ODBCEx\Debug\Ex11.exe
File:olevar.cpp
Line:2251
For information on how your program can cause an assertion failure, see the
Visual C++ documentation on asserts.
(Press Retry to debug the application)
|
|
|
|

|
Hi
I don't see the problem in debug builds, compiling both against the standard VC6 directories and the PSDK 2003. Line 2251 of olevar.cpp doesn't show me anything. Are you using another version of the Platform SDK?
Try to debug the assertion (Retry) and see what the code says - you might also want to open the call stack window to track the call(s) back to the example code.
Tim
|
|
|
|

|
Hi;
has anyone ever created a CUGDataSource based on Oracle's OCI API?
Any help in this is very welcome...
Martin
|
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
An introduction to using custom datasources with the Ultimate Grid
| Type | Article |
| Licence | CPOL |
| First Posted | 24 Aug 2007 |
| Views | 41,486 |
| Downloads | 850 |
| Bookmarked | 32 times |
|
|