Skip to Content

The PowerBuilder datawindow is just that: A window into your data.  Data source and layout at design time and data buffers and presentation of that data at run time. I have always being an advocate of using tools for what they were meant for. But, or rather and more!

By animating, I mean conditionally showing objects using the visible expression of each object.  You may for example have a log of phone calls made and want to show the phone number only for the time it was active.

To exploit the visible expression there are two unusual things you need to do.  You need each data element to be a text object, not a column, and the databuffer to have only one row and in this case one column.  For illustration we will paint a text object in the painter.  For real, you would want to generate the text objects at run time. For now:

Visible.png

phone_4689 is a text object with the text “212 922 1234” and we want to show this phone at the time is was in use; between 9:10 and 9:45.  The datawindow contains one row and one column: “showtime” of type time. So the phone_4689.visible expression then is “if (showtime > time(‘09:10’) and showtime < time(’09:45’), 1 , 0 )”:

All we need to do at run time is to animate is to advance the “showtime”.  Do this either in the timer event or a slider to let the user emulate the time they want to see.  Or both.

For this example the timer event increments the time of day by a minute each time the event is triggered:

itShowTime = RelativeTime ( itShowTime , 60 )

dw_1.SetItem ( 1 , ‘showtime’,  itShowTime )

A start button could contain:

itShowTime = time ( ’09:00’ )

if dw_1.RowCount() = 0 then dw_1.InsertRow(0)

timer ( 1 , parent )

You should see the phone number ten seconds later for 35 seconds.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply