I don't want double buffering.
First, I've got wxSQLite3Table as a result of execution of my SQL query.
Second, I need to copy all data from wxSQLite3Table to wxGrid.
Third, I need to destroy wxSQLite3Table.
Is it a correct way?
Thanks!
What is a correct way to fill wxGrid from wxSQLite3Table? Topic is solved
-
- Earned a small fee
- Posts: 12
- Joined: Sun Feb 07, 2016 10:13 am
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: What is a correct way to fill wxGrid from wxSQLite3Table?
You need to create your GridTable Class and associate it with your Grid. The Table class will do the data part and Grid will do the view part
See http://docs.wxwidgets.org/trunk/classwx ... _base.html
See http://docs.wxwidgets.org/trunk/classwx ... _base.html
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
-
- Earned a small fee
- Posts: 12
- Joined: Sun Feb 07, 2016 10:13 am
Re: What is a correct way to fill wxGrid from wxSQLite3Table?
Thanks! Will try to do it.evstevemd wrote:You need to create your GridTable Class
Now, I just can fill wxGrid from a table like this.
Code: Select all
try {
wxSQLite3Statement ls=db->PrepareStatement("SELECT id,name FROM table ORDER BY id");
wxSQLite3ResultSet lr=ls.ExecuteQuery();
int ln=lr.GetColumnCount();
grid_table->CreateGrid(0,ln);
int lrow=0;
while (lr.NextRow()){
grid_table->AppendRows(1);
for (int li=0;li<ln;li++) {
if (!lr.IsNull(li)) grid_table->SetCellValue(lrow,li,lr.GetString(li));
}
lrow++;
}
ls.Finalize();
} catch (int le) {
}
grid_table->SetRowLabelSize(0);