GridGadget

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

GridGadget

Post 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!

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

Image
Download (Windows): http://www10.zippyshare.com/v/19500970/file.html
User avatar
skywalk
Addict
Addict
Posts: 3995
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: GridGadget

Post by skywalk »

Very nice.
- Windows version crashes on extreme window resizing.

Are you using stringgadgets for the editing?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post by Polo »

What do you mean by extreme window resizing?

No string gadgets used, everything is a canvas plus two scrollbargadgets ;)
User avatar
skywalk
Addict
Addict
Posts: 3995
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: GridGadget

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: GridGadget

Post 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.
Last edited by TomS on Tue Jul 19, 2011 12:10 am, edited 1 time in total.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post 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!
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: GridGadget

Post by c4s »

This looks good! It's really nice to see what all of you suddenly come up with because of the new CanvasGadget(). :D
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post by Polo »

Ok the resize bug is not a big deal, math overflow like skywalk hinted! ;)
User avatar
idle
Always Here
Always Here
Posts: 5091
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GridGadget

Post by idle »

That looks great polo. It's great to see all these uses of the CanvasGadget coming out
Windows 11, Manjaro, Raspberry Pi OS
Image
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: GridGadget

Post 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 :D
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post 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 :P
User avatar
Kiffi
Addict
Addict
Posts: 1357
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: GridGadget

Post by Kiffi »

Great! Thanks a lot! :D

Greetings ... Kiffi
Hygge
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post by Polo »

Works great on OSX Lion as well: :)

Image
Zach
Addict
Addict
Posts: 1656
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: GridGadget

Post 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).
Image
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GridGadget

Post 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.
Post Reply