Please advice..

ayufans
ayufans used Ask the Experts™
on
Hi.. First of all, I'm using win 98 and VB 6.0 along with Access 2000. I'm making an application which uses a tree view to show all the available module in the application. So it's like :

- Maintenance
   - Backup Database
   - User & Password
- Finance
   - Accounting
     - Report

and so on. Now.. what I would like to do is to show a different form according to the node that is clicked on the tree view, and I would like to show it on the same form. Did that make sense ? So I have this main screen that have a tree view which populate about 1/4 size of the main screen and I would like to show appropriate form according to the nodes being clicked on the other 3/4 of the main form. As reference, I would like to do something like "Outlook Express", where when we click the "inbox" node, the frame on the right hand side would show inbox.

This is getting long :) anyway.. I don't want to use frame because it could only show one node at a time. For example, if I click at the "Report" node, while previously I have clicked on the "Accounting" node, the only frame that would be available are only the "Report" frame, while if I want to look back at the "Accounting" frame, I would need to click at the "Accounting" node again.

I'm thinking about using tabstrip, so when a node is clicked, I would add a new tabstrip and if I clicked 20 nodes, there would be 20 tabstrip available to select from. But I'm facing a brick wall right now, since from article : http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20163494.html it is said that tabstrip is not a container. So what should I use ? the ocx given there which is something like TAB...ocx did not exist in my VB ?

So please advice on what should I use instead of frame (coz' I can only show one form at a time) or tabstrip (since it is not a container ?). Thank you very much Experts !

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Suppose you have one frame able to show information about one node.

There is nothing preventing you from adding information from several nodes into the same frame.

Author

Commented:
However, I need to put an information of one node into one frame, so user can choose which one he/she would like to view.

It's like this.. if a user choose the "user & password" node, ideally, what I want to show is a form inside a frame or tab or whatever, where user can add/delete username or change password. However, I would to have this particular form opened, if the user didn't close it and click on another node. For example, after clicking the "user & password" node, the user didn't close the form and click on the "report" node. There's no way I would put what's being shown on the "user & password" form as one with what I'm going to show on the "report" form right ? so what I want is there going to be two frame (or whatever) showing at the same time, where user can switch back and forth between the node he/she choose.

Any solution ? or should my question be :

"can I put a form (including all the coding in it) in a frame or an SS Tab ?"

Commented:
why do you have to show both forms at the same time. Since user & password is a node and report is another, I think is reasonable that frames switch and you only see the node you have selected. Multiple selection in your treeview so that information for several nodes will be shown at the same time, do you really want that? The user might get confused with so much info at once.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
yes, I have to have that. It's not for me to decide, my boss wants that, because this application is not only about report and user & password. This will be a freight forwarding software, and user might need to open more than 2 windows at the same time. For example : when inputting bill of lading, they might need to look for job order or whatever.

Any suggestion ?
Here's the "magic" you will need (SetParent API).

You can have a picturebox (or any container control) to host the form.


Her's how to recreate the project for the code I am providing below:

Create a project with Form1 and Form2
Form1 has a picturebox on it named Picture1 and a Command Button named Command1

Form2 can have whatever you want on it.

Copy/Paste this code into Form1's code window.

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Sub Command1_Click()
    Load Form2
   
    Call SetParent(Form2.hWnd, Picture1.hWnd)
    Form2.Show
   
End Sub
 Run and see what happens.  If you need multiple forms to show,create multile pictureboxes on the fly.

The following issues will need to be addressed:

1) Resizing of the form
2) Scrolling of the form
3) Multiple forms scrolling (or put in a tab)

Commented:
Maybe you could use MDI parent-child relations. You will have a main form with the tree, and within this main form you can open MDI child forms accroding to whatever node is being pressed. Although it will look more like mIRC instead of Outlook-Express, but that is your descision...

Commented:
hi,

As you are using VB6, there is an control called "Microsoft Tabbed Dialog Control 6.0 (sp5)" in the component property page. include this contol.

this control has the container and you can see the frames placed in the various tabs in the "Design Time"

please try this it will work fine and will solve your problem.

Author

Commented:
zardi : I've tried it before, it was just too confusing for me. You see... I'm not very good with VB :p

twalgrave : damn man.. this is great ! anyway.. you mention about putting the multiple forms on a tab inside the picture box ? (point no.3) how could you do that ? would you please give more info about this ? so far this is great, and it's just what I wanted. However, the way the form was placed on the picture box is a bit confusing for me. If I want to put 7 forms in one picture box (or even more) is there a way to click each one of it according to our needs ? because the form that was in the picture box wasn't in the explorer bar no more ? how can a user accurately click on the right form ?

Commented:
Nice, I learn a lot just reading your comments. So much knowledge and so little time to suck out your brains...

Author

Commented:
hi, jayam_jk. Thanks for the response. Are you talking about the SSTab ? I've tried it and it doesn't do any good, since I can't actually insert a form into it, while I have create quite a number of form that I would want to use instead of putting the whole coding on one form.

Author

Commented:
hi, jayam_jk. Thanks for the response. Are you talking about the SSTab ? I've tried it and it doesn't do any good, since I can't actually insert a form into it, while I have create quite a number of form that I would want to use instead of putting the whole coding on one form.
use cool bar on MDI form. for this you have to select the Microsoft windows common controls-3 6.0

Place on your MDI form..set its Align property to vbAlignLeft...and set the width property to 1/4 of ur MDI form width.

Then put ur tree view on that...

Now design diffrent chield forms for diffrent modules and on click of a tree node show respective form ...

Author

Commented:
hi sachin, thanks for the input. But I have tried twalgrave idea and show it to my boss yesterday. He pretty much change his mind and ask if I could immitate "eudora mail" for the application or not ! like it was a snap of the finger !

now.. I personally think it wouldn't be fair to ask a completely different question on this thread, so I'd accept twalgrave comment and post a new thread.

Thank you all !!! ^_^

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial