Simplicty and flexibility!


Subforms & Tabs


Started by Bolt-on-Trailers
Search
You will need to Sign In to be able to add or comment on the forum!

Subforms & Tabs

Hi All,

When I create a subform inside a tab the subform records don’t display properly. In other words when I initially bring up a parent record the subform records aren’t displayed. When I curser around in the subform fields or scroll the subform the data starts to display which is odd and unreliable. Also when I switch tabs sometimes part of the subform in the other tab will be displayed in the tab I switched to. Could this be a bug or is DataEase not designed to have subforms in Tabs?


Written by Bolt-on-Trailers 04/01/18 at 18:16:20 Dataease [{8}]FIVE

Tabbed Subforms

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:17:18 Dataease [{8}]FIVE
DG3_ForumList