Archive for February, 2009
DateEntry pre-rambling
by matooo on Feb.24, 2009, under gtk-databind
DateEntry as it is now in my personal branch:

3 clickable parts (Calculator, Clear and Picker) and one editable part. Every widget part should be able to activate with keyboard.
Press ‘+’ or ‘-’ and calculator pops up. Calculator is nothing but a simple SpinButton

Now with calculator you either control Spin with up and down or simply enter number by keyboard. Result on parent widget should be alive as calculator needs to handle both Esc and Enter. Press Esc and parent widget reverts back to what it was or press Enter and apply calculation.
Clear is a bit trickier. The biggest mistake every widget does is that it clears data. Not that it is always stupid, but in case of date? Yes, it is. DateEntry invokes ClearData event. By default it means revert to today. But what if you want to handle something like Due pay. By default, clear data would either mean setting it to the same date as the bill or (bill date + customers default due pay time).
This is a lot related to editing. DateEntry doesn’t have cursor (for its editing it uses Label not entry). Always selects complete part you’re editing. For example if you edit day and enter 4? There in no double digit day starting with 4. So it simply skips to next part, but if separator is pressed after this widget ignores it as it was already handled. Same goes with month the only double digit months are starting with 1, anything else skips to next part. But year is a little different. Its prediction has to be good enough when widget exits. Enter 0-9? obvious 2000, but only now, when we will be 2010? 0 will have to mean 2010 not 2000. 1 on the other hand is a bit trickier (if we’re entering this on december 2010? yes it should predict 2011… well this prediction is one of the things I’m still working on). And so on prediction should select most sensible year. Keys Left and right simply walk between day, month and year.
And last one thing? Picker, yes the only viable use for default gtk date selector.
Ok, so why all this? Simply because now CellRenderer to edit date is possible. And good CellRenderer classes are the only thing that separate people from having DataGrid.
Well, there is another annoying thing. The only widget that specifies Editable is Entry. All others only have Sensitive, but… wtf? Sensitive makes it disabled according to theme and mostly makes widgets unreadable. Every Widget should have editable not only one. Same as ClearData event. Another example for ClearData. Financial entry specifying cost of item? You calculate it differently, but then decide you’d go with original price… press Del and instead of setting it to zero? invoke a lookup in inventory and set default price or default price with calculated customers default prices? There is a little lesson. Some widget just don’t need Insert editing mode and some should control it by default for most sensible use. But if you want to go level above normal stupidity, the only way is to go with more sensible data editing.
Lack of posts
by matooo on Feb.22, 2009, under gtk-databind
No, it isn’t dead. I just went into custom widget prototyping and searching for perfect interaction with some really needed widgets.
Most notable example… How the hell can you use Date Widget in GTK in some financial application. Takes whole lot of space. Works awful with keyboard, not to mention entering the date manually is impossible. Same for financial numbers, etc…
It will also be the nicest explanation why converters and validators are deprecated in my opinion.
That will be part of the next upload in svn. As soon as I fix problem or two. Next blog post will feature DateEditor Widget, its use and a little screencast to go with it.
This is one of long overdue needs to create really cool DataGrids and such. Widgets which is usable to enter date in CellRenderer, but with more than perfect layout, control and features. Working nice with mouse and keyboard. And as long as I talk about usability, there will be a bit of brainstorming on my part why some things should be completely rethinked and redone to make applications perfect for users by default.
And please… if you respond to this… FFS, DON’T EVEN MENTION MASKEDEDIT!!!!! It is most horrible widget ever. Allowing you to solve something, but whenever you solve that with using it, solution is less worth than most crippled solution. MASKEDEDIT IS THE MOST HORRIBLE IDEA EVER!