Jump to content
Sting

Table Widget

Recommended Posts

Sting   

Table.7.27.jpg

I want to enter my table widget into the competition.  It is shown here with no scroll bars, but they are available when there are more items then the table can hold.  The widget at the top is a label widget, it just happened to be in the image I took.  It could be optionally added to the widget, it might be before the competition ends.  I have a post in the User Projects forum if you want to know about the features at this point, but I do have over 2 weeks to make even better.  It already is more feature rich then that post :) 

Share this post


Link to post
Share on other sites
Sting   

Here is a new image, I tried to create an mp4 from my phone to show it working but the file is about 15MB and figured it was too big.

I am not finished yet, I wish I was, and I am going away for a week and a half returning the 12th.  This won't leave me much time to finish, maybe I have to leave off some additional features I want to add :(.

The state of the widget is:

A title is not included though the implementation allows for it.  This could be added with a switch GWIN_TABLE_USE_TITLE and would include 2 functions.

gwinTableSetTitle(gh, char*);
gwinTableSetTitleBackground(gh, color_t);

// Available when the implementor sets GWIN_TABLE_NEED_TITLE
// It should probably allow the title to be justified in left, center, or right
// This isn't done yet.

The header is drawn in Gray and a new api needs to be added to set the header background.

gwinTableSetHeaderBackground(hd, color_t);  

//Available when the implementor sets GWIN_USE_TABLE_HEADER.

This will be straight forward and maybe I will do it in the morning before I leave.  This isn't the correct way to do it, as the list widget and the next widget, the Grid Widget have the same issue and a new style needs to be built to allow a consistent way to change the header, row background, and row even/odd background colors.  I'll put it on the list.

The current implementation doesn't provide a mechanism to replace the row text or column text.  I am not that concerned about total row replacement but want to do column replacement.  Maybe next release.

The header cannot be replaced, the current implementation assumes it will be done once.  This is straight forward but isn't done.

Images of any size up to the font height can be used, larger ones will be used but will be truncated.

The important part is that replacing the image only repaints the image, there is absolutely no flicker.  Also, when a selection is made, only the past selection and the current selection are repainted.

Ellipses are implemented but are not an option yet.  There is a gfxAlloc/gfxFree used in the implementation and some code so I figured a user might want a faster smaller version so will add GWIN_TABLE_NEED_ELLIPSE sometime soon.

This image uses 24 point font and includes ellipses.  The label above the table is not part of the table but probably should be.  It's size is not coordinated with the table size.  This application uses the same images as for the U12 font.  The application uses a timer to change the image in the front of each consecutive row every second.  The video would show this.  It would also show there is no flicker when the image is replaced.

 Taqble.8.3.jpg

Share this post


Link to post
Share on other sites

Great work, this seems to proceed quite well! I really can't wait to try it! :)

Regarding the header color: In general adding new colors to the widget styles wouldn't be a huge problem as they usually end up in ROM/flash which is a lot less critical than RAM. The only reason why we wouldn't add specific stuff like this is because other widgets wouldn't have any use for it. If it makes sense to add a secondary fill color or something like that we are very open for any kind of discussion.

Also, the end of the competition doesn't mean that it's the end of your widget development ;) 

Share this post


Link to post
Share on other sites
Sting   

I just got home and put together what I have working now.  It run's on uGFX 2.5 and will spend some time today to see if I can get 2.6 working.  If I forgot anything let me know.  I do realize it doesn't qualify for the competition and will see if I can make that happen soon.  I doubt it will be an issue with the widget, but will be an issue to weather I can get 2.6 working at all on my system.

ugfxtable.tar.gz

Share this post


Link to post
Share on other sites

I haven't looked at your widget yet, I will give it a look tonight or tomorrow morning.

If it is working with µGFX 2.5 then it will work with µGFX 2.6 for 100% sure. There are only bug fixes and new features from 2.5 to 2.6. Nothing has changed. Unless we added new bugs that is :P 

Share this post


Link to post
Share on other sites
Sting   

I just added the setTitle() and setTitleBackground() api and did a major rework of the drawing routines, to not do all of the math to calculate y positions constantly through the code.  The title is center justified and I am thinking of adding the api to setTitleJustification() to justify left, center, or right.  I have to still do some testing, but it is way better then before.  

