Mimic enabled property?

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

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Mimic enabled property?

Post by LCMark » Fri Mar 20, 2015 10:57 am

@monte: There's a couple of options - the 'shape' concept would essentially do as you suggest. When you give the engine a shape it would put it in a cache, only re-requesting it if you tell the engine the shape has changed, or if it needs more memory and had to ditch it. It also means that geometric shapes can be kept geometric and hit-tested directly. For example, it's quite cheap to check whether a point is within a convex path - even simpler if a point is within a rectangle.

Of course, you'd still be able to implement arbitrary code in HitTest so this mechanism would just be a way which might be more performant in certain cases.

One of the things has made me think along these lines is @LCIan's work on implementing 'popup widget' in LCB. This is a feature (which is soon to be merged in) which allows a widget to popup another widget in a floating window that has the normal popup cancellation semantics. Generally such popups have drop-shadows - Mac handles these gracefully as it derives the shadow from the alpha-channel on the Window; Windows, however, is not quite so friendly - it uses the 1-bit region based window shape to derive the shadow. The latter mandates a couple of things - you have to derive the 'shape' from the alpha-channel yourself *and* it isn't really practical to have it changed after every redraw (should the alpha-channel have changed). Essentially this means we need widgets to be able to say 'I'm this shape'.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Mimic enabled property?

Post by trevordevore » Tue Apr 21, 2015 8:19 pm

@LCMark - regarding the enabled property, should we be able to access the 'enabled' value from LCB or are we expected to create our own property with a different name? I'm at the point in my interface where I need to get disabled controls (ignoring mouse events and rendering a different color) working. Ideally I would like to access the 'enabled' property setting that you get/set from LCS from within LCB.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Mimic enabled property?

Post by monte » Wed Apr 22, 2015 1:28 am

Don't we need to know the effective enabled and be notified of a change so we can redraw appropriately?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Mimic enabled property?

Post by trevordevore » Wed Apr 22, 2015 3:59 am

Yes. I figured it would work just like 'my font' and would trigger the OnParentPropertyChanged() handler.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Mimic enabled property?

Post by LCMark » Wed Apr 22, 2015 8:12 am

@monte: The way the engine currently works (which isn't quite correct really) is that enabled isn't an 'effective'-style property. When you set the enabled of a group it actually directly changes the enabled of the children (and recurses). It really should work like 'visible'. I filed an anomaly about this a while ago: http://quality.runrev.com/show_bug.cgi?id=14881.

@trevordevore: Yes - I think 'my enabled' / 'my disabled' would cover it adequately - for now we can hook this into ParentPropChanged although that mechanism needs a bit of work.

[ By the way, These properties are not reserved at the moment, and because of the way the engine works (i.e. containers explicitly set child enablement) you could implement them in a widget - however this would be a bit of a pain. ]

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Mimic enabled property?

Post by trevordevore » Wed Apr 22, 2015 1:45 pm

@LCMark - I tried to implement 'enabled' directly but my set handler never gets called. It looks as if the engine handles it and doesn't pass it on to the widget.

Code: Select all

property enabled get mEnabled set setEnabled

private handler setEnabled(in pBoolean as Boolean)
   put pBoolean into mEnabled
   log [mEnabled]
end handler
I never see an entry in the log. I don't think it is my code as I also defined the following property and the log entry appears when I set the 'whatEver' property.

Code: Select all

property whatEver get mEnabled set setEnabled
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Mimic enabled property?

Post by LCMark » Thu Apr 23, 2015 2:58 pm

@trevordevore: The problem you are seeing in this case is due to http://quality.runrev.com/show_bug.cgi?id=15276.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Mimic enabled property?

Post by trevordevore » Thu Apr 23, 2015 3:24 pm

Thanks Mark. With your fix should we then be able to define properties such as backgroundColor, text, and the like? I've been avoiding built-in property names.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Mimic enabled property?

Post by LCMark » Thu Apr 23, 2015 3:32 pm

@trevordevore: The current list of reserved properties are the following:

id, name, altId, layer, script, behavior, number, textFont, textSize, textStyle, lockLocation, visible, invisible, selected, traversalOn, owner, properties, customPropertySet, customPropertySets, ink, cantSelect, blendLevel, location, left, top, right, bottom, topLeft, topRight, bottomLeft, bottomRight, widget, height, rectangle, toolTip, unicodeToolTip, layerMode, kind

I'm just putting the finishing touches to a patch to add my enabled and my disabled. This will also cause enabled and disabled to be reserved.

The above bugfix means you should be able to define any property which isn't on the above list :)

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Mimic enabled property?

Post by LCMark » Thu Apr 23, 2015 3:41 pm


Post Reply

Return to “LiveCode Builder”