Page 1 of 5
GridGadget
Posted: Mon Jul 18, 2011 5:23 pm
by Polo
Here's my attempt at building a grid gadget using the new canvas gadget.
It works on MacOSX and Windows - and should work without too much modifications on Linux, I just can't be bothered...
The MacOSX version showcases some of the CanvasGadget limitation/bugs on this platform (mouse events not reported when outside the canvas, plus the returned character which is wrong, it's fixed well on Windows, and almost fixed on MacOS - though you can't write accentued characters on the MacOS version).
It's not really optimised as well, mouse selection might be slow when the window is maximised.
This aside, I tried to recreate some of the Excel behaviour, you can do multiple selections, cell editing (except on A1 which is a locked cell), basic copy and paste works with Control(Command) C/V, text formatting (fully working, though this example might show some unexpected results as I didn't took much time in doing it).
Tell me what you think of it!

Download (Mac) (zipped .app):
http://www10.zippyshare.com/v/84742793/file.html

Download (Windows):
http://www10.zippyshare.com/v/19500970/file.html
Re: GridGadget
Posted: Mon Jul 18, 2011 7:11 pm
by skywalk
Very nice.
- Windows version crashes on extreme window resizing.
Are you using stringgadgets for the editing?
Re: GridGadget
Posted: Mon Jul 18, 2011 11:15 pm
by Polo
What do you mean by extreme window resizing?
No string gadgets used, everything is a canvas plus two scrollbargadgets

Re: GridGadget
Posted: Tue Jul 19, 2011 12:01 am
by skywalk
On XP Pro sp3, the app crashes if I resize the window too small and then try to make it larger again.
Probably a math overflow or something.
Cool, you are drawing all the grid elements without a listview or listicon gadget?
Re: GridGadget
Posted: Tue Jul 19, 2011 12:08 am
by TomS
skywalk wrote:...the app crashes if I resize the window too small and then try to make it larger again.
Confirmed. Windows 7 Home Premium 32
The error occurs when you resize the height. There's probably a division by zero (when the top CanvasGadget height is 0)
Otherwise nice looking gadget.
Re: GridGadget
Posted: Tue Jul 19, 2011 12:10 am
by Polo
Yeah, I'm drawing everything, as it's the easiest way to have it crossplaftorm, and as i wanted to control the text color, size, etc it was better doing it all by myself
I'll look into the resizing bug tomorrow, thanks for testing!
Re: GridGadget
Posted: Tue Jul 19, 2011 8:50 am
by c4s
This looks good! It's really nice to see what all of you suddenly come up with because of the new CanvasGadget().

Re: GridGadget
Posted: Tue Jul 19, 2011 11:38 am
by Polo
Ok the resize bug is not a big deal, math overflow like skywalk hinted!

Re: GridGadget
Posted: Tue Jul 19, 2011 6:04 pm
by idle
That looks great polo. It's great to see all these uses of the CanvasGadget coming out
Re: GridGadget
Posted: Wed Jul 20, 2011 4:55 am
by jesperbrannmark
OMG!
All of these new gadgets are just fantastic. This is something I've really been longing for. I would like to add custom color/background images, icons and more mouseactions... will see if someone beats me to it (three weeks on "vacation" in Hong Kong, so I will try not to work...)
Nice work

Re: GridGadget
Posted: Wed Jul 20, 2011 11:14 am
by Polo
Text color and cell background color can be customised, it's not shown on this example

I'm not sure what I am going to add it next... I was thinking about dropdown cells, or a charting system

Re: GridGadget
Posted: Thu Jul 21, 2011 11:24 am
by Kiffi
Great! Thanks a lot!
Greetings ... Kiffi
Re: GridGadget
Posted: Thu Jul 21, 2011 10:05 pm
by Polo
Works great on OSX Lion as well:

Re: GridGadget
Posted: Mon Aug 15, 2011 3:56 pm
by Zach
This totally makes me want to play with the Canvas gadget..
I've always wanted to try making my own controls, but I figured it would be too hard...
Just curious, did you have to write your own routines to support typing in characters, and copy/paste, etc functions.. Its very fast either way, I always figured if I tried I would end up with some slow monster of a GUI (and I have no idea how to add all the typical functions controls have).
Re: GridGadget
Posted: Mon Aug 15, 2011 4:56 pm
by Polo
Zach wrote:Just curious, did you have to write your own routines to support typing in characters, and copy/paste, etc functions.. Its very fast either way, I always figured if I tried I would end up with some slow monster of a GUI (and I have no idea how to add all the typical functions controls have).
Yes it's my own routines for typing characters and most of the functions, only the scrollbars are PB's scrollbar (and Carbon scrollbars on OSX).
I kinda stopped working on my grid gadget though, I'll wait until the Canvas Gadget bugs are fixed.