I'm not sure if I understand all of the issues with embedded development.  If there are things you would rather see done differently I would really appreciate the learning experience.  I will resubmit it early next week.

Share this post


Link to post
Share on other sites
inmarket   

With embedded development, other than real time issues which are not relevant for a gui, there is really one overriding design criterea... keep things small.

The most critical resource on most embedded boards is (in order) RAM, followed by ROM, followed by cpu speed. As RAM is the most critical of these we spend a lot of time optimising RAM (which includes stack usage). We will often sacrifice code size (ROM) or rendering speed in order to save a few bytes if RAM.

The next most critical resource is ROM. In any gui there is a temptation to add lots of features. Those features take code space and therefore reduce the available ROM and therefore reduce the applications maximum complexity. So, features are added only if essential to the operation of the control. For example, ugfx does not handle overlapping windows well except in a strict parent/child relationship. This is to save RAM and to save significant code space. This is worthwhile as overlapping windows has little benefit in a largely static application. It is not a user desktop situation where the dynamic creation and moving of windows is critical. One major tool we have in keeping code size down is ugfx's use of conditional compilation to only turn on needed features.

The last major consideration is cpu speed. While embedded cpus are getting faster and faster the more efficiently you can code something the higher the apparent speed and the lower the power consumption.

For ugfx, while we often develop on high powered desktops or high speed embedded devices, in the real world manufacturing cost, power consumption and other factors mean that the end device is often very low powered. As the ugfx library is built to support all these configurations these factors are critical in ensuring that ugfx does not outgrow the very environment it was designed for. A prime example of that is Linux itself. It started out as being able to run on machines with as little as 1M ram. These days it would struggle to run in less than 256M.

Ugfx currently runs on 8 bit micro's  (although slowly), in as little as 1k RAM (although with very limited functionality) and with as little as 2k ROM (again with limited functionality). In reality a decent minimum size for ugfx is a 16bit micro, 4k RAM and 10k ROM.

Share this post


Link to post
Share on other sites
Sting   

I am still working on the scrolling with/without title, with/without header, and making the geometry calculations more clear.  I am also working to be sure that I make the footprint better with inmarket's previous post.  I will be done by the end of the weekend, with lots of comments showing the details of the calculations.

Share this post


Link to post
Share on other sites
Sting   

It is getting a little out of control.  I need to stop to work on some of my own components. I have implemented the following:

...SetTitle()
...SetTitleBackgroundColor()
...SetTtileFont()
...SetTitleJustify()

...SetHeader()
...SetHeaderBackgroundColor()

Keeping track of the specific geometry is not difficult, but is tedious with all of the options and not storing intermediate state information.  If I could do it at work I could be done by now :)

Share this post


Link to post
Share on other sites
Sting   

I am really making progress, I have to admit this is more complicated then the first project someone should pick for their first project on a new platform.  I have most functionality tested.

Test Matrix:  I tested with the following set of features

                                1       2       3       4       5       6       7       8*
Need Image                      No      No      No      No      No     Yes     Yes     Yes
Need Image Gif                  No      No      No      No      No     Yes     Yes     Yes
Need Table Images               No      No      No      No      No      No     Yes     Yes
Need Table Embellishment       Yes      No      No      No      No      No      No      No
Need Table Header              Yes     Yes      No      No      Yes    Yes     Yes     Yes
Need Table Title               Yes     Yes     Yes      No      No      No      No      No
Has Table Image                 No      No      No      No      No      No      No     Yes
Result                         Yes     Yes     Yes     Yes      Yes    Yes     Yes      NO

Test 8 has only a single row that has images and the problem is that the other rows don't 
paint the background where the image could go later correctly.

I have included an image of the table that has the following:

The title font is larger then the page font 
The title is right justified
The image is scrolled down one row

The image shows another issue where the header doesn't know that any rows have images.
I know the fix for this and will implement it either later today after the football match or tomorrow.

Table.8.28.jpg

Share this post


Link to post
Share on other sites

We are happy to hear that you are making good progress with your table widget. You definitely seem to put a lot of effort into it. Having a full test protocol is a very professional thing to do. Please keep it up and don't get discouraged, this is definitely not an easy job if you want to get it right!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×