What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

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
PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

Post by PaulDaMacMan » Thu Sep 10, 2020 5:46 pm

The title says it all...
What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

So I've made a bunch of progress on my Piano Widget but hit another limitation, the doesn't seem to be any OnGeometryChanged() equivalent of "redraw all" that triggers OnPaint()'s handler. I have at least one idea of how to force OnGeometryChanged() that involves "execute script" to resize the widget's rect from LCS and then resize it back to what it was. Is there any better way?

Basically my Widget has a property that a scripter can set that changes the does some scaling on a bunch of paths inside the Widget, but there's no way to trigger OnGeometryChanged() from my property setter handler.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

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: What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

Post by trevordevore » Thu Sep 10, 2020 6:00 pm

@PaulDaMacmac - Is there a reason that OnGeometryChanged() has to fire? Can't you just perform the scaling internally by calling your own function? It sounds like you just need to have an internal handler which is called in OnGeometryChanged() or your property setter handler. I guess you could just try calling OnGeometryChanged() from your property setter as well.
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

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

Post by PaulDaMacMan » Thu Sep 10, 2020 6:28 pm

trevordevore wrote:
Thu Sep 10, 2020 6:00 pm
It sounds like you just need to have an internal handler which is called in OnGeometryChanged() or your property setter handler.
Ger...duhhh! Yes, I should've thought of that! There I go again making things way more complicated then it needs to be!
I guess you could just try calling OnGeometryChanged() from your property setter as well.
And for the record, YES! You can just call OnGeometryChanged() from another handler! For some reason I figured it would be a 'reserved' handler name only allowed to be called by the engine, but it's perfectly OK to call it directly.

Thanks Trevor
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

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: What's the best way to force-trigger OnGeometryChanged() in Widget from LCB?

Post by trevordevore » Thu Sep 10, 2020 6:29 pm

You're welcome Paul.
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

Post Reply

Return to “LiveCode Builder”