Hello,
what kind of polishing do you mean? One of the reason of this project - avoid such monolithic interface like in reference you mention. I don't like "monster" classes all in one box.
If you prefer see set of methods like SetCellText/SetCellColor/SetCellTextAlign and so on - CppGrid is not such control. I;ve used similar control before - CGridCtrl (http://www.codeproject.com/KB/miscctrl/gridctrl.aspx). This is non optimal by speed and memory and difficult customizable control. It stores all possible cell's data for every cell. The customization is just add one more field to the cell record and scan all the code to insert code sections to draw and manipulate this new data.
Here is another solution - grid control functionality decomposed into several classes. Also it's supports Model/View/Controller pattern which used in many other grid implementation in serious GUI libraries like Qt(http://doc.qt.nokia.com/4.7/qtablewidget.html#details) or GTK++(http://library.gnome.org/devel/gtk/unstable/TreeWidget.html). But they are also too fat at my glance.
My first target was design grid control as abstract as possible. As you can see, GridWnd class doesn't have any functionality by default (draws empty client rectange and doesn't respond user actions). But it has AddModel and AddView functions (for every sub-grids: Fixed, Left, Top and Client). These functions allow "connect" various cell's types to grid (for example we can add selection feature by adding ModelSelection and ViewSelection instancies to the ClientGrid). So every grid "system feature" like selection, columns/rows resizing or sorting and all user defined "customizations" like text cells, checkboxes, colors and many other are implemented by one way using MVC. One profit is that I need implement only one method of customization, debug it while implementing "standard" customizations. And user can easily add it's own customizations by defining triad: Model - get/set paticular data from/to cell, View - draw Model's data and optionaly Controller - edit Model's data.
As I said I tried to design grid as abstract as possible but it's useless in real applications. So I suggest GridWndDecorator class which wraps GridWnd and customized it with most frequent features: selection, sorting, grid captions and other. I think every user should implement it's own GridWndDecorator class and add there features that he/she thinks the most frequent used in his/her applications. Or just use my implementation. I don't think the union of all possible grid features is a good solution. User should take grid engine (GridWnd) and add custom blocks he need, no more no less.
Sorry, it seems my message is a liitle bit messy. Please ask me if something unclear here.
P.S. I agree I need an article describing CppGrid but I think I will do it later, when project becomes more or less stable and usable. I will do some kind of promoution then :o)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, Alex:
Firstly I think the Grid should looks like a grid, for example thick / thin /no frame in the border. your grid is not like the traditional grid. for example select column interface is not like we use excel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Jianjun,
thank you for your reply. I think my ideas intended in this project will be more clear if I give a lot of examples. But I have no time for this now. I hope on holidays or after I will do it. Let's now discuss exact questions and problems regards this project.
1.
Firstly I think the Grid should looks like a grid
- please tell me which things different in CppGrid against
Grid
?
2.
for example thick / thin /no frame in the border
- do you mean border around the whole grid control (like WS_EX_CLIENTEDGE, WS_EX_STATICEDGE and similar) or something else?
3.
for example select column interface is not like we use excel
- what kind of interface do you mean? GUI or API? :o)
GUI - in excel user can select columns by clicking on the header (or dragging mouse on the header), in CppGrid you also can click or drag mouse over top "fixed" cells (which in gray color).
API - I don't exactly remember in excel it's like "Range("<text representation of selection>").Select", in CppGrid you should get Selection model from decorator and call AddSelection(make_shared<RangeColumn>(2), false, true). I agree we should have simpler function like SetSelection(make_shared<RangeColumn>(2)) and I will try to add some simple functions which will recall ore complex function with predefined parameters. But now it's enough AddSelection for most cases.
As I can see you always talk about
traditional
grid control but different users require different grids. The main idea of the project was separate customizations and core grid functions. GridWnd class is
grid engine
, it's billet, it can be customized in dozen different kinds of grid. But of couse it's useless for end user. So should be dozen of different GridWndDecorator classes which customizes GridWnd class for concrete using. If you tell me how you want use CppGrid I will do such decorator class.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
have a look at http://www.codeproject.com/KB/miscctrl/DataGridControl.aspx
Hello,
what kind of polishing do you mean? One of the reason of this project - avoid such monolithic interface like in reference you mention. I don't like "monster" classes all in one box.
If you prefer see set of methods like SetCellText/SetCellColor/SetCellTextAlign and so on - CppGrid is not such control. I;ve used similar control before - CGridCtrl (http://www.codeproject.com/KB/miscctrl/gridctrl.aspx). This is non optimal by speed and memory and difficult customizable control. It stores all possible cell's data for every cell. The customization is just add one more field to the cell record and scan all the code to insert code sections to draw and manipulate this new data.
Here is another solution - grid control functionality decomposed into several classes. Also it's supports Model/View/Controller pattern which used in many other grid implementation in serious GUI libraries like Qt(http://doc.qt.nokia.com/4.7/qtablewidget.html#details) or GTK++(http://library.gnome.org/devel/gtk/unstable/TreeWidget.html). But they are also too fat at my glance.
My first target was design grid control as abstract as possible. As you can see, GridWnd class doesn't have any functionality by default (draws empty client rectange and doesn't respond user actions). But it has AddModel and AddView functions (for every sub-grids: Fixed, Left, Top and Client). These functions allow "connect" various cell's types to grid (for example we can add selection feature by adding ModelSelection and ViewSelection instancies to the ClientGrid). So every grid "system feature" like selection, columns/rows resizing or sorting and all user defined "customizations" like text cells, checkboxes, colors and many other are implemented by one way using MVC. One profit is that I need implement only one method of customization, debug it while implementing "standard" customizations. And user can easily add it's own customizations by defining triad: Model - get/set paticular data from/to cell, View - draw Model's data and optionaly Controller - edit Model's data.
As I said I tried to design grid as abstract as possible but it's useless in real applications. So I suggest GridWndDecorator class which wraps GridWnd and customized it with most frequent features: selection, sorting, grid captions and other. I think every user should implement it's own GridWndDecorator class and add there features that he/she thinks the most frequent used in his/her applications. Or just use my implementation. I don't think the union of all possible grid features is a good solution. User should take grid engine (GridWnd) and add custom blocks he need, no more no less.
Sorry, it seems my message is a liitle bit messy. Please ask me if something unclear here.
P.S. I agree I need an article describing CppGrid but I think I will do it later, when project becomes more or less stable and usable. I will do some kind of promoution then :o)
Hi, Alex:
Firstly I think the Grid should looks like a grid, for example thick / thin /no frame in the border. your grid is not like the traditional grid. for example select column interface is not like we use excel.
Hi Jianjun,
thank you for your reply. I think my ideas intended in this project will be more clear if I give a lot of examples. But I have no time for this now. I hope on holidays or after I will do it. Let's now discuss exact questions and problems regards this project.
1.
- please tell me which things different in CppGrid against
?
2.
- do you mean border around the whole grid control (like WS_EX_CLIENTEDGE, WS_EX_STATICEDGE and similar) or something else?
3.
- what kind of interface do you mean? GUI or API? :o)
GUI - in excel user can select columns by clicking on the header (or dragging mouse on the header), in CppGrid you also can click or drag mouse over top "fixed" cells (which in gray color).
API - I don't exactly remember in excel it's like "Range("<text representation of selection>").Select", in CppGrid you should get Selection model from decorator and call AddSelection(make_shared<RangeColumn>(2), false, true). I agree we should have simpler function like SetSelection(make_shared<RangeColumn>(2)) and I will try to add some simple functions which will recall ore complex function with predefined parameters. But now it's enough AddSelection for most cases.
As I can see you always talk about
grid control but different users require different grids. The main idea of the project was separate customizations and core grid functions. GridWnd class is
, it's billet, it can be customized in dozen different kinds of grid. But of couse it's useless for end user. So should be dozen of different GridWndDecorator classes which customizes GridWnd class for concrete using. If you tell me how you want use CppGrid I will do such decorator class.