Re: resizeControl wishes...

2023-12-04 Thread Bob Sneidar via use-livecode
Dang! I thought I was learning a new word!

Bob S


On Nov 30, 2023, at 9:29 AM, ambassador--- via use-livecode 
 wrote:

it uses the power of the engine to its most efficient, preditable, and robust 
advangage to put things exactly where you want them.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread Paul Dupuis via use-livecode

On 11/30/2023 2:20 PM, Brian Milby via use-livecode wrote:

Groups get the message when resize happens by script.
Other objects only receive the message when resized by hand.

Brian Milby
br...@milby7.com



Except, the "PowerButton" widget actually receives "resizeControl" just 
as a group does when its rect is changed by script control (as well as 
by user manipulation of its resize handles). So it *is* inconsistent. 
Or, at the very least, poorly documented.


And, for my purposes, if the PowerButton can received a resizeControl 
handler, I'd really like to see the PDF widget get the message also. The 
XPDF external requires, as its target for a drawing area, a Graphic 
inside a Group, and the containing group gets resizeControl. You can use 
that resizeControl to show/hide scrollbars as appropriate based on zoom; 
set the scroll to keep a highlighted part of the PDF in view when 
resized; and more. For a migration path from the XPDF External to the 
PDF Widget, the PDF Widget should support resizeControl as well.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread Brian Milby via use-livecode
Groups get the message when resize happens by script.
Other objects only receive the message when resized by hand.

Brian Milby
br...@milby7.com

> On Nov 30, 2023, at 1:51 PM, Paul Dupuis via use-livecode 
>  wrote:
> 
> Thank you Richard.
> 
> I see what the issue for me was. Groups do indeed receive a resizeControl 
> message automatically if the rect is changed by script. However, the message 
> (resizeControl) use seems inconsistent. For example, while a group does 
> received the resizeControl message, a field does not seem to. Also, what I 
> specifically ran into was that the PDF Widget does not received a 
> resizeControl handler (and it would be really useful if it did!)
> 
> I'll submit an enhancement request (below) for adding resizeControl to the 
> PDF Widget (assuming it's possible), but I don't have the time to determine 
> what widgets support resizeControl and which don't and what LC objects (other 
> than groups) support resizeControl and which don't.
> 
> https://quality.livecode.com/show_bug.cgi?id=24437
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread Paul Dupuis via use-livecode

Thank you Richard.

I see what the issue for me was. Groups do indeed receive a 
resizeControl message automatically if the rect is changed by script. 
However, the message (resizeControl) use seems inconsistent. For 
example, while a group does received the resizeControl message, a field 
does not seem to. Also, what I specifically ran into was that the PDF 
Widget does not received a resizeControl handler (and it would be really 
useful if it did!)


