New controls with Gtk ideas

Custom dropdown list detailFor my current job in ePortal I’ve been designing some new controls that mostly add features not present in the HTML native ones. One such features is the ability to add an icon (or something else like a checkbox) to a dropdown list (combobox).

How do we solve this? By implementing it using HTML, but there are some problems when doing this:

  1. You lose the native look & fell, but you win themable support to your control
  2. You must implement each and every piece of logic in javascript and css, which is good but you can’t really emulate some behaviors, and you end up with long scripts that are easy to break
  3. Assuming I didn’t gave you the tip in the title, or that you never used a Gtk List/tree control, one would be limited to a single icon-text combination, any variation would end up beeing either another control or just a set of properties, anyway, that would mean feature-limited controls (and we have lots of those in the market right now)

So, what I tough was that it could be nice to be able to add any type of controls in any order to the list items, just like Gtk does with its CellRenderers. This has proven to be a very nice tecnique and it is working pretty well right now, just need to fix some css problems (when inserted in a table cell with limited width the button will wrap to a second line instead of ajusting the textbox/label as desired… any tip on this?) and it is already submitting values. The problem is that this particular area where I’m using this control to do some Color Pickers, Border Style and Width pickers, Calendar Pickers, etc… do not use postback (it is using pure Ajax right now), so I need to implement this when I’ve some free time.

There is another thing I’ll add, something I love about Gtk list items, you can add a “direct” reference to one or more objects, this way, you can say that the list item “Red” is associated with a “System.Drawing.Color.Red” object instead of parsing the list and search for the right object each time the users selects another item. Of course, as in Gtk, this value isn’t actually renderend, you can add as many Renderable/Non-Renderable items as you wish… cool isn’t it?

With this tecnique I’ll be solving a lot of problems developers hate, but there will be an obstacle, since .Net objects aren’t in the client browser I need a way to keep the ViewState that keeps the association between the renderable (which will be transformed in HTML) and the non-renderable objects. The last ones don’t need to be sent to the browser, but the server must keep track of them. Either I store them in the Session or I serialize them and send them to the HTML side… I prefer the first but either will have some trade offs… need to find an intelligent solution to this.

There are more ideas about more Gtk-ASP.Net controls but I’ll post something when I’ve some time and more details :)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

5 Responses to “New controls with Gtk ideas”

  1. anonymono says:

    There is an example of
    icons-embedded listbox in

  2. alexmipego says:

    Sure, what about a checkbox in
    there? Using the Background style property is a one-end hack, it only will work with Images and, as I speak in my post, this tecnique objective is to provide a custom way of adding anything in the
    list items and not just an Image.

  3. anonymono says:

    great work man!!! but…are u shure you’re not
    trying to reinvent the wheel? there’s dozens of examples of dropdownlists like those!!!
    check these out:

Leave a Reply

For spam filtering purposes, please copy the number 9794 to the field below: