Forms inside forms

Forms inside forms

Post by Martin Da Silv » Thu, 26 Oct 2000 04:00:00



I have a VB code that have a lot of forms in the project, I want to show
severals(a lot) of forms inside one form, like outlook's stile. how can i do
that??? Thanks.
 
 
 

Forms inside forms

Post by Debbie Cru » Thu, 26 Oct 2000 04:00:00


Create a MDI form, and the rest of the forms can be MDIChild forms.  The
child forms will show up in the MDI Form.



Quote:> I have a VB code that have a lot of forms in the project, I want to show
> severals(a lot) of forms inside one form, like outlook's stile. how can i
do
> that??? Thanks.


 
 
 

Forms inside forms

Post by Mike D Sutto » Thu, 26 Oct 2000 04:00:00


Quote:> I have a VB code that have a lot of forms in the project, I want to show
> severals(a lot) of forms inside one form, like outlook's stile. how can i
do
> that??? Thanks.

Outlook doesn't have forms within forms though.  The individual panels just
have an "X" button on...
Real fom-in-form application's are called MDI (Multiple document interface?)
applications and you can develop those with VB, you should be able to find
example code for that about on various sites.
Try this:
Add a picture box and a command button to a form.  Set both controls index's
to 0, then paste this code in an run:

'*** START CUT ***'

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

Dim PanelVis(1) As Boolean

Const SmallSize = 315

Private Sub Form_Load()
    Dim DoBtns As Integer

    'Create an extra panels controls
    Load Command1(1)
    Load Picture1(1)

    'Set up the panels
    For DoBtns = 0 To 1
        With Command1(DoBtns)
            .Caption = "X"
            .Move .Left, .Top, 255, 255
            .Visible = True
            SetParent .hWnd, Picture1(DoBtns).hWnd
            Picture1(DoBtns).Visible = True
        End With
    Next DoBtns

    'By default both panels are visible
    PanelVis(0) = True: PanelVis(1) = True
End Sub

Private Sub Form_Resize()
    'Redraw the panels
    Call CheckPanels
End Sub

Private Sub Command1_Click(Index As Integer)
    Dim ShowCap As String

    'Reverse the visible state of this panel
    PanelVis(Index) = Not PanelVis(Index)

    'Get the button caption
    If PanelVis(Index) Then ShowCap = "X" Else _
        ShowCap = Chr(60 + ((1 - Index) * 2))

    'Set the button caption
    Command1(Index).Caption = ShowCap

    'Stop the button caption being
    ' obscured by the focus rectangle
    Picture1(Index).SetFocus

    'Redraw panels
    Call CheckPanels
End Sub

Sub CheckPanels()
    'Work out where the panels need to go
    If PanelVis(0) Then
        If PanelVis(1) Then
            'Both visible
            Call MovePanels(Form1.ScaleWidth \ 2, _
                Form1.ScaleWidth \ 2)
        Else
            'Just panel 1 visible
            Call MovePanels(Form1.ScaleWidth - _
                SmallSize, SmallSize)
        End If
    Else
        If PanelVis(1) Then
            'Just panel 2 visible
            Call MovePanels(SmallSize, _
                Form1.ScaleWidth - SmallSize)
        Else
            'Neither visible
            Call MovePanels(SmallSize, SmallSize)
        End If
    End If
End Sub

Sub MovePanels(PanAWidth As Long, PanBWidth As Long)
    With Picture1(0) 'Move panel 1
        .Move 0, 0, PanAWidth, Form1.ScaleHeight
        Command1(0).Move .ScaleWidth - 255, 0
    End With

    With Picture1(1) 'Move panel 2
        .Move Form1.ScaleWidth - PanBWidth, 0, _
            PanBWidth, Form1.ScaleHeight
        Command1(1).Move .ScaleWidth - 255, 0
    End With
End Sub

'*** END CUT ***'

Hope this helps,

    Mike

 -- EDais --

WWW: Http://Members.xoom.com/EDais/


 
 
 

Forms inside forms

Post by Réjean Cloutie » Sat, 04 Nov 2000 03:13:04


Maybe function SetParent can help you...
Hope this help,

Rejean Cloutier



Quote:> I have a VB code that have a lot of forms in the project, I want to show
> severals(a lot) of forms inside one form, like outlook's stile. how can i
do
> that??? Thanks.

 
 
 

Forms inside forms

Post by SharkFIN » Fri, 17 Nov 2000 13:33:14


I would use frames instead of forms.



Quote:> I have a VB code that have a lot of forms in the project, I want to show
> severals(a lot) of forms inside one form, like outlook's stile. how can i
do
> that??? Thanks.

 
 
 

Forms inside forms

Post by Phillip Jorda » Fri, 17 Nov 2000 04:00:00




Quote:> I would use frames instead of forms.

Or, use the Win32 API to display the forms inside ALIGNed picture boxes (I
think you can retrieve the hWnd of picture boxes IIRC)

Phillip

 
 
 

1. opengl inside a form

Hi there,
        I have sucessfully followed the many examples on doing opengl in borland
c++ builder, but I was hoping to get it to show inside a form (so I can
have form elements around it etc) instead of opening a new window.  Can
I do it without having to use a full-featured opengl component?

I thought it might be just related to changing the type of device
context I'm using, but I'm not sure what to point it to.

Thanks,

Phil

2. PSP file format library

3. questions on GL,Inventor,OpenGl and forms and Forms Bug

4. Plugin help files and fonts not loading!!

5. Closed-Form Form-Factor

6. Need great skies&backdrops, downloadable now?

7. Forms in Form

8. most active web forums

9. How do I get the size of form borders and title bar on a form

10. Embedding a form in another form

11. Copy a contro from one form to another Form

12. Special form-to-form transitions...possible?

13. MDI Form, ZOrder of Componets vrs MDIchild forms