Gauge widget

Moderators: LCMark, LCfraser

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Gauge widget

Post by bn » Fri Jun 09, 2017 10:53 am

I recreated a control that I once did in Livecode Script. Now as Livecode Builder widget.

It is a Gauge
small.png
small.png (31.2 KiB) Viewed 1227 times
wide.png
wide.png (40.22 KiB) Viewed 1227 times
I post here the .LCB file which is the source code. You would have to put that file into a folder and then use the Extension Builder from the Tools Menu and point the Extension Builder with the folder icon in the topRight corner to the .lcb file. Then "Test"

In your folder where you placed the .lcb file you will find a file api.doc after testing i.e. compiling. The api.doc file is a text file that contains the documentation of the API. Please read that file for the options.
Tested in LC 8.1.3, 8.1.4 and LC 9 DP6.

Use also the properties inspector to explore options, see also the colors section of the Properties Inspector to change "needle" color.

You can manually interact with the gauge (default) by moving the needle.

Compared to the Livecode Script version the widget is a lot more precise and stable due to the subpixel positioning of elements.


So here it goes....

Kind regards
Bernd

EDIT

NEW VERSION

last update June 11 version 0.3.0
gauge_0_3_0.lcb.zip
(6.5 KiB) Downloaded 46 times
Last edited by bn on Sun Jun 11, 2017 10:37 am, edited 3 times in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Gauge widget

Post by Dixie » Fri Jun 09, 2017 11:13 am

Bernd... :-)

What a nice piece of work... I can see that I am going to have to spend some time with LCB...

dixie

bogs
Posts: 480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Gauge widget

Post by bogs » Fri Jun 09, 2017 1:28 pm

Very nice looking Bernd !

I do have a question about things like this, not your gauge specifically, just in general.

What is the advantage if any in doing a conversion like this, or is this just a demo with no real benefit going one way or the other? Having seen (and used) some of your toys, I really appreciate the time and thought put into them, and know how well they work, so your opinion carries a lot of weight for me, coming in new as it were.
ImageImage

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Gauge widget

Post by bn » Fri Jun 09, 2017 2:25 pm

@Dixie thanks

@ Bogs
What is the advantage if any in doing a conversion like this, or is this just a demo with no real benefit going one way or the other?
To me in a widget you have a lot more control over the geometry of the elements that make up a widget. That is due to the sub pixel nature of measurements and positioning in widgets. As an example when you turn the "needle" in the widget the needle follows a lot smoother than in the Livecode Script version.
A widget is more part of the IDE in as much as it can be configured via the Properties Inspector if the relevant parameters are exposed.
If fully written a widget carries its own dictionary which will be integrated into the main dictionary. No need for extra documentation.
A widget is more stable as you can not accidentally delete/change position of a part of the usually grouped graphics that make up Livecode Script equivalent.
Paths are smoother in a widget since you again have sub pixel control over it, not so obvious with rectangles or circles but with curves etc. Make a freehand line in a graphic and look at the jaggedness of the curvy parts. That is the pixel as the lower limit of determining a point in a LCS graphic.

However a widget takes more thought and development time. Since it is not as easily changed as a group of graphics you have to include what you want right before the first release.
Livecode Builder is a language different enough from Livecode Script to take some time to get familiar with. Think more of months than weeks of getting halfway familiar with it. Read a LOT of code to see how it works.
A widget has to be compiled. That is currently a problem not only for versioning but also because the changing format in compiled widgets. E.g. you install the gauge using LC 8.1.3 it will work in 8.1.4 but not in LC DP6. You have to recompile the widget. This will be a lot easier once the file format of compiled widgets stabilizes.
A Livecode group of graphics works across versions and could be updated with a small script, no need to recompile etc.

Summing up: I prefer widgets over Livecode Script grouped graphics for above reasons. They look and perform better and are easy to integrate into the IDE, just drag them off the tools palette. On the other hand they are not as accessible to user modification as grouped graphics done in Livecode Script.

I think that widgets are a wonderful way of extending Livecode, I guess that is why they call them extensions :) A defined functionality you just drop into your LIvecode Script application.

Kind regards
Bernd

bogs
Posts: 480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Gauge widget

Post by bogs » Fri Jun 09, 2017 5:40 pm

Thank you for that information Bernd, I really appreciate it.
ImageImage

mrcoollion
Posts: 253
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Gauge widget

Post by mrcoollion » Fri Jun 09, 2017 5:49 pm

Thx Bernd

Nice job and thx for the community support.
PS. the documentation file is named api.lcdoc . I renamed it to api_lc.doc to enable me to read the content in WPS Writer or MS-Word.

Paul

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2570
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Gauge widget

Post by mwieder » Fri Jun 09, 2017 6:59 pm

I do question the naming convention that widget developers have been using.
The "com.livecode." prefix seems to me to be for extensions coming from the company itself, and I think the more proper format for user extensions might be "com.community.<username>.<widgetname>".

