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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position form in another form when radio clicked 1

TheLazyPig

Programmer
Sep 26, 2019
106
PH
Hi!

Can I position my form (frmchecks.scx) to appear inside another form (branch.scx) when the radio button is clicked? It works when I change the Top and Left but if I do this will it stay in the position even if the device changes?

branch_fp9.png checks_fp9.png<-- changes depend on the radio button

frmchecks.scx should be in the yellow square below.

branch2_fp9.png

Thanks for the replies. :)
 
Okay, but the first thing that should come to your mind to do something similar in VFP is a container, not a form. Why did you go for forms immediately? You see a bunch of controls in a reserved free area. The designer of that old program should have used a pageframe, too, by the way, but he was likely using containers at that place, he made visible=.T. or .F. It's not a nice way also to design and maintain this. A pageframe also has it's pages at designtime and you can also switch between them to design and modify them. It's the simplest way to have a set of areas to display at the same place.

If you like the choices to be on the side, instead of the top, there are the pageframeproperties taborientation, where you can decide whether tabs are on the top (normal default), bottom, left or right, tabstretch, which determines whether you have a single row of tabs or - better in your case with the many options you have - multiple rows, and finally tabstyle, which determines whether tabs all have just the size necessary for the caption and there's free space after the last tab or whether the tabs always extend over the whole width or height of the pageframe and the captions are displayed justified within the tabs (each tab caption centered).

As others and I have also said, you could also use a pageframe with no tabs, just set the pageframe.tabs property .F. - and then have your radio buttons (in VFP an option group) to pick an option or a button group to have a staple of buttons looking like page tabs with their caption still horizontal (pageframe taborientations left and right have tabs with captions written vertically). So you could easily adapt to what you see there, but even with the argument the user acceptance is best when the new application just looks, feels, reacts and works exactly the same: Why even bother to recreate it then? You should improve what you're able to improve to more normal UI designs, like a pageframe is. If that gives you the idea to create forms and not even simply containers or - as most here got the same idea - a pageframe. It doesn't require to start a form and position it in a prereserved space, it consists of pages which are at the prereseved spaces, you can - if ou llike that for a start - have an empty page, too, then user pick a page by tab and that appears - without any code. It's exactly what you want and does not even require creating a container and place it there

Do you not knew the pageframe? What controls of VFP are you using regularly? No pageframe? No grid? No combobox, listbox? Too complicated? Take a look at a project called solution:
Code:
Modify Project (_samples+"solution\solution.pjx")
And then switch to the "Code" tab of the project manager (by the way, a good example of a pageframe you certainly know and use, too) and start main.prg with the Run button. Then ou can search and pick examples also about things like the VFP controls and how they work, with demonstration and source code (as the whole project source code is).
I have only used forms, combo boxes, text boxes, buttons, option groups, and grids, and am not familiar with containers. Even pageframe and the use of classes is new to me. I did not explore much when all the VFP projects were handed to me. :cry:

Code:
Modify Project (_samples+"solution\solution.pjx")

This is really helpful. The last person who handled all our VFP projects never told me about this. So I only use all the existing projects that made as my references. We're already transferring almost all our projects to our main system but this is one of the few stand-alone programs left. [bow]
 
Last edited:
It's strange to me to be unfamiliar with classes, but I'm used to many VFP developers getting about without them, at least without creating them. You're always a user of classes, as every control you put on a form is an instance of a baseclass of VFP. You're not leveraging the benefits of classes for being able to do something once for all future uses, i.e. you're too lazy to learn about a great source of being even more lazy.

Well, well, but in this case the use of a pageframe is not about creating classes. I think I know why you refer to it, as I mentioned "Save as class" to get the form content as container classes you could use in the main form, then, to spare the recreation of all these form contents. I guess you'll just be copying the form contents over into pages, that's also fine.

If you solely created the forms for displaying them in the reserved area of your main form, you don't need them anymore, then you also don't need container classes that you can put into pages of a pageframe and also use in forms to get the same grouping and layout of controls and all their code in one place.
 

Part and Inventory Search

Sponsor

Back
Top