Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form inside a Pageframe 1

Status
Not open for further replies.

SitesMasstec

Technical User
Sep 26, 2010
470
1
18
BR
Hello colleagues!

I am creating a form which has a Pageframe with 6 Pages (5 similar -Passageiro 1 ...5- and the 6th for totalization of numeric fields ).

Each Page has about 20 fields (in the Page1 of the Pageframe I created only 8 fields and their labels, for now):
ReservaPageframe_jwqk8m.jpg


Well, in just one table I will have all the fields in the form.

I may copy all the fields already designed in Page1 of the Pageframe to Page2, Page3, Page4 and Page5, and create methods to display the contents of each Page of the Pageframe when the user clicks Page1 ... Page5 when executing.

But I am thinking about a simpler solution: just create a new Form (named Complement, for example) with the fields in Page1 of the Pageframe, and then erase all the fields in Page1. When executing, and the user clicks on Page1...Page5 the called page will display the new Form Complement INSIDE the clicked Page of the Pageframe.

Is this idea a too high dream or is a possible one?


Thank you,
SitesMasstec
 
Yes, you can do that. You could even do the extreme, put everything into page 1, then copy all controls into all pages and finally delete from page2 to page5 what's not relevant there. That doesn#t need a second form, but okay, it's never bad to be able to go back to where you are already by first making a backup and/or do your experiment in a copy.

Also, what you didn't ask but also heps, you can set controlsources of all controls and don't need to set values when a page is activated, the data binding with controlsources does work no matter if controls are on the active page or an inactive page, so once all data binding is done, there's nothing to do when the page is switched. You might have reasons to navigate to a correct record or set a filter or anything like that and you might have unbound controls you only want to set once they are displayed, then acting in the page.activate() event surely is right - and no problem.

Chriss
 
Chriss, I understood what you said. It is fine. Problem will arise if, in the future (probably) I will need to change the size and/or position of a control, for example. In this approach, I will have to make change in the same control in all 5 the pages in the Pageframe. Then, it will be easy to make a mistake.

I would like to have just one page (in case I mentioned, the new Complement form), which would be displayed inside the clicked Page of the Pageform.

Of course, you tip about using Controlsource is helpful!

Thank you,
SitesMasstec
 
Copies of something don't adjust when you later change the orignal, that's true.

If you want something on every page there is the defintion of a separate page class and the memberclass feature, but we discussed the problems with this in a recent thread.

There's something else you can do, which is always applicable: Design a set of controls in a container and then put that on multiple pages. If, in the future, you then change the composition or position or sizes of textboxes and other controls within that container, every page adapts the same way.

There's another simple solution that requires neither a page class nor a container class: Put controls on none of the pages, put them on the form and then just move them into the area of the pages and they keep showing no matter to which page you switch. If you want something like that, a better design is to put such controls in areas above or below the pageframe and on no page at all.

Chriss
 
Chriss, I like this option of yours:
Chriss said:
...design aset of controls in a container and then put that on multiple pages. If, in the future, you then change the composition or position or sizes of textboxes and other controls within that container
Well, I created in a new form a container with all controls I had put in Page1 inside it and saved that container as a Class:
ContainerClass_gyjdgg.jpg


Then I opened my custom class library and copied that class I had created to Page2 of the Pageframe in my old form. Only the container is copied, without any controls I had put inside it:
ContainerClassVazio_tfreke.jpg


What am I missing?


Thank you,
SitesMasstec
 
That's not how to create a container with controls.

When you save selected items as a class, you really just get the selected items. So, if all you select is the cnotainer, you get an empty container.

Don't put a container on the form, just select the group of controls and then save the selected items as a class, and the class will be a container containing these controls or, I think that's simpler,
just create a class based on container and then put the controls in there. And don't start on the form at all. Classes are usually created on their own, you don't need to start class creation on a form, otherwise all classes you can create would be based on containers, you usually want to also be able to create classes on another basis, like form classes, timer classes, etc. Creating a class from selected items of a form is not the general way to create a class.

To create a class you just pick the menu item File->NEW->CLASS and then the baseclass and the VCX library to store it into, once that dialog is done you're already in the class designer and that works about the same way as the form designer works. And later you drag&drop the class on a form, for example.

Chriss
 
Nice, Chriss! I created a custom Class will the controls and then put it in 3 pages, just to test.

Also, after that, I changed some properties of a control in the Class. And the change was reflected on 3 pages of the Pageframe!


Thank you,
SitesMasstec
 
One thing to notice: When you put your container class on a pageframe, which already has some other controls on it, the container area is on top, which means even blank/transparent parts of the container are like a walll in front of what's underneath. To change what's in the foreground and background the form designer offers the "Bring to Front" and "Send to Back" items in the Format menu. So simply select the container and use "Send to Back", so any overlap even with the blank areas of the container is not hindering interactions.

Another topic is how tab order now works, before I explain this with words, just start your form, select a page and tab through controls and see in which order the focus changes.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top