Mimic enabled property?
Re: Mimic enabled property?
@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'.
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'.
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Mimic enabled property?
@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
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
Re: Mimic enabled property?
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/
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Mimic enabled property?
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
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
Re: Mimic enabled property?
@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: 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. ]
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Mimic enabled property?
@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.
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 enabled get mEnabled set setEnabled
private handler setEnabled(in pBoolean as Boolean)
put pBoolean into mEnabled
log [mEnabled]
end handler
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
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
Re: Mimic enabled property?
@trevordevore: The problem you are seeing in this case is due to http://quality.runrev.com/show_bug.cgi?id=15276.
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Mimic enabled property?
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
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
Re: Mimic enabled property?
@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
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