PowerBuilder – More Datawindow Mouseover Effects

Posted on Thursday, February 9th, 2012 at 8:24 pm in

So I download the latest Chrome browser beta the other day (v17) and I notice a neat effect on the tabs prior to applying my custom settings. A gradient centered on my mouse pointer passed across the tab as I moved it. It was very subtile but noticiable if you were paying attention. Naturally I wanted to reproduce the effect in Powerbuilder (I used v12.5 but you could do the same thing in 10 or 11).

The settings on the datawindow column are as follows:

The Scale is set to 20 and the Spread to 25. The expression for the Mode is

if (highlight =   describe("menu_option1.name"),4,0)

Where the name of the column is ‘menu_option1’.

The expression for the Focus is

 percent

Both these expressions refer to hidden columns on the datawindow (“highlight” and “percent”) which have their values set in code on the datawindow object itself. To do this you need to define a userevent with the Event ID ‘pbm_dwnmousemove’; I call mine ‘mousemove’. In the event is the following code:

int li_pct
CHOOSE CASE Pos(dwo.Name,'menu_option')
  CASE IS > 0
    // expression on visible property looks at this value
    this.setitem(row,'highlight',dwo.Name) 
    //controls the focus of the gradient background
    li_pct = ROUND((pixelstounits( xpos, XPixelsToUnits!) - & 
    integer(describe(dwo.Name + '.x'))) / &
    integer(describe(dwo.Name + '.Width')) * 100 , 0)
    this.setitem(row,'percent', li_pct)
  CASE ELSE
END CHOOSE

Here are some screenshots showing the effect.

You might also be interested in

Top