Stupid Questions #1

Moderators: LCMark, LCfraser

Post Reply
malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Stupid Questions #1

Post by malte » Mon Jan 02, 2017 12:47 am

Hi all,

I really want to understand widgets. But I can not find the simple examples I need. I would like to start to draw a gradient in a widget. How would I do that?

Cheers,

malte

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1520
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Stupid Questions #1

Post by [-hh] » Mon Jan 02, 2017 3:13 am

Few (properties only):
Dictionary > Choose API: LC Builder > gradient

Much more:
https://github.com/livecode/livecode/bl ... editor.lcb

Essentially: Create a gradient and properties, set the paint to it, fill/stroke the canvas.
For example:

Code: Select all

variable tG as Gradient
put linear gradient with ramp tGRamp into tG
set the paint of this canvas to tG
fill this canvas
shiftLock happens

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Stupid Questions #1

Post by malte » Mon Jan 02, 2017 10:52 am

Thanks HH!

I assume tGRamp needs to be a gradient ramp like it is in LCS? But I bet it must be a typed variable, correct? What does it need to be and how would I fill it? My first try is to style Eleanors / Bernds calendar. I would like to change the header section first and then add a red background for Sat and sundays. I thought that would be an easy enough task to start with, but I fail with the simplest things already. :-(

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

Re: Stupid Questions #1

Post by bn » Mon Jan 02, 2017 11:24 am

Hi Malte,

I feel your pain... :)

It took me QUITE a while to do even simple things in LCB. It looks a lot like Livecode Script but the differences are at times subtle and you have to get used to it. Logging, logging, logging helped once you get over the syntax errors.

As far as gradients are concerned here is a .lcb script that draws a radial gradient and some lines. Techniques borrowed from all over the place. This rough sketch is testing how to turn a circular widget with the mouse for interactivity as in a dial.

It works well in LC 9 DP2 and onwards (that is after Frazer had refactored LCB), in prior versions there was a strange bug in LCB that made the turning movement jump at larger sizes. http://quality.livecode.com/show_bug.cgi?id=17898

Kind regards
Bernd
Attachments
moveTest.lcb.zip
(1.75 KiB) Downloaded 49 times

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Stupid Questions #1

Post by malte » Mon Jan 02, 2017 11:51 am

Thanks Bernd!

How stable is 9? I am currently in Beta phase with one of my apps and plan to release in a month. Do you think it would be too risky to switch to 9?

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

Re: Stupid Questions #1

Post by bn » Mon Jan 02, 2017 12:04 pm

How stable is 9? I am currently in Beta phase with one of my apps and plan to release in a month. Do you think it would be too risky to switch to 9?
that is hard to tell. I don't do commercial software. I use 9 and have little to no problems. Actually the 9 series seems to be the best yet.
Trevor apparently uses DP versions for his commercial software. His reasoning is that he tests extensively and if it works he uses it. Maybe you ask him on Gitter.

Kind regards
Bernd

Post Reply

Return to “LiveCode Builder”