Simplicty and flexibility!


New Sample 8.5 - How to make your own Tabbed Subforms that work...

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

New Sample 8.5 - How to make your own Tabbed Subforms that work...

Sample

Hi.

Tabs was one of the big news in DataEase 7.x but as the majority of the new functionality and the product itself it was a rush job by an "untrained" team.

There is a lot of history in a product like DataEase so when changing and adding thing you need to understand how things work, and why they work that way to be able to expand the functionality.

Tabs was a catastrophe in the first version but due to the sloppy implementation and the format of DataEase FRM they have been bedraggled with problems since day one.

The problem you experience is that the Subforms themselves was never made to be in a Tab Control so they don't behave correctly. This should have been handled by the TabControl but it isn't so you experience the problems you describe.

This could have been solved in OML if the TabControl had had the proper Events enabled but it doesn't.

Our evaluation when it come to the TabControl is that it should be scrapped and remade and it is really only retained for backwards compatibility.

We agree that it should work and it is on our fix list but there is plenty of things that is ahead of it on the list.

DataEase 8.5 come with so many new functions so you can in fact make the same functionality yourself, and to "help out" we have made a small sample to show how you can use these features to make your own tabcontrol.


What we do is quite straight forward:

We insert the subforms next to each other simply because it is a mess in Design Mode if we put them on top of each other. You can later move them on top (but not completely so you can get at them and move them again) if that will make your designing easier i.e. you want fields next to the tab etc.

Then we create the buttons that will do the handling.

We have intentionally used the same names for the buttons and subforms that is just separated with numbers and "class" i.e.

SubForms: SomeData1, SomeData2, SomeData3
Buttons: bnSomeData1, SomeData2, SomeData3.

This is so we can use wildcard to hide and change the style etc.

On the Manip - virtual field that is called every time you clear/save etc. we have the following derivation.

SetState("Manip",0)+SetState("SomeData*",0)+SetState("SomeData1",1)+MoveObject("SomeData*",GetCurrent("xpos","SomeData1"),GetCurrent("ypos","SomeData1"))+SetStyle("bnSomeData*","Normal")+SetState("bnSomeData1","click")


What we do here is:

1. Hide the Manip itself.
2. Hide all the Subforms (SetState("SomeData*",0)
3. Show the first Subform
4. Move All the subforms to the same position as SomeData1
5. Style all the buttosn to the default i.e. Nomal.
6. Click on the Fist Button to initiate default handling i.e. first Subform (tab) visible.


What happens when you click on a button.

SetState("SomeData*",0)+SetState("SomeData2",1)+SetStyle("bnSomeData*","Normal")+SetStyle("bnSomeData2","Button 2")

Very simple.

1. We hide all the subforms. (we could of course save away which form was last active and hide that and show the new one but why? You can't see the difference and this way is less code...;-)
2. Show the correct subform.
3. Reset style on all buttons to "Normal".

4. Set The style on active button/form to Button 2 (red).

Voila.

Not difficult.


Written by DataEase 08/01/18 at 15:44:58 Dataease [{8}]FIVE
DG3_BlogList