Easy to Create, Easy to Change - Easy to use!


How to highlight active record in a subform by using GetCurrent("RowNumber"), SetStyle(with * and #) and GotFocus/Mousdown.


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

How to highlight active record in a subform by using GetCurrent("RowNumber"), SetStyle(with * and #) and GotFocus/Mousdown.

Download Sample



We got a very good question on the forum, so we publish it here to as this will be of general interest. It is written a little "personal" but we hope you can live with that....


You are right (and wrong) and so am I ;-)

Firstly I applaud your effort and attempt and you were right. You can combine * and # so it is obvious that we can't keep up with developments around here (and that is not a joke, it is so much new functionality, bug fixing, and new features that we the QA/Documentation team can't keep up. There is features that will revolutionize DE forever that hasn't even been properly tested in house and hence haven't even been shown to anyone...like full Email Support, WebForms in DE85, Remote() reading/writing to data sources, DataEase Server, Deployment Services... it is all there just need final QA, Documentation and gift wrapping.... it will be an exciting year)

But first it is 85 and the matter at hand ...

I misunderstood you and you misunderstood GetCurrent("RowNumber").

GetCurrent("RowNumber") gets the current rownumber from where it is being called so when you put in a vManip in the Subform there will be one clone pr. row so each row will run the same script, hence you get the same style everywhere (must applaud you for using SetStyle() rather than SetColor() too, as it seems a lot of our user don't see the difference and find SetColor() more understandable... ).

DataEase doen't have an event for "active" row as that is how we should have solved what you want properly. 

Record has a GotFocus event but it doesn't work (we have scheduled a OML cleanup but won't happen before 8.5 release) and then we will call GotFocus() all the way up the chain so when a field on a row get focus, the record get focus and the subform get focus etc. This way you get better control.

But for now we have to cheat, or use a work around....

It is not as hard as it sounds.

If you use the mouse you can put the Script on the Subform/Record (we have renamed it sbSubFormRecord (yes, you can rename records now... makes things so much easier...) MouseDown() event.

define "retval" text .

retval := SetStyle(concat("sb*#",GetVar("RowNumber")),"Normal") +wait(0.1)+ SetVar("RowNumber",vCurrentRow.value) +wait(0.1)+SetStyle(concat("sb*#",GetVar("RowNumber")),"Green") .


To honour your brave efforts we do use * (wildcard ;-).

What we do here  is first to reset the last Record that had "focus" and then set the current record,we also save away the rownumber so we know which was last next time.

So far so good...

But what if you Tab into the subform (lots of keyboard bums out there still).

Then you simply need to put the same script on the first field in the taborder in the subform.

define "retval" text .

if GetVar("RowNumber") not= vCurrentRow.value then

retval := SetStyle(concat("sb*#",GetVar("RowNumber")),"Normal") +wait(0.1)+ SetVar("RowNumber",vCurrentRow.value) +wait(0.1)+SetStyle(concat("sb*#",GetVar("RowNumber")),"Green") .

end 

For us that was sbFirstField  so we put the script there.

This should cover it, so then to the million dollar question?

Why don't we have to put it on the rest of the fields?



PS! It seems that the * wildcard doesn't work for row one. It is already reported to the nerds and will be dealt with accordingly.

All the best.

Written by DataEase 28/01/16 at 11:26:05 Dataease [{8}]FIVE
/static/images/blank.png