I'll submit an enhancement request (below) for adding resizeControl to 
the PDF Widget (assuming it's possible), but I don't have the time to 
determine what widgets support resizeControl and which don't and what LC 
objects (other than groups) support resizeControl and which don't.


https://quality.livecode.com/show_bug.cgi?id=24437

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread ambassador--- via use-livecode
Craig Newman wrote:
> “reSizeControl” is a message. What I mean by that is if you are already
> running under script control, why do you need to send such a message at
> all? Can’t your handler do whatever you needed to if the user did the
> actual resize action?

He's asking about resizing that takes place outside of direct user interaction 
with the pointer tool, such as during a resizeStack event.


Paul Dupuis wrote:
> resizeControl is sent "only sent when the user resizes a control by
> dragging its handles. It is not sent if a handler changes the size
> of a control by changing its properties (width, height, and so on)."

That appears to be a documentation bug. IIRC the change you're looking for was 
introduced way back when the DataGrid premiered. Without it the DG wouldn't be 
able to cleanly update its internal groups.

Here's a simple test stack confirming the change:
https://fourthworld.net/lc/Resize%20Confirmation.livecode

-- Card script:
on resizeStack
   set the rect of grp 1 to the rect of this cd
end resizeStack


-- Group script:
on resizeControl
   put item 2 of the loc of this card into tMid
   set the rect of fld 1 to the left of me,the top of me,the right of me,tMid
   set the rect of fld 2 to the left of me, tMid, the right of me, the bottom 
of me
end resizeControl

Tip: Set the lockLoc of such groups to true, to override the engine's default 
behavior of adjusting group size to fit contents.


Now that the engine sends resizeControl to groups under both user interaction 
and script directive, handling the resizeStack message is MUCH easier than 
before.

Among other things, it lets you encapsulate code within groups for reuse.

But even if your groups are one-offs not needed elsewhere, the benefits of 
encapsulating the LOGIC of putting things where you want them is immense.  It's 
so much easier to express the placement of objects within a group than relative 
to the group within a card.

I'd guess that not having this sooner, and not documenting it after delivery, 
may contribute to the cottage industry of 
clck-click-click-click-click-click-click-click-click-click options for handling 
resizing with things like the Geometry Manager and various other tools and 
options.  All of them are utimately responding to the resizeStack message, but 
in a generalized way that adds a large layer of complexity, and sometimes 
uncertainty.  Handling resizeStack directly is with-the-grain; it uses the 
power of the engine to its most efficient, preditable, and robust advangage to 
put things exactly where you want them.

--
Richard Gaskin
FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread Alex Tweedly via use-livecode


On 30/11/2023 16:05, Paul Dupuis via use-livecode wrote:
resizeControl is sent "only sent when the user resizes a control by 
dragging its handles. It is not sent if a handler changes the size of 
a control by changing its properties (width, height, and so on)."



Basically, that dictionary entry is wrong.

If you *change* the size of a group by script, then that group *does* 
receive a resizeControl message.


Note that it does *not* receive a mesage just because the rect changes - 
only if the size changes.


So if you do something like

   repeat 10 times
       add 1 to X
       set the rect of grp "A" to X,Y, X+100, Y+100
   end repeat

then grp "A" will get either 0 or 1 message (from the first time through 
the loop).


If you do

   repeat 10 times
       add 1 to X
       set the rect of grp "A" to 100,Y, X+100, Y+100
   end repeat

it will receive either 9 or 10 messages.

So, essentially I think, your wish is already true :-)

Alex.

(Yes, tested pretty thoroughly in 10.0DP6 but I believe also true in 
earlier versions; I had to re-test this two days ago while playing with 
the recent benchmarking of groups vs cards).




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: resizeControl wishes...

2023-11-30 Thread Craig Newman via use-livecode
Paul.

“reSizeControl” is a message. What I mean by that is if you are already running 
under script control, why do you need to send such a message at all? Can’t your 
handler do whatever you needed to if the user did the actual resize action?

Craig

> On Nov 30, 2023, at 11:05 AM, Paul Dupuis via use-livecode 
>  wrote:
> 
> resizeControl is sent "only sent when the user resizes a control by dragging 
> its handles. It is not sent if a handler changes the size of a control by 
> changing its properties (width, height, and so on)."
> 
> Does anyone else really really wish that resizeControl was set when the 
> control's size is changed via script? I sure do!
> 
> For example, I have cards with multiple groups of objects on them. Each of my 
> groups (and sometimes sub-groups) have resizeControl handlers that position 
> everything in the groups appropriately. I do this for portability. If I copy 
> the group to somewhere else, the handler (resizeControl) that knows how 
> everything is to be moved and resized goes with the copied group.
> 
> My card script has a "resizeStack" handler that just sets the rects of the 
> top level groups and dispatches resizeControl to each group on the card after 
> changing its rect. I really wish I could eliminate these "dispatch" (or send) 
> commands. I forget to include them some times, simple expecting (even though 
> I know better) that if I change the size (rect) of a control with a 
> "resizeControl" handler, that that resizeControl handler should execute!
> 
> Anyone else wish that resizeControl would get executed if a control's size is 
> changed by script? It just seems counter-intuitive that it does not.
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode