Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Pick Object Question

Author
Message
FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 25th Aug 2007 23:29
Is it possible to get the object number from the pick object command?
I want to keep maybe an array of selected items, so then i can check if they are selected, the user has an option to deselect them.

Heres my code so far



Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Aug 2007 00:28
pick object returns the object number...


spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Aug 2007 00:56
Strange question as that code specifically returns the picked object into 'po' and colours it, so why ask if it returns an object number??? Me confused.

Boo!
FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 04:26
What I want to do is to be able to deselect an object. Im confused on how to do that. Thats why I was asking if the command return the object number selected. The way i was gonna do it:

On select add object number to array
On right click of object, check array to see if it is selected, and if it is deselect it/color it.

So any help with that?

FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 19:57
I tried a lot of things, but still have no idea how to deselect the item. Is there a command for it?

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Aug 2007 21:41
I still don't completely understand what you're wanting to do. So you want to click an object, selecting it and adding it to an array, and then click on it again and deselect it from the array?


FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 21:52 Edited at: 26th Aug 2007 21:53
Ok what I have so far:

I right click on it and I select it using the pick object command. I color it to show that it is selected.


What I want to do:

Right click on it, add the object number to an array(because multiple objects can be selected), showing they are selected.

When the object is right clicked again, check the array to see if it is selected, and if it is deselect the object and color it white again.

Or is there an easier way to deselect the object?

Penfold
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 26th Aug 2007 22:00
Quote: "I still don't completely understand what you're wanting to do. So you want to click an object, selecting it and adding it to an array, and then click on it again and deselect it from the array?"


I think he just wants right click - colour add to array - right click again remove from array and return to original state.

'Ooh 'eck chief'...'crumbs'
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Aug 2007 22:16 Edited at: 26th Aug 2007 22:46
So what about something like this:

Not tested but should work .


FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 22:39
Its close, Ill have to work on it for a little to get it right, but I understand how it works, just have to tweak some things. Thanks Gil

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Aug 2007 22:46 Edited at: 26th Aug 2007 22:47
No problem, feel free to ask for explanations or help if you can't get it working .
Oh, and you need to change:
selected( searchArray ) = 0
to
selected( inArray ) = 0

stupid mistake on my part, sorry .


FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 23:23
Hmm still cant seem to get it to work. It selects and colors the object, but then wont deselect it. I dont think the object number is being written to the array. I modified some code and here is how it looks right now:



Gil, doesnt selected( openSlot ) = object have to be inside the loop? I tried that too, and it still didnt work. . .
I could of totally messed it up, but I dont know whats going on, lol

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Aug 2007 23:41 Edited at: 26th Aug 2007 23:42

That should work . Don't know why you were using Array Count so I took it out, and you also didn't have any dimensions in the "selected" array, just empty () . You also took out my if statement:
IF selected( findOpenSlot ) = 0
which you need to see if there is an object number already in that array slot. selected( openSlot ) = object should work the same inside or outside the for...next loop, I just put it out . Any more questions, feel free to ask.

EDIT: Oh and I added a resetMouse variable so that you have to release the mouse before it reads if you've clicked it again, or else it would be reading it as constantly selecting and deselecting.


FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 26th Aug 2007 23:42
Thanks Man, Im still learning all the commands and how they work. So thanks a lot for the help. And yes, it did work.

Login to post a reply

Server time is: 2024-11-26 11:49:14
Your offset time is: 2024-11-26 11:49:14