Ultimate Canvas Gadget Library

Everything else that doesn't fall into one of the other PB categories.
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Ultimate Canvas Gadget Library

Post by Derren »

I've noticed that there are many great Gadgets being built with the Canvas Gadget.

One problem many might have is that they all come from different authors and use different "call conventions". Some use BindEvent() and others don't, because they're too old, thus require the end-user to put bits of code into the Eventloop. Some create their Gadgets with "CreateCustomGadget" and have Procedures like "GetCustomGadgetWidth", others use Modules, others use a ton of Api (Windows or other).

How about: Coming up with some form of "convention" that existing gadgets can be adapted to, and new ones can plan to use.
Purpose? A uniform code if you were to use two or more custom Gadgets at the same time.
Shared resources: custom Gadget list and general functions like GadgetWidth() for ALL custom Gadgets. Shared methods that anyone can and should use in their library like GetWindowColor() and GetStandardFont().

What do you think :?:
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 536
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Ultimate Canvas Gadget Library

Post by BasicallyPure »

Derren wrote:What do you think
I think having access to a community library of custom gadgets would be a very useful resource.
A list of 'preferred conventions' would definitely be worthwhile I would think.
Emulating the behavior if existing PB gadgets as much as possible should be a goal.

I would suggest a new section on this forum where custom gadgets could be submitted for pier review.
After any issues have been resolved they could be submitted for inclusion to the 'official' custom gadget library.
Perhaps voted on by forum members in general or a select team of experienced PB users.
Possibly the PB developers themselves might have the final say.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Ultimate Canvas Gadget Library

Post by Little John »

@BasicallyPure:
I absolutely agree with what you write.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Ultimate Canvas Gadget Library

Post by davido »

Great suggestions, so...
+ 1
DE AA EB
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Ultimate Canvas Gadget Library

Post by Andre »

I agree too. Good idea :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Ultimate Canvas Gadget Library

Post by Zebuddi123 »

@BasicallyPure succinctly put !!!
Zebuddi. :)
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Ultimate Canvas Gadget Library

Post by Keya »

+1! and if nothing else it would also help FIND the little gems amongst all the other threads :D right now it's not easy without the right keywords... and even then!
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Ultimate Canvas Gadget Library

Post by TI-994A »

A compilation section would be a far more possible and welcome addition.

But expecting conformity for voluntary contributions is a little unrealistic, and might even put many off from sharing their ideas.

We're just lucky to even have such contributions in the first place, from the generous few that shares them with us.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Ultimate Canvas Gadget Library

Post by captain_skank »

+1 Gets my vote.

Perhaps the ultimate aim should be to make a standard library - that is not OS specific but PB specific.

I'd be interested in seeing a common approach to this - cos a lot of my own gadgets seem to fly in the face of any convention - even my own :)
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Ultimate Canvas Gadget Library

Post by Derren »

TI-994A wrote:A compilation section would be a far more possible and welcome addition.

But expecting conformity for voluntary contributions is a little unrealistic, and might even put many off from sharing their ideas.

We're just lucky to even have such contributions in the first place, from the generous few that shares them with us.

"Rules" could also provide guiding. For example, I have heard of BindEvent, but never really used it for months. Only after I saw somebody else's code and wonderered why on earth there's no "catch_and_forward_events()" function call in the event loop, I realized that it's much cleaner to use BindEvent.
I much prefer the version where I don't have to add code to the event loop. It's not necessary for PB-Gadgets and thanks to BindEvent, it's no longer necessary for Canvas-based Gadgets.

I certainly don't want to discourage anyone from sharing their ideas. But if the whole forum, all of you experts join in on setting up some rules, I think it would be very beneficial.

Also, as I mentioned above, there are many great codes that can help. A collection of those would also be beneficial. Especially if those helper functions are already treated like a library.
This prevents having 20 helper functions for 3 gadgets, instead of just 10 uniform functions.

I'm sure if you just finished a project, you don't want to change your code conform to anything. At least not right now.
But soun rules and tutorials for basic steps (like Event handling) could actually encourage people to try it out. People who have never used a Canvas Gadget but surely have the wits to create awesome gadgets with it.
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: Ultimate Canvas Gadget Library

Post by HanPBF »

Great idea!

Who manages the API?

Is it possible for the PB team to first release an API for a new canvas based gadget as idea?
Or review a given API at least and confirm no future naming problems?


The mentioned rules for an API are easy as is PureBasic.
Only one must decide: is it WindowMouseX or getWindowMouseX or [get]WindowMouse(#PB_X)?
Canvas based button could be "buttonCanvasGadget" or "buttonControl" or "buttonWidget".

I did not talk about modules, because I don't like them;-)
For a new standard canvas gadget library it should be possible to define new procedures without name clash.

Regards
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Ultimate Canvas Gadget Library

Post by Derren »

Looking through my old posts, found this.
Seemed to resonate with at least a few people including Andre. :wink:
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 664
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Ultimate Canvas Gadget Library

Post by Kurzer »

Hi Derren, I have just discovered the thread and find the suggestion great.

Presumably, the easiest way to do this is to provide a template gadget as source code for everyone involved and also for the compliance of the code. This template should have been examined beforehand for a common consensus.

This also has the advantage that a CustomGadget programmer no longer has to deal with the framework, but can program its specific procedures, because the framework is already in place. Anyway, I am a great advocate of templates and I use them myself, so that I don't have to reinvent the wheel every time.

However, I think that first a moderator of the forum has to be active in order to set up a corresponding area for CustomGadgets in this forum. In the meantime the others can discuss what kind of program style to agree on ;-)

Personally, I am in favour of binding event and modules. And, depending on the type of gadget, one need standard functions for init (), release () and the query/update of data structures during use of the gadget, which cannot be mapped by a single event. For example, I'm thinking of an audio equalizer that may contain 10 or 20 sliders or knobs. Of course, you can deliver an event called "Something has been changed" and the user will have to query all the controls individually, but maybe this can be solved more elegantly.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2023: 56y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 664
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Ultimate Canvas Gadget Library

Post by Kurzer »

Too bad, I think the idea is really good, but the thread will probably disappear within a short time.

Unfortunately, I still haven't become an expert on ownerdrawn gadgets, so I can't contribute anything worthy of a smart template.

In forums, such things also disappears quite quickly between the other posts. It would be desirable if there were an official and moderated STL (standard template library for gadgets and functions) for PureBasic, which can be reached directly on the PureBasic website. Something like the building blocks within the PureBasic IDE, but extending globally across all users.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2023: 56y
"Happiness is a pet." | "Never run a changing system!"
User avatar
mk-soft
Always Here
Always Here
Posts: 5334
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ultimate Canvas Gadget Library

Post by mk-soft »

I like modules for CustomGadgets (CanvasGadgets).
There have also been written some modules which are very good.
Take Thorsten's, for example.
Link: http://www.purebasic.fr/english/viewtop ... =toolbarex

Or as modules with interface (OOP)
Link: http://www.purebasic.fr/german/viewtopi ... olorGadget

You should create a thread' CustomGadget' with references to the modules.

One only has to agree on basic rules for the standard functions.


Translated with http://www.DeepL.com/Translator
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply