|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Removing a double behavior.Hello everyone,
Please, can anyone tell me, is there is an easy way to completely remove two behaviors from an object ? Here is the thing : I've got a div which is affected by two behaviors ('DragAndDrop' and 'ReSize'). These behaviors are limited by another div used as a mere container. I want an onclick event on a button to stop these behaviors so I tryed to use the desaffect() method twice but then I've got the following errors in Firebug : "oSpecs is null" and "oHtml.behavior is null". Moreover, the resizing cursor is still there. It seems the first desaffect() remove some of the object's attributes needed by the second one. I wish someone could help me finding a solution to that problem. Thanks by advance. |
|
|
Re: Removing a double behavior.Hello,
Can you post your code (a relevant extract), please ? François --- In rialto-dev@..., Kawaada <kawaada@...> wrote: > > > Hello everyone, > > Please, can anyone tell me, is there is an easy way to completely remove two > behaviors from an object ? > > Here is the thing : I've got a div which is affected by two behaviors > ('DragAndDrop' and 'ReSize'). These behaviors are limited by another div > used as a mere container. > I want an onclick event on a button to stop these behaviors so I tryed to > use the desaffect() method twice but then I've got the following errors in > Firebug : "oSpecs is null" and "oHtml.behavior is null". Moreover, the > resizing cursor is still there. > > It seems the first desaffect() remove some of the object's attributes needed > by the second one. > > I wish someone could help me finding a solution to that problem. > > Thanks by advance. > -- > View this message in context: http://www.nabble.com/Removing-a-double-behavior.-tp22945449p22945449.html > Sent from the Rialto-Development mailing list archive at Nabble.com. > |
|
|
Re: Removing a double behavior.Here is the content of my page, thank you for helping me :
<script> var divDrag; var objParam={}; objParam.ghost={}; objParam.ghost.aspect='rect'; objParam.movingLimits={}; objParam.bRectLim=true; objParam.movingLimits.orientation='2D' objParam.bDynamicsMovingLimits = false; objParam.magneticsGrid ={widthCol : 10, heightRow : 10}; objParam.isWithLimitsDisplayed=true; objParam.isWithMovingInfo =false; objParam.bSelectMark = true; objParam.whichMouseButtonForDD = 'left'; var setup={}; setup.bRectLim = true; setup.majDyn = false; setup.sensitiveEdgeWidth = 10; setup.limitReDim = {heightMin:20,widthMin:20,heightMax:250,widthMax:250} function creationComplete(){ divDrag = document.createElement('DIV'); var divStyle=divDrag.style; divStyle.position='absolute'; divStyle.left=50; divStyle.top=50; divStyle.height=100; divStyle.width=100; divStyle.backgroundColor="#6699FF"; divStyle.border = "6px solid gray"; document.getElementById('test').appendChild(divDrag); rialto.widgetBehavior.affect(divDrag,'ReSize',setup); rialto.widgetBehavior.affect(divDrag,'DragAndDrop',objParam); } function turnOffBehaviors() { rialto.widgetBehavior.desaffect(divDrag,'ReSize'); rialto.widgetBehavior.desaffect(divDrag,'DragAndDrop'); } rialto.onload = creationComplete; </script> <body> <div id="test" style="width:600;height:400px;" > </div> <input type="button" value="Turn off behaviors" onclick="javascript:turnOffBehaviors()"/> </body> Also, I did find a solution to this problem but really I don't like it. I used the following code instead of the desaffect methods : divDrag.reSize = false; divDrag.dragAndDrop = false; Thanks in advance.
|
|
|
Re: Removing a double behavior.Hello,
Now it works. You must just update rialto.js from svn. By the way : if you want to display the correct cursor (with resize behavior) you must add objParam.sensitiveEdgeWidth = 10; in your code. Good week-end François --- In rialto-dev@..., Kawaada <kawaada@...> wrote: > > > Here is the content of my page, thank you for helping me : > > <script> > > var divDrag; > > var objParam={}; > objParam.ghost={}; > objParam.ghost.aspect='rect'; > objParam.movingLimits={}; > objParam.bRectLim=true; > objParam.movingLimits.orientation='2D' > objParam.bDynamicsMovingLimits = false; > objParam.magneticsGrid ={widthCol : 10, heightRow : 10}; > objParam.isWithLimitsDisplayed=true; > objParam.isWithMovingInfo =false; > objParam.bSelectMark = true; > objParam.whichMouseButtonForDD = 'left'; > > var setup={}; > setup.bRectLim = true; > setup.majDyn = false; > setup.sensitiveEdgeWidth = 10; > setup.limitReDim = {heightMin:20,widthMin:20,heightMax:250,widthMax:250} > > function creationComplete(){ > > divDrag = document.createElement('DIV'); > var divStyle=divDrag.style; > divStyle.position='absolute'; > divStyle.left=50; > divStyle.top=50; > divStyle.height=100; > divStyle.width=100; > divStyle.backgroundColor="#6699FF"; > divStyle.border = "6px solid gray"; > document.getElementById('test').appendChild(divDrag); > > > rialto.widgetBehavior.affect(divDrag,'ReSize',setup); > rialto.widgetBehavior.affect(divDrag,'DragAndDrop',objParam); > } > > function turnOffBehaviors() { > rialto.widgetBehavior.desaffect(divDrag,'ReSize'); > rialto.widgetBehavior.desaffect(divDrag,'DragAndDrop'); > } > > rialto.onload = creationComplete; > </script> > <body> > <div id="test" style="width:600;height:400px;" > > </div> > <input type="button" value="Turn off behaviors" > onclick="javascript:turnOffBehaviors()"/> > </body> > > > Also, I did find a solution to this problem but really I don't like it. > I used the following code instead of the desaffect methods : > > divDrag.reSize = false; > divDrag.dragAndDrop = false; > > Thanks by advance. > > > > > François Lion wrote: > > > > Hello, > > > > Can you post your code (a relevant extract), please ? > > > > François > > > > --- In rialto-dev@..., Kawaada <kawaada@> wrote: > >> > >> > >> Hello everyone, > >> > >> Please, can anyone tell me, is there is an easy way to completely remove > >> two > >> behaviors from an object ? > >> > >> Here is the thing : I've got a div which is affected by two behaviors > >> ('DragAndDrop' and 'ReSize'). These behaviors are limited by another div > >> used as a mere container. > >> I want an onclick event on a button to stop these behaviors so I tryed to > >> use the desaffect() method twice but then I've got the following errors > >> in > >> Firebug : "oSpecs is null" and "oHtml.behavior is null". Moreover, the > >> resizing cursor is still there. > >> > >> It seems the first desaffect() remove some of the object's attributes > >> needed > >> by the second one. > >> > >> I wish someone could help me finding a solution to that problem. > >> > >> Thanks by advance. > >> -- > >> View this message in context: > >> http://www.nabble.com/Removing-a-double-behavior.-tp22945449p22945449.html > >> Sent from the Rialto-Development mailing list archive at Nabble.com. > >> > > > > > > > > > > -- > View this message in context: http://www.nabble.com/Removing-a-double-behavior.-tp22945449p22987835.html > Sent from the Rialto-Development mailing list archive at Nabble.com. > |
|
|
Re: Removing a double behavior.Congratulations for your reactivity ! I really am impressed !
Thank you again and have a good week-end too.
|
| Free embeddable forum powered by Nabble | Forum Help |