Skin a control with SVG Widget in Datagrid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
My example above is extremely inefficient as the 2 iconPaths
should be stored as custom properties inwith the SVG widget itself,
as should the "1 or 2" state indicator.
should be stored as custom properties inwith the SVG widget itself,
as should the "1 or 2" state indicator.
Re: Skin a control with SVG Widget in Datagrid
Here is a tiny LCB library that will allow you to easily convert icons to drawings. It adds several handlers:
After install, use is as simple as:
- generateXmlForSvgPath - same code as posted earlier with a different name
- drawingSvgCompilePath - takes a path and generates the drawing
- drawingSvgCompileIcon - takes an icon name (from the SVG Icon Library) and generates the drawing
After install, use is as simple as:
Code: Select all
set the text of image 1 to drawingSvgCompileIcon("thumbs up")
- Attachments
-
- us.milby.library.icondrawing.1.0.0.lce.zip
- SVG Icon Drawing Library
- (3.78 KiB) Downloaded 206 times
Re: Skin a control with SVG Widget in Datagrid
Thank you Brian,
a very useful and instructive file
Kind regards
Bernd
a very useful and instructive file
Kind regards
Bernd
Re: Skin a control with SVG Widget in Datagrid
Thank you very much, Brian, waaaay cool! 

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
Undoubtedly Brian's code to convert SVG objects into images is very clever,
but I fail to see any advantage over a simple screenshot of the object.
This is NOT intended to denigrate Brian's work at all.
but I fail to see any advantage over a simple screenshot of the object.
This is NOT intended to denigrate Brian's work at all.
Re: Skin a control with SVG Widget in Datagrid
Well, enlarge a screenshot and a converted SVG image and spot the difference!
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
Got it: no "jaggies" . . . BUT, who is going to enlarge one of those images?
Does this mean that Brian's things are converting the SVGs to internal graphic objects rather than images-qua-images?
-
Re: Skin a control with SVG Widget in Datagrid
Bravo!

Brians and LCs "drawcompile..." stuff actually creates a resolution independant image object, no graphic!richmond62 wrote: ↑Thu Sep 24, 2020 1:19 pmDoes this mean that Brian's things are converting the SVGs to internal graphic objects rather than images-qua-images?
Its magic, ladies and gentlemen!

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
Here's some rubbishy work that may have potential . . .
-
-
- Attachments
-
- SVG Widget to GRC.livecode.zip
- Here's the stack
- (2.2 KiB) Downloaded 229 times
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
The problem with my stack is that each "interpretation" of an SVG widget uses a single
polygonal graphic.
polygonal graphic.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Skin a control with SVG Widget in Datagrid
Hi all, turns out you don't need to skin a button, you can just use the SVG Icon in its place and script it to function like a control. Will post example tomorrow as the rest of my day is shot.
Thank you so much for all of your input. I am going to work through it as time permits because I am sure there are some great examples I can learn from.
Mark
Thank you so much for all of your input. I am going to work through it as time permits because I am sure there are some great examples I can learn from.
Mark
Last edited by marksmithhfx on Mon Oct 19, 2020 1:13 pm, edited 1 time in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Skin a control with SVG Widget in Datagrid
Just take a screenshot of the SVG widget and use that image as your icon.
Re: Skin a control with SVG Widget in Datagrid
See the icondrawing library that I posted above. That will allow you to convert an SVG icon into the drawing format that can be set on an image.bansalrehana wrote: ↑Tue Sep 29, 2020 8:28 pmI don't suppose there is a way one can use an SVG widget as an icon for a button is there?
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Skin a control with SVG Widget in Datagrid
Here's an example of using an SVG Icon as a checkbox in a datagrid. If you open the contents pane and lock it you can watch the values update in realtime. All the code for the check box is in the column behaviour script.
- Attachments
-
- Example.livecode.zip
- (7.7 KiB) Downloaded 207 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Skin a control with SVG Widget in Datagrid
Hi Brian, how do you scale images or shrink them once you've read them? I tried your code example using a check mark and it took up the whole screen

Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS