I think a better way, might be to leave the constraints as the default for x and y, and in the resize state say:

<class ...
x="${canvas.width * .95 - this.width}" y ="${canvas.height * .95 - this.height}"
  ...>
  <resizestate name="resize">
    <!-- on resize, stop constraining position -->
    <attribute name="x" value="this.x" />
    <attribute name="y" value="this.y" />
  </resizestate>

The intent is, that as soon as you start resizing, x and y get set to their current value, which will remove the default constraint. (This is how states are defined to work. If a state defines an attribute that is already defined in the parent, the attribute is given the state value. When the state is removed, the attribute keeps it's last value.)

On 2009-01-09, at 20:59EST, Henry Minsky wrote:

Here's a method I am using to remove the constraint when you start
resizing the width/height; I put the x,y constraints into a method
that is applied by default, and then when the resize state is applied,
it un-applies that initial state. i.e.,

<class name="LzDebugWindow">

<!-- sets the initial position of the debug window to constrain to the canvas>
 <state name="initial_position_state" applied="true">
   <attribute name="y" value="${canvas.height * .95 - this.height}"/>
   <attribute name="x" value="${canvas.width * .95 - this.width}"/>
 </state>


   <resizestate name="resize">
     <handler name="onapplied">
       parent.initial_position_state.setAttribute('applied', false);
     </handler>
   </resizestate>
</class>

Is there a better way to do this?


On Fri, Jan 9, 2009 at 6:43 PM, Henry Minsky <[email protected] > wrote:
Oh hey, there is definitely a bug when you try to resize the debugger
window; the constraints
don't let go!

Tucker, what is the right way to disable the constraint on x and y
when the user wants to change
the width and height manually?

I wonder if the constraints on x and y should be in a state, and then
the state could be unapplied
when the user activates the resizer state?



On Fri, Jan 9, 2009 at 6:26 PM, Henry Minsky <[email protected] > wrote:
I don't see the error when I run in swf8 in FF3 on OSX.

It might be possible that some other example in the doc web page is causing the
network to get broken somehow? Can you run that example just
standalone as an app
and see if you still see the error behavior?


On Fri, Jan 9, 2009 at 4:30 PM, Lou Iorio <[email protected]> wrote:
I'm not running a test case, just building the documentation,
but here's the example.

<canvas debug="true" height="200" width="100%">
<debug x="160" y="5" height="150" width="300"/>
<script>Debug.debug('user code');</script>
<button text="Get x, y" width="150" height="150"
onclick="Debug.debug('click: x=%d, y=%d', getMouse('x'), getMouse('y'))"/>
</canvas>


On Jan 9, 2009, at 5:18 PM, Henry Minsky wrote:

Can you send me the lzx test case code you're running?


On Fri, Jan 9, 2009 at 2:49 PM, Lou Iorio <[email protected] >
wrote:

I'm seeing some odd behavior on the Mac with FF3.

When I first load a chapter, say Debugging, the example comes up like
this:





And the FF status bar says: "Transferring data from localhost...",
and that message doesn't go away.

If I then click the refresh button, the example comes up like this:





And the FF status bar says: "Done".

Safari 3.2.1 on the Mac seems to do the right thing.


On Jan 9, 2009, at 1:33 PM, Henry Minsky wrote:

please review , check that the debugger shows up on canvas in doc
examples
thanks

---------- Forwarded message ----------
From: Henry Minsky <[email protected]>
Date: Fri, Jan 9, 2009 at 12:27 PM
Subject: For Review: Change 20090109-hqm-3 Summary: make debugger set
position to be on screen
To: [email protected]
Cc: [email protected]


Change 20090109-hqm-3 by [email protected] on 2009-01-09 12:26:42 EST
in /Users/hqm/openlaszlo/trunk5
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: make debugger set position to be on screen

New Features:

Bugs Fixed: LPP-7602

Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:


Tests:

make test/hello.lzx canvas size small (200 x 500) and see that
debugger still appears on the canvas

Files:
M      lps/components/debugger/debugger.lzx

Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/20090109-hqm-3.tar



--
Henry Minsky
Software Architect
[email protected]






--
Henry Minsky
Software Architect
[email protected]





--
Henry Minsky
Software Architect
[email protected]




--
Henry Minsky
Software Architect
[email protected]




--
Henry Minsky
Software Architect
[email protected]

Reply via email to