Moving id is forbidden
This commit is contained in:
parent
c71aa68bc7
commit
61885f57aa
20
source/app.d
20
source/app.d
@ -101,6 +101,19 @@ void main(string[] args)
|
|||||||
tree.setProperty("tooltip-column", 0);
|
tree.setProperty("tooltip-column", 0);
|
||||||
tree.setProperty("reorderable", true);
|
tree.setProperty("reorderable", true);
|
||||||
tree.setProperty("headers-clickable", true);
|
tree.setProperty("headers-clickable", true);
|
||||||
|
tree.addOnColumnsChanged((TreeView tree){
|
||||||
|
auto store = cast(ListStore)tree.getModel();
|
||||||
|
|
||||||
|
if(store.getColumnType(GetColumnStoreIndex(tree, 0)) != GType.INT){
|
||||||
|
writeln("Position 0 is forbidden");
|
||||||
|
foreach(i ; 0..store.getNColumns()){
|
||||||
|
if(store.getColumnType(GetColumnStoreIndex(tree, i))==GType.INT){
|
||||||
|
tree.moveColumnAfter(tree.getColumn(i), null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//Configure button callbacks
|
//Configure button callbacks
|
||||||
@ -221,6 +234,10 @@ void main(string[] args)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetColumnStoreIndex(TreeView tree, int colindex){
|
||||||
|
return cast(int)(tree.getColumn(colindex).getData("colnumber"));
|
||||||
|
}
|
||||||
|
|
||||||
void Save(ref TreeView tree){
|
void Save(ref TreeView tree){
|
||||||
auto store = cast(ListStore)tree.getModel();
|
auto store = cast(ListStore)tree.getModel();
|
||||||
if(store !is null){
|
if(store !is null){
|
||||||
@ -236,8 +253,7 @@ void Save(ref TreeView tree){
|
|||||||
do{
|
do{
|
||||||
file.write(store.getValueInt(it, 0));
|
file.write(store.getValueInt(it, 0));
|
||||||
foreach(i ; 1..store.getNColumns()){
|
foreach(i ; 1..store.getNColumns()){
|
||||||
int storecol = cast(int)(tree.getColumn(i).getData("colnumber"));
|
file.write("\t\"", store.getValueString(it, GetColumnStoreIndex(tree, i)), "\"");
|
||||||
file.write("\t\"", store.getValueString(it, storecol), "\"");
|
|
||||||
}
|
}
|
||||||
file.write("\n");
|
file.write("\n");
|
||||||
}while(store.iterNext(it));
|
}while(store.iterNext(it));
|
||||||
|
Loading…
Reference in New Issue
Block a user