Activation of an object by script

Me again and my unanswerable questions...

Is there a way to change the activation property of an object by script (The one you can find in the relation tab of the property dialog) ? I've ound nothing about it in the documentation so I think it's impossible...

Here is my problem :
I'm building a dock widget, staying rolled at the side of the screen. When the mouse enters the tab of the dock, it unrolls (that was easy with the event handler Object_OnMouseEnter). I wanted the dock to roll again when the mouse exits. But when the mouse comes over an object contained by the dock (i.e. a shortcut inside it), it litteraly "exits" the dock. I tried to replace the Object_OnMouseLeave by its 'Ex' version and test the object, but the problem is the same : for DX, the mouse exits the dock object, so it rolls. I forgot for the moment the idea where the docks rolls at mouse exit, but on a click in an empty area of it, which is not very elegant.

Any idea ?
6,853 views 9 replies
Reply #1 Top
I'm really sorry, but the fact to post my precedent question has permitted me to find the solution, and it was so obvious that I have a little shame...

Simply, in the Object_OnMouseLeave procedure, I test if the mouse cursor is always inside the dock, by System.CursorX and System.CursorY, comparing it with the Object.Left, .Top, .Width & .Height, and then I call the rolling procedure or not depending of the result...

Sorry to fill the forum with such questions...
Reply #2 Top
That's exactly how I did it.

This issue came up recently and there were a few solutions suggested so you might want to check out the thread here: LINK

Sorry to fill the forum with such questions...
End of quote


No need to apologize; that's what this place is for. Any more questions; ask away!
Reply #3 Top
I agree with sViz... even those of us not even remotely close to y'alls level benefit when both a question and answer get posted.

the fact of the obvious answer just serves as a reminder that sometimes we make things out tom be more difficult than necessary -


*suggestion.... move away from the 'have a little shame' concept and go for the 'Doh!'... you won't feel so bad...
Reply #4 Top
We're looking for very difficult ways, and solutions are often so simple...

In the moment, I was in such a shame because I wondered the answer at the exact moment when I clicked the "Submit New Post" Button. But of course, I'm not afterall, because, firstly, as you say, this place is made for that, and in a second place, maybe there's people with the same problem, so they'll be able to find what they need reading these Q&As like we do all...

But it'll be interesting if someone has an answer to my very first question (object activation by script), just to know and it could be useful another time...

Anyway, thanks for your support.
Reply #5 Top
But it'll be interesting if someone has an answer to my very first question (object activation by script), just to know and it could be useful another time...
End of quote


Did you check the link sViz posted in #2?
Reply #6 Top
Yes I've checked it, and I put there the code I used for testing if the mouse cross the parent's object bounds, because the problem was not exactly resolved there. But there was no question about the activation of an object by script there.
Reply #7 Top
But there was no question about the activation of an object by script there.
End of quote


Ohh, now I see. Yeah, there's no way to set activation through scripting.
Reply #8 Top
I looked around it in the afternoon (I'm in France). As the subject interested me, I've found that solution :

In the object we want to activate/deactivate, let's put a boolean variable, called "Active". It could be inialized at True or False for example in the Object_OnScriptEnter sub.

Then, in each event handler involving the mouse in this object, I test this value, to do something or not.

For example :
Sub Object_OnMouseEnter
If Active Then
'... doing something ...
Endif
End Sub

Then, another object can change this activation value with :
DesktopX.ScriptObject(the object name).Active = True (or False)

If the object has states, you can also prevent the state change when the object is like that "unactivated" by inserting it in the code :

Sub Object_OnStateChange(state)
If Not Active Then
If state <> "Mouse Away" Then
Object.StatePreempt = "Mouse Away"
End If
End If
End Sub

So if Active = False, the state always will be forced to "Mouse Away".

Bye
Reply #9 Top
wow... I actually almost understand that...