Canvas-Based Gadgets

BlitzMax Forums/MaxGUI Module/Canvas-Based Gadgets

Ked(Posted 2008) [#1]
How many people dislike using canvas-based gadgets? Are there any bad things about using them?


SebHoll(Posted 2008) [#2]
How many people dislike using canvas-based gadgets?

I do! In my experience...

> They never seem to fit in properly with the rest of the gadgets.
> They require a graphics engine to be imported, whether it be OpenGL or Max2D.
> It increases the minimum system specs of your program.
> They are usually quite slow.
> They tend to be very buggy.


Brucey(Posted 2008) [#3]
If you insist on making custom gadgets, GDI is a good place to start.


CS_TBL(Posted 2008) [#4]
> They never seem to fit in properly with the rest of the gadgets.

Matter of design, if you read out the OS colors and use them, you should be fine. In other situations it doesn't matter much.

> They are usually quite slow.

Then they're coded badly.

> They tend to be very buggy.

Then they're coded badly.

For some controllers or things you simply need custom gadgets. Heck, even a native slider isn't perfect, so I'd prefer something custom for that. When someone is making a creative tool, big chance that that person needs something custom.


SebHoll(Posted 2008) [#5]
Matter of design, if you read out the OS colors and use them, you should be fine. In other situations it doesn't matter much.

Which is messy as far as maintaining cross-platform integrity is concerned. Also, even if you are programming for Windows only and decide to use GetSysColor(), it will only get you so far as Windows controls are now drawn by the theme engine, with textured background for buttons etc. The only way that you can access this is through more API commands, and by passing in a drawing context (hdc). It isn't really a "canvas" based gadget, anymore, is it?

> They are usually quite slow.

Then they're coded badly.

It's not necessarily that they are coded badly, but they have to use drawing procedures that aren't optimized for this purpose. OS control drawing is heavily optimized, for example, most Windows controls retrieve update regions, and clip drawing to them to improve painting times.

> They tend to be very buggy.

Then they're coded badly.

That goes without saying. ;-) Although, it's not necessarily because of lazy programmers! Canvas gadgets usually can't behave exactly the same as similar OS controls, and tend to miss out expected functionality in the OS (e.g. tabbing through controls to change focus).

Ultimately, canvas based gadgets have their uses (for drawing controls that don't pretend to act or behave like similar standard windows controls), but you should never pretend that they are anything similar to the native controls.


CS_TBL(Posted 2008) [#6]
The tricky bit is in that last line of yours.. when is something becoming native? Esp. native as in 'supported by MaxGUI out of the box'. I like advanced/rich controls, whereas native OS controls are usually quite simple.

Check this one for instance:

http://www.blitzmax.com/Community/posts.php?topic=68626

Very flexible, it can look like anything, numbers, text, images, you name it. It's a canvas object, it's not present in native MaxGUI, and I bet it's not a standard widget either. Is it decent or not?