Forms within TabStrip and one overtaking entire form 
Author Message
 Forms within TabStrip and one overtaking entire form

Hello all,

At work it is a little slow so I thought I would try and improve the UI for
some of our in house tools. In this one tool that has about 30 different forms
for entering/reading data from a database. This is a MDI application. I have
my little form that houses a tabstrip that displays each of the forms and uses
the SetParent API method so I can place it nicely in the TabStrip. During the
program's initialization the previous authors loaded each form then hide them
once they were all loaded. Not sure why they did this. Everything works well
except when I try to display the last form that was loaded in the sequence.
All other forms fit in the client area of the TabStrip control, but whatever
form is loaded last in the sequence take over the whole for I placed the
original TabStrip control. I have tried playing around with the loading order
to see if that helps, but whatever form is loaded last screws up.

Does anyone have any ideas why this is happening? I can send screen shots if
that would help? Here is the code in the Sub Main() that is loaded first.

Sub Main()  DoEvents    Load MDI_Main  Load AirshowControl  Load CameraControl
Load ColorOptions  Load ConfigVideoCycle  Load Status  ' I took out about 20
or so of these  Load VideoCycle  Load VideoDirector  Load ViewVideo    'the
order of the following calls is important  Call GetMostRecientFiles  Call
MDI_Main.LockMenuForEditing  Call Unload(frmAbout)  Call HideAllForms  Call
MDI_Main.RepositionFormEnd Sub

Here is the part of my TabStrip form that changes the forms. It is work in
progress so any comments on how to make it better is greatly welcomed.

private Sub tsTableSelection_Click()  sFormNames(iCurrentLoadedForm).Hide
SetParent sFormNames(iCurrentLoadedForm).hWnd, 0    iCurrentLoadedForm =
tsTableSelection.SelectedItem.Index - 1  sFormNames(iCurrentLoadedForm).Top =
tsTableSelection.ClientTop  sFormNames(iCurrentLoadedForm).Height =
tsTableSelection.ClientHeight  sFormNames(iCurrentLoadedForm).Width =
tsTableSelection.ClientWidth  SetParent sFormNames(iCurrentLoadedForm).hWnd,
tsTableSelection.hWnd  sFormNames(iCurrentLoadedForm).ShowEnd Sub

Again, any ideas? Any thoughts or suggestions on how to do this better is
greatly welcomed to. Thanks.

Mark Hicks



Fri, 16 May 2003 14:14:28 GMT  
 Forms within TabStrip and one overtaking entire form


Quote:
> At work it is a little slow so I thought I would try and improve the UI
for
> some of our in house tools. In this one tool that has about 30 different
forms
> for entering/reading data from a database. This is a MDI application. I
have
> my little form that houses a tabstrip that displays each of the forms and
uses
> the SetParent API method so I can place it nicely in the TabStrip.

Ick. Either this should be a REAL MDI application with REAL child windows
or, if you want to use SetParent(), it should be an SDI application. It
looks like the original designers used MDI in a way it was never meant to be
used, something people around here try to do all the time and a few of us
consistently advise against, as I'm doing now....


Fri, 16 May 2003 15:52:39 GMT  
 Forms within TabStrip and one overtaking entire form
Jeff,

  I was wondering if you can advise on any path that would be better to folow?
Can you also explain to me when should I do when should I use a SDI or an MDI?
You stated people use MDI in a way that wasn't meant to be. I don't quite
understand what you mean. Can you clearify this a little for me. I am new to
VB ( have used it now for almost 6 months ). Thanks

Mark

Quote:



>> At work it is a little slow so I thought I would try and improve the UI
>for
>> some of our in house tools. In this one tool that has about 30 different
>forms
>> for entering/reading data from a database. This is a MDI application. I
>have
>> my little form that houses a tabstrip that displays each of the forms and
>uses
>> the SetParent API method so I can place it nicely in the TabStrip.

>Ick. Either this should be a REAL MDI application with REAL child windows
>or, if you want to use SetParent(), it should be an SDI application. It
>looks like the original designers used MDI in a way it was never meant to be
>used, something people around here try to do all the time and a few of us
>consistently advise against, as I'm doing now....



Fri, 16 May 2003 03:00:00 GMT  
 Forms within TabStrip and one overtaking entire form


Quote:
>   I was wondering if you can advise on any path that would be better to
folow?
> Can you also explain to me when should I do when should I use a SDI or an
MDI?
> You stated people use MDI in a way that wasn't meant to be. I don't quite
> understand what you mean. Can you clearify this a little for me. I am new
to
> VB ( have used it now for almost 6 months ). Thanks

It all depends on how you want the app to behave. You mention that there are
30 different screens. Should only one screen be available at one time, or
would it be good if the user could see multiple screens? I mean, have you
ever had multiple workbooks open under Excel and used the Window menu to
tile or cascade them so that you could see two or more at a time? Do you
want your app to be able to do this? If so, make it MDI but make the
individual screens MDI child forms and load them into their own window. MDI
was specifically designed to do this sort of thing and it isn't always
cooperative when you try to make it do anything else.

If you would prefer that your app behaved like Outlook, where you can't, for
example, see your Inbox and your Contacts at the same time, then I would
recommend going with an SDI (i.e., not MDI) interface and using SetParent()
to place the  "sub-forms" under the control of the main form. I'm writing an
app right now that does this.

If you want to go MDI but you still want the tab strip for easy switching
between windows (a la UltraEdit), then place a picture box on the MDI parent
form and put a tab strip control in it. The child forms will then fill the
remaining area of the parent.



Fri, 16 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Closing one form from another and resizing the entire form at runtime

2. load another form form one form

3. Possible to embed forms within one another?

4. another one... dragging a form from within

5. DragDrop problems from within one ActiveX control to the outside form

6. Accessing multiple tables from within one form in VB6

7. Embed one form within another

8. Emailing within a form and attaching that form

9. Running a form on panel within a form

10. opening a form within a form

11. Form Within a Form

12. Embedding DLL hosted forms within a parent form???

 

 
Powered by phpBB® Forum Software