Widget Support?

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
hwbehrens
Posts: 19
Joined: Fri Mar 19, 2010 9:10 pm

Widget Support?

Post by hwbehrens » Thu Oct 29, 2015 10:51 pm

Where is the appropriate place to seek support on consuming widgets, rather than creating them?

- Hans

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Widget Support?

Post by peter-b » Mon Nov 02, 2015 1:01 pm

hwbehrens wrote:Where is the appropriate place to seek support on consuming widgets, rather than creating them?
Probably in the Talking LiveCode for now? But you'll probably get an answer if you ask your question here, too. :wink:
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

hwbehrens
Posts: 19
Joined: Fri Mar 19, 2010 9:10 pm

Re: Widget Support?

Post by hwbehrens » Mon Nov 02, 2015 4:49 pm

Thanks, Peter! I figured the normal sections might be a bit too general for my specific question, specifically, how can I adjust the margins on an svgPath widget object?

For example, consider the following iconPath:

Code: Select all

M1000 700h-200c0 44 -36 76 -36 76s-52 24 -64 24h-400c-18 0 -53 -12 -72 -34c-31 -36 -34 -92 -4 -130c18 -24 48 -36 76 -36h400c102 0 169 -51 204 -82c125 -109 124 -296 14 -418c-60 -68 -110 -100 -218 -100h-400c-76 0 -148 24 -210 82c-66 62 -90 148 -90 218 h200c0 -30 6 -54 26 -74s34 -26 74 -26h400c12 0 46 8 66 24c42 34 48 100 12 142c-20 24 -60 34 -78 34h-400c-92 0 -162 46 -204 84c-132 120 -122 316 0 430c38 36 102 86 204 86h400c48 0 140 -10 216 -96h2c42 -48 82 -124 82 -204z
If you set the flipVertical to true, and the rect to 0,0,100,100, you'll see that the shape is roughly 3 pixels away from the edge of the card. I'm not yet sure if that's a problem with the path or an intrinsic property of the widget. I'm aiming to have the shape go right up against the edge of the card. At the moment, do I have any control over those kinds of things?

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

Re: Widget Support?

Post by bn » Mon Nov 02, 2015 9:15 pm

Hi Hans,

svgPath has as default "maintainAspectRatio" = true (see Properties Inspector), try to turn it off and it will work with your SVG-Data you posted below. Although since it is not a true square it will be a little distorted.

For other SVG-paths turning off "maintainAspectRatio" will cut off some of the path because there is a translation lacking in the conditional when "maintainAspectRatio" is turned off. See the default Star and turn off "maintainAspectRatio" and change the size of the widget.

The code below fixes that

Code: Select all

// scale to fit within widget and maintain aspect ratio
	if mMaintainAspectRatio then
		constrainPathToRect(my bounds, tPath)
	else
		scale tPath by [my width / the width of the bounding box of tPath, \
			my height / the height of the bounding box of tPath]
			put the bounding box of tPath into tBounds -- added BN
			translate tPath by [the left of tBounds * -1, the top of tBounds * -1] -- added BN
	end if
this will place the SVG-path fitted into the rect of the widget. (my additions marked with -- added BN)

If you feel so you could "hack" the widget to do that.
But if you only want to use the path you posted you would not need it.

Kind regards

Bernd

Post Reply

Return to “LiveCode Builder”