Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Need information about the Grid. Collapse All
Subject Author Date
Gouse Shaik Mar 22, 2007 - 8:33 AM


In my Application I would Like to display the data from a database table in the grid. The grid should have the basic features like editting in the cell, sorting the data in the cells, reordering the fields at run time(move column) And main point is its should be capable of showing minimum 5 lack records with smooth scrolling. I should get the selected records numbers, Highlighting the selected rows. can you please suggest me which grid is better for my requirement. For your kind information we have purchased the Pro-UIS interface.

One more thing is I am getting the records from Database Table. so I will fill the Grid by selectiong one by one record from the RecordSet (That means I dont fill all the records at once). If you have any sample applications in VC++ 6.0, please send that samples.


Technical Support Mar 22, 2007 - 1:33 PM

The CExtGridWnd class implements a grid which can scroll some external data such as a database recordset virtually even if the number of records is unknown. You can see how a database-based grid works in the AdoRecordsetView sample provided with Prof-UIS. There is also a version of this sample (AdoRecordsetEdit) that demonstrates how to make such a grid editable. In both samples, cacheable grid controls are used. It is possible to turn on any row/column highlighting in these sample applications exactly in the same way as in the memory-based grids demonstrated in the SimpleGrids sample. The only difference is that cacheable grids know nothing about external data sources and they cannot sort records. But it is possible to catch a column click event, mark a column with a sort arrow, rebuild the database query and recordset and refresh the grid so it can display resorted rows.

Gouse Shaik Mar 22, 2007 - 10:55 PM

Can You please privide me some sample applications.

Technical Support Mar 23, 2007 - 1:25 PM

AdoRecordsetView and SimpleGrids come both with the full version of Prof-UIS and with Prof-UIS Trial. You can download AdoRecordsetEdit from our web site. Did you have a chance to look at these samples?

Gouse Shaik Mar 24, 2007 - 8:45 AM

Thanks for your valuable and Quick reply.

I am not using the ODBC or ADO or OLEDB Technology. I am using Native interface to fetch the records from my database.
With the SimpleGrids Sample application I have Filled the grid From The Database table which contains 2 lakh records. Here for filling the Grid it was taking more than one minute and at the time of sorting(on column header click) also it was taking one minute for sorting. Is it there any way to Impove the performence (interms of filling the grid, sorting....).
One more thing is After filling the grid I would like to edit a cell, After editing a cell what event I have to check to get the new value from that cell to perform the update operation in my database table with newly edited value.
How can I get the selected rows (Its event).
Can I change the Row Selection Color (presently it was showing blue color) to other color.
I have seen another grid ’Elegant Grid’ which is your product. can you tell me the difference between this elegant grid and the SimpleGrid. Is This ’elegant grid’ useful for me?


Technical Support Mar 25, 2007 - 8:48 AM

Elegant Grid is written in C# and can be used only in .NET, managed code applications. The CExtGridWnd class is an MFC-based grid control written in C++. We guess you are developing an MFC application. If so, you need to learn the CExtGridWnd grid class so you can understand how to access an external data source using your APIs for reading/writing data rows. The CExtGridWnd control uses internal CExtGridDataProvider component for accessing grid cells. Prof-UIS comes with an abstract class CExtGridDataProviderRecordset designed to be the base class for coding cacheable grid cell data providers based on external data sources like databases. So Prof-UIS does not include any ODBC/ADO based code, but it allows you to connect the grid to databases using ODBC/ADO-like APIs by coding custom data provider components. The CAdoDataProvider and CChildView classes in the AdoRecorsetView sample demonstrate how to code a grid based on an external ADO data source. You could code similar classes that use your APIs instead ADO COM objects.

Gouse Shaik Mar 25, 2007 - 11:29 PM


By using the CExtGridWnd class I have filled the grid. Here I have set the Value in cell. Now I would like to get(Retrieve) the Cell values one by one from Grid. Using which method I can get a Cell Value.
one more Thing is how can I get the selected rows in the grid(Its Count, Its row numbers--),
In editing the grid when a uesr edit a cell, then I would like to update with the new value in the database table, for doing this I need the event at where I will get the new value.
When ever user selects a row what event it exactly calls.


Suhai Gyorgy Mar 26, 2007 - 2:22 AM

