Scripting: NumericTextEntry doesnt give a "onChange" event

Next
 From:  r2d3
8694.1 
Working on my script, i'm running into this:
I have 3 values, if i change on the others should be updatet.



It works fine as long as i mark the values with the mouse - change them - hit enter -other value is updated.

But if i click into the input the NumericTextEntry comes up - i change the value - hit enter (or click Okay) - nothing.



The NumericTextEntry doesnt give me a onChange event

How can i solve this?

Ralf


the htm file:
###############################
<html xmlns:moi>
<head>
<link rel="stylesheet" href="moi://ui/moi.css" type="text/css">
<script>
var opt;
function UpdateValues(opt)
{
if(opt ==1){
scale.value=newD.value/oldD.value;
}else{
newD.value=oldD.value*scale.value;
}
alert(opt);
}
</script>
</head>

<body class="commandbody">

Change Hole

Select all faces of the hole

Pick basepoint

Change Diameter




<moi:CheckButton id="subtype" style="persist:true" default=true>Keep Tool</moi:CheckButton>


<moi:NumericInput id="oldD" style="width:4em;">
<nobr> Old diameter</nobr>

<moi:NumericInput id="newD" style="width:4em;" onchange="UpdateValues(1);">
<nobr> New diameter</nobr>
<moi:NumericInput id="scale" style="width:4em;" onchange="UpdateValues(0);">
<nobr> Scale factor</nobr>


<nobr>Scalefactor</nobr>
<moi:Slider id="diameterSlider" min="0" max="5" style="width:90%">
<moi:NumericInput id="scalez" style="width:3em;" default="1" binding="diameterSlider.value = this.value">


<moi:CommandCancel>


<moi:CommandDoneCancel>

</body>
</html>
##############

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
8694.2 In reply to 8694.1 
Update for a changed .htm entry is often done in the .js code, with moi.ui.commandDialog.waitForEvent()
For example, see LineWeb.js. (I cannot comment on your code.)
- B
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
8694.3 In reply to 8694.1 
Hi Ralf, try using onvaluechange="" instead of onchange="" .

The onvaluechange="" is a custom event that MoI fires which should work for both of those cases. That's there because in MoI v1 and v2 it wasn't easy for me to customize the standard onchange event, so MoI controls used a custom one instead.

I'll look into making the standard onchange="" work now as well though.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  r2d3
8694.4 In reply to 8694.3 
>Hi Ralf, try using onvaluechange="" instead of onchange="" .

YES this works
Thank you very much!
Ralf
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All