Simplicty and flexibility!

New Sample 8.5 BETAII.2 - Showcase MoveObject, Label Alignment, Transparent Fields, SetStyle() (Ver.

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

New Sample 8.5 BETAII.2 - Showcase MoveObject, Label Alignment, Transparent Fields, SetStyle() (Ver.

We are sorry that the link was a "dud", this has now been fixed!

Download Sample

Inital setting

We Love using Virtual fields for manipulation. A virtual field will be triggered every time the form is updated i.e. loaded, saved, searched etc, so ideal for even control. If you make it dependent on another field it will get updated every time this field is changed too.

In this sample we use Moveobject() to move the "time" to the extreme right and the info thex to the window center.

MoveObject("Picture",concat("S",GetCurrent("Width")),concat("S",GetCurrent("Height"))) -- this one stretch the image to fill the form.

+MoveObject("Heading","R","") -- this simply move heading to the extreme right, but don't move it in Y direction.

+SetLabelText("Heading",concat(current time, " - ", spelldate(current date))) -- this one simply set the Label Heading to the current date and time.

+SetState("Manip",0) -- hide the field Manip which do all of this.

+MoveObject("BodyText","C","C")+MoveObject("ToOld","C","C") -- move the two objects BodyText and ToOld to center of window. See how we manipulate the Z-order by initially putting ToOld further down in the form than BodyText. This make it on top of BodyText even after we move it.

Constant Updating Event.

DFW doesn't have a scheduler or timer event so you have to cheat to get things to happen on a regular basis. The best way today to get things to be checked is to put an event handler on the Form Object::mousemove. This event is called every time you move over the form.

We often use a SetVar("MyTimer",Current time) and then basically check if a certain time as elapsed. 

In this sample we simply change the label Heading every time you move the mouse, but we could easily fix it so it only did it every time the time changed i.e. each second.

However this is just a "stupid" sample so doesn't really matter...

Our Form is called Mainpage so don't look for a Mainpage property, it would be the name of your form.

We use label and not field for the simple reason that Labels are transparent, but fields aren't. 

With the new SetLabelText() you can simply use labels as "virtual" fields for displaying messages warnings etc. Combine it with SetStyle() and you can also change the look entirely of the label. Imagine a bright red warning style for warnings, and a nice green one for everything OK.

Just be aware that the size of a label is not dynamic, so you have to make sure the size is big enough for everything you want to put into it.

We use SetStyle() on the BodyMessage and the even MousEnter/MouseExit.

The text is transparent when not hovered over, but change to bold and blue background when moused over for better readability.

Have a play and enjoy!

Have a nice weekend!

The DataEase Team.

For this sample you will need to download BETAII.2 (1767) or higher or it will simply not work.

Written by DataEase 10/04/15 at 16:27:00 Dataease [{8}]FIVE