Home All Groups Group Topic Archive Search About
Author
21 Oct 2005 4:28 AM
Dale
The main form is Form1.
Form2 is loaded but not visible.

Choosing a Form1 menu item makes Form2 visible over Form1.

Clicking a button on Form2 brings up a MessageBox, but then Form2 all but
disappears behind Form1. Once the MessageBox is gone, Form2 resumes its
postion in front, where it's supposed to be.

Why does it do this?  Can it be fixed?

Thanks for any clues.

--

Dale Beckett

Author
21 Oct 2005 6:37 AM
mscir
Dale wrote:

> The main form is Form1.
> Form2 is loaded but not visible.
>
> Choosing a Form1 menu item makes Form2 visible over Form1.
>
> Clicking a button on Form2 brings up a MessageBox, but then Form2 all but
> disappears behind Form1. Once the MessageBox is gone, Form2 resumes its
> postion in front, where it's supposed to be.
>
> Why does it do this?  Can it be fixed?
> Thanks for any clues.

Is it an option to make Form1 not visible while Form2 is being shown?
Or to show Form2 modally?
If neither one, post your msgbox code.

Mike
Author
21 Oct 2005 6:46 PM
Dale
mscir alleged...
Show quoteHide quote
> Dale wrote:
>
> > The main form is Form1.
> > Form2 is loaded but not visible.
> >
> > Choosing a Form1 menu item makes Form2 visible over Form1.
> >
> > Clicking a button on Form2 brings up a MessageBox, but then Form2 all but
> > disappears behind Form1. Once the MessageBox is gone, Form2 resumes its
> > postion in front, where it's supposed to be.
> >
> > Why does it do this?  Can it be fixed?
> > Thanks for any clues.
>
> Is it an option to make Form1 not visible while Form2 is being shown?
> Or to show Form2 modally?
> If neither one, post your msgbox code.
>
> Mike
>
>

Hiding Form1 while Form2 is visible works, but that seems clunky and I'd
rather not.

Form2 has a ListView control, lvwTHINGS. The (unfinished) code for a Form2
command button is:


-------------------------------
Private Sub cmdDel_Click()
    Dim rc As Long

    rc = MsgBox("Delete item " & lvwTHINGS.SelectedItem.Index & "  " & _
                lvwTHINGS.SelectedItem & "?", vbYesNo, "    Item Delete")

    If rc = vbYes Then
    Else
    End If
End Sub
-------------------------------


I'd like to be able to see the Form2 ListView to double-check what I'm
about to delete before I click YES or NO, but Form1 moves to the foreground
right behind the MessageBox and obscures Form2.

Could it have anything to do with the fact that the ListView on Form2 was
initialized and populated by Form1 at program startup? Here is that code:


________________________________
Form2.Show
Dim itmX As ListItem
Set clmX = Form4.LV1.ColumnHeaders.Add(, , "      Name", 200)
Set clmX = Form4.LV1.ColumnHeaders.Add(, , "      Sound", 200)

For x = 1 To NameCounter
    Set itmX = Form4.LV1.ListItems.Add(, , NameList(x))
    itmX.SubItems(1) = SoundList(x)
Next x
Form2.Hide
________________________________



Help is much appreciated.


--

Dale Beckett
Author
21 Oct 2005 10:43 PM
Dale
Dale alleged...
> mscir alleged...
> > Dale wrote:
> >


Oops!  Those references to Form4 are typos. They are "Form2."

--

Dale Beckett
Author
21 Oct 2005 1:14 PM
Jeff Johnson [MVP: VB]
"Dale" <d***@NOT.com> wrote in message
news:MPG.1dc23867766e412b9896d3@news.microsoft.com...

> The main form is Form1.
> Form2 is loaded but not visible.
>
> Choosing a Form1 menu item makes Form2 visible over Form1.
>
> Clicking a button on Form2 brings up a MessageBox, but then Form2 all but
> disappears behind Form1. Once the MessageBox is gone, Form2 resumes its
> postion in front, where it's supposed to be.
>
> Why does it do this?  Can it be fixed?

There are known bugs with modal forms and z-order in MDI applications. I'm
not too sure about what you're describing, though.