For all your questions, you should check out the Reference section of the Help for the methods mentioned.

- The very basic function for getting the value is CExtGridCell::TextGet. But depending on the type of the cell you are using, you could use CExtGridCellVariant::GetVariant(); CExtGridCellBool::GetData(), etc. Check out the methods of your cell-class.

- If your grid is set to allow multiple fullrow selection, CExtGridBaseWnd::SelectionGetFirstRowInColumn, CExtGridBaseWnd::SelectionGetNextRowInColumn and CExtGridBaseWnd::SelectionGetLastRowInColumn are the methods you need to call, with nColNo parameter set to 0 in all of them.

- You need to overwrite the CExtGridWnd::OnGridCellInputComplete method in your own CExtGridWnd-derived class. The method is called when in-place editing is complete and the cell value has been changed.

- CExtGridBaseWnd::OnGbwSelectionChanged is the method to overwrite in this case.

Gouse Shaik Mar 26, 2007 - 11:33 PM

Thanks For Your Reply.

I am using the simple grid. In my case I have deal with minimum 1 to 2 lakh records from my database table. With the Grid I am using (Simple Grid) is taking a lot of time to fill the grid. Is it there any virtual mode in simple grid to gain the better performence. Please give me details regarding the virtual mode available in simple grid (If available).

I am using the Grid in MFC Application. Is It There any other grids from you to solve my problems (faster performence).
Is It Possible to change the selection color(Row selection Color, Present it was showing the Blue color).
How can set the some rows as selected as manually at the time of filling the grid or after filling the grid . At present when you click on the row it was selecting that row, but I need To select some of the rows through programming.


Suhai Gyorgy Mar 27, 2007 - 2:23 AM

In Prof-UIS, there is no simple grid or virtual grid. There is only CExtGridWnd and its derived classes. And there are many sample applications along with the source code.
One of the samples is called SimpleGrids. The sample is called that because the CExtGridWnd in it handles the data source in a simple way, using internal data.
Another sample is called AdoRecordsetView. Although this sample uses ADO, it’s main purpose is to show how you could fill the same CExtGridWnd from external data source, virtually. In the sample, this is implemented through a CExtGridDataProviderRecordset-derived class, called CAdoDataProvider. Since you are not using ADO, you need to implement a CExtGridDataProviderRecordset-derived class of your own, which should fetch the records from your database using Native interface and not ADO, as you mentioned earlier. The sample can help you implement this class, although you have to remove everything that is ADO in it and substitute them with your native interface methods.

To change selection color, you should overwrite CExtGridBaseWnd::OnGbwQueryBackColor and return your color’s COLORREF if nColType and nRowType are both 0 (inner cell) and dwHelperPaintFlags has the __EGCPF_HIGHLIGHTED_BY_SELECTED_ROW flag set in it (selected row). Otherwise return baseclass’ return value.

To set the selection by code, you need to use CExtGridBaseWnd::SelectionSet. Check out Help for the parameters of the method. The first rect parameter is not so obvious. For example, if you want to set the 5th row selected (fullrow selection) and you have 10 columns, your rect should be (0, 5, 9, 5) , so indexes of the "borders" of the selected area.

Gouse Shaik Mar 29, 2007 - 9:57 AM

I have seen the sample related to ’AdoRecordsetView’. It is nice. Here when I am using the ’Postgresql Provider’ It was showing only the Field names even though it has records (may be provider problrm). When I have used the ODBC Driver related to the Postgresql it was giving the result with all the Records.

Can I edit The data in the grid by using the ’AdoRecordsetView’. Tell me the procedure how to edit the data in ’AdoRecordsetView’.
Is it Possible to sort The columns in ’AdoRecordsetView’. If yes How?
Is it Possible to reorder the columns by simply dragging with mouse in ’AdoRecordsetView’, If yes How?
How I can I select the rows(entire row) in ’AdoRecordsetView’. one more thing is at the time of opening the Grid I would like show some of the records as selected. How can I achieve this.


Technical Support Mar 29, 2007 - 12:02 PM

The AdoRecordsetEdit sample application is an editable version of AdoRecordsetEdit. If you need to sort/reorder columns in this sample, you should write additional code for handling clicks on header columns, marking them with sort arrows, re-building the data-base query (the grid have no idea how to do this) and synchronizing the grid’s displayed content.