Auto-hidden ObjectBar - unhide when widget text changes

Hi,

I've developed a gadget/widget for a client. It displays some information from a web service. A bit of text and an image that changes depending on the data retrieved from the webservice.

We use the widget in an ObjectBar which sits on the right-hand edge of the screen as a sidebar. All fine so far.

However, in a demonstration today the client asked if we could auto-hide the ObjectBar, but make it slide out when the data displayed in the widget changed.

I'm very new to DesktopX and ObjectBar but I haven't some across a way to do this yet.

Is it possible to make an ObjectBar with autohide on appear without the user moving the mouse to the edge of the screen?
Is it possible to make the objectbar then slide back into the edge of the screen after a period of time?

I'm using Object bar v2.1 Build 756 and DesktopX Builder 3.5.

Thanks
Mark

28,239 views 9 replies
Reply #1 Top

It's possible with DX . . but embedded in OB . . I'm not sure.

Reply #2 Top

Hi Zubaz,

If it's not possible with OB could you tell me how to do it with DX?

Thanks

Mark

 

Reply #3 Top

I'm moving this to the DX forum so an expert will see it and help.  :)

Reply #4 Top

I don't use ObjectBar but I made an example object for DX. You can download it here: LINK

This is the script for it:

Dim hiddenX
Dim shownX

margin = 20 '--how much of the object remains visible when hidden
hiddenX = System.VScreenWidth - margin '--object position when hidden
shownX = System.VScreenWidth '--object position when shown

'Called when the script is executed
Sub Object_OnScriptEnter
 Object.left = hiddenX
End Sub

'Called on mouse over object
Sub Object_OnMouseEnterEx(obj)
 Object.KillTimer 1
 Object.Right = shownX
End Sub

'Called when mouse leaves object
Sub Object_OnMouseLeaveEx(obj)
 Object.settimer 1, 500
End Sub

Sub Object_OnTimer1
 Object.left = hiddenX
 Object.KillTimer 1
End Sub

'Call this function when information changes
Function showBar
 Object.Right = shownX
 Object.SetTimer 1, 5000 '--5 second timer
End Function

 

It has the basic autohide properties--show on mouse over, hide on mouse away. Since I don't know what conditions you want to trigger the auto-show, I just created a function called showBar. When your information changes, you can call that function like this: Call showBar

I kept it fairly simple, but if you need it to do more, don't hesitate to ask.

 

Reply #5 Top

:inlove:

Best community ever!

Reply #6 Top

Thanks heaps sViz,

I'll download it and let you know I go.

Mark

Reply #7 Top

Hi SViz,

I need some more information. Is it possible for the child object to call a parent object script function from a child object?

Some background on what I'm trying to achieve......

My widget displays information from some medical systems. As the user views a patient in one system, I get an patient id number from the registry and check to see if the patient exists in another system through a web service. I do all this checking outside of the widget in a COM dll and just return the widget a comma-delimited string of values for it display or alter its appearance. So as you edit the record for Fred Smith in one system, my widget changes to a green light with Fred Smith's name indicating they exist in the other system. That part's all working.

 

My widget consists of a container which has 2 children inside it.

One child is an image layer that displays traffic lights (green, amber, red). These change depending on whether the patient info exists in the target system.

The other child is a text layer. It displays the patient's name.

The container currently has no script. The child objects each have their own script that runs a timer to check every second whether they need to change the information they are displaying.

I have put your code on the container to make it popup from the edge of the screen, but I still need to trigger the showBar function from one the child object. Is it possible for the child object to call a parent object script function?

Perhaps I need to move the script logic from the child objects into the parent and let the parent container do all the processing and the container sets the image and text of its children.

Let me know if you need more info. Thanks for your help so far.

Mark

 

Reply #8 Top

Yes, you can call the parent's script from the child object. Just use this line:

DesktopX.ScriptObject("parentname").showBar

I uploaded some autohide templates that do just that here: LINK

 

I would recommend putting all your scripts in the container; it's much more steamlined than having a bunch of scripts running in different places, and if you need to make changes you only have to open one script.

In that same vein, you can also detect mouse clicks on the child object FROM the parent object by using this code in the parent object:

'Called when L-click on object or its children
Function Object_OnLButtonUpEx(obj, x, y, dragged)
 If dragged Then Exit Function
  Select Case obj.name
  Case "childname"
   Call showBar
 ' Case "anotherchild"
 '  Call a another function
 End Select
End Function

 

Sounds like a really cool widget you're working on. Good luck! :thumbsup:

Reply #9 Top

Thanks sViz,

I was hoping it was that simple.

I'll give it a try next week as I'm off work for the rest of this week.

It is an interesting widget but as always there's a tight budget and I'm out of time.

Takes the fun out of it 8C

 

Mark