Re: EuGTK:Sorting Column of Floats

new topic     » goto parent     » topic index » view thread      » older message » newer message

OK, I've got the custom sort working. It's not much different from Euphoria's custom sort in operation.

At this point, I need to know more about the actual data you're using to be of much more help. You may also need an update to GtkEngine.e. Briefly, however, you set the sort column id for the Price column to -1. That means "use custom sorting".

col3 = create(GtkColumn, 
   "name=col3,title=Price,type=text,text=3,sort=-1,xalign=1") 
 
constant sorted = create(GtkTreeModelSort,store)   
-- store is where you loaded the raw data; 
-- sorted holds no data, just tracks the sorting... 
 
set(tv,"model",sorted)  
-- use the sorted model to fill your tree model. 
-- the sorted model "ghosts" the real data and keeps it 
-- sorted based on your custom routines. 
 
connect(col3,"clicked","ToggleSortDir")  
-- the above call toggles the sort direction, and calls the custom  
-- sort functions, which are entirely dependent upon the structure 
-- of the data, no point in trying to guess that! 
 

Prices in the input data are atoms. Not quoted.

I specify the Price column as gSTR, so that numbers are automatically formatted with 2 decimal places. The custom routines need to convert the 2 values they compare into atoms for a proper comparison. This is easy and much faster than trying to format all numbers "on the fly".

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu