JavaScript-Problem with ObjectPicker

Next
 From:  Karsten (KMRQUS)
7993.1 
Hello,

I have a problem with the ObjectPicker function. When I select objects the objectslist keeps empty!?

function foo ()
{
var objectpicker = moi.ui.createObjectPicker();
objectpicker.allowCurves();
GetObjects(objectpicker);

moi.UI.alert(objectpicker.objects.length, "objects");
if(objectpicker.objects.length===0){
...

What I'm doing wrong? Any ideas?

Thanks in advance and a nice day
Karsten
  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
7993.2 In reply to 7993.1 
Hi Karsten - your existing script there should work ok if you prepick your objects, that means to select your objects before you run your script.

If you want to also support post-pick, where it will let you pick objects after the command is started if nothing was selected, then you need to also set up some .htm UI that has a "Done" and "Cancel" button on it. This is because when you right-click to finish selecting objects in the object picker, the rules that the right-click mechanism follows is that if there is a "Done" button it's the same as clicking the "Done" button. If no "Done" button exists, it looks for a "Cancel" button and triggers that. If neither of those UI elements exist, it will then do a cancel which is what is probably triggering for you.

- 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:  Karsten (KMRQUS)
7993.3 In reply to 7993.2 
Hello Michael,
thanks for your reply. Unfortunateli I can't make a html with the same name. So I will try getObject instead of getObjects. It seams that it don't need a html to work:-)
Nevertheless - I will never understand that html-stuff ...

Thanks again
and
have a nice day
Karsten
  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