Simplicty and flexibility!


DataEase 8.5 - How to create a subform that change style on scroll/value in row.

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

DataEase 8.5 - How to create a subform that change style on scroll/value in row.


Download Sample

The solution is to manipulate the entire Subform when there is a scroll. 


We have included an application that show the problem and the solution and then the "ultimate" solution where we use the Timer() event on Form to control when to update.

In Maindata2 we simply replace the NewValue event from Maindata1 with a LabelExecDQL("DQL") that run the following DQL.

define "retval" text .

define "vCount" number .

define "vMoney" number .

define "vStyle" text .

vCount := 1 .

while vCount<=10 do

vMoney := GetValue(concat("Money#",vCount)) .

vStyle := "Green" .

if vMoney <0 then

vStyle := "Red" .

else

if vMoney >0 then

vStyle := "Black" .

end

end

retval := SetStyle(concat("SubRec#",vCount),vStyle).

vCount := vCount + 1 .

end

this will change the style on the record object for each row.
red if it is <0, green if it is 0 and black if >0.

in Maindata3 (final version).

We simply run the same DQL from the Timer event.

define "retval" text .

define "NewID" text .

NewID := GetValue("ID#1") .

if GetVar("OldID") not = NewID then

retval := SetVar("OldID",NewID) .

retval := LabelExecDQL("DQL") .

end

Each time the timer is called (10 times a second) it will remember NOTHING i.e. it is a fresh Script event so you need to retain the values you want to check on in global variables with SetVar(). 

So we simply check if the stored valued for RoWID is the same as the one showed in row1 now. If it is we do NOTHING. if it has changed we run the DQL.

The value here will ALWAYS change when you scroll a Subform.

To make sure we don't get a No updated event when we load a new maindata record we simply create a manip that blank the StoredID.


Written by DataEase 29/05/18 at 12:43:25 Dataease [{8}]FIVE
DG3_BlogList