That said, your gauge widget shows up nicely in the widgets panel of the latest PowerTools build.
PowerTools2.0.4.png

pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 84
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: Gauge widget

Post by pthirkell » Fri Jun 09, 2017 11:31 pm

Thanks Bernd this is a great widget. I can already think of a couple of ways to use your gauge ... and more importantly you demonstrate further how Livecode Builder helps us build controls that are powerful and scale perfectly on any platform.

You are right that LCB does have a reasonable learning curve which takes a little while. But eventually "the penny drops," and the effort is worth it in terms of what Builder allows you to do :D

Cheers. Peter T

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Gauge widget

Post by bn » Fri Jun 09, 2017 11:40 pm

Hi Peter,

thanks.

Also thanks to the link for not being able to "serialize non-primitives" as Points or Colors in onSave. I somehow missed that.

Kind regards
Bernd

mrcoollion
Posts: 253
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Gauge widget

Post by mrcoollion » Sat Jun 10, 2017 10:59 am

Have a problem with the Gauge widget.

Probably because I am doing something wrong but after installing the widget with the extension builder I do see the widget in the extension manager but i do not see the widget in Object>New Widget menu options?
This is what I get after re installing the widget.

11:44 AM: Skipping recompilation of D:/User Folders/Documents/LiveCode App ontwikkel/Widgets/Gauge widget/gauge_0_1_0.lcb/module.lcm - module is up to date
11:44 AM: Skipping recompilation of D:/User Folders/Documents/Widgets/Gauge widget/gauge_0_1_0.lcb/module.lcm - module is up to date
11:44 AM: Warning: no user guide found
11:44 AM: Warning: no user guide found

:?:

Regards,

Paul
------------------------------------------------------------
ExtensionB_01.png
Builder
ExtensionB_01.png
Builder
IDE.png
Menu
Attachments
ExtensionM_01.png
Manager

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Gauge widget

Post by bn » Sat Jun 10, 2017 11:19 am

Hi Paul,

I recommend downloading the current version in the first post of this thread(just because it has some bug fixes as far as saving a stack with the widget is concerned)

What you describe happened to me at times.

What I recommend is

go to your "My Livecode" folder

in folder Extensions delete manually the community.livecode.berndngauge folder

now still in "Extensions" folder then in folder "interface" delete "community.livecode.berndn.gauge.lci"

close Livecode if open.

restart Livecode: there should be no gauge anymore.

Put your newly downloaded .lcb file into the folder from where you compiled the old gauge. You have to remove the old .lcb file, there can only be one .lcb file in anyone folder. Best is to remove everything from that folder i.e. the "old" compiled stuff, just put the new .lcb file there.

Now point the Extension Builder to the .lcb file and test, then "Install".
I get the warning about the missing dictionary also but just ignore it.

Extension Builder might ask for icons (2 times) just cancel that request.

The gauge widget should show up in your Toolbar with an SVG icon.

To be sure close Livecode and reopen it.

Now Gauge widget should again be in the toolbar and also accessible from the "Object" menu. And the dictionary should show up in LC dictionary -> API

There are some quirks in the Installation process which I will report.

Hope it works for you

Kind regards
Bernd

mrcoollion
Posts: 253
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Gauge widget

Post by mrcoollion » Sat Jun 10, 2017 1:52 pm

Hi Bernd,

Tried to follow what you suggested. But because those folders were not to be found in the extension folder (after closing and opening livecode) and because version 8.1.3 was curiously installed in '\AppData\Roaming\RunRev\Components\LiveCode Indy 8.1.3' which is not where it should be I reinstalled livecode (now version 8.1.4).

This solved my problem.

Thanks for the support Bernd.

Regards,

Paul

mrcoollion
Posts: 253
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Gauge widget

Post by mrcoollion » Fri Jun 16, 2017 11:06 am

Here I am again with a small problem.

In this case I wanted to remove the existing gauge widget and replace it with the latest version (0_3_0).
So I did an uninstall and this proces does not finish (see screenshot).
Also I cannot find the widget folder as described before (see screenshot).
The widget remains in the Object > New Widget menu.

What to do?

regards,

Paul
Prntscrn3.png
Screenshot

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Gauge widget

Post by bn » Fri Jun 16, 2017 11:22 am

You are looking at the extension folder of the built in widgets
Gauge is however i My Licecode Extension folder
Please remove the gauge folder and gauge lci file from interface folder
Restart LC
Gauge should be gone now
Install Gauge 030 via extension builder

Kind regards
Bernd

mrcoollion
Posts: 253
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Gauge widget

Post by mrcoollion » Fri Jun 16, 2017 12:14 pm

Looked everywhere and still have no clue on where to find the folders mentioned.

Must be somewhere because the widget is still functional... :?:

Windows 10 PC with Livecode 8.1.4
Attachments
Prntscrn4.png
C:\Program Files (x86)\RunRev\LiveCode Indy 8.1.4 folders

Post Reply

Return to “LiveCode